fn consume_channel<R: Read>(from: &mut R, to: &mut [u8]) -> Result<()>