fn encode_header<W: Write>(&self, writer: &mut W) -> io::Result<()> {
        let tree_rep: Vec<u8> = (0..=u8::MAX)
            .into_iter()
            .map(|b| self.hbook.get(&b)
                 .map(|s| s.nbits as u8).unwrap_or(0))
            .collect();
        writer.write_all(&tree_rep)?;
        writer.write_all(&self.input_size.to_le_bytes())?;
        writer.flush()?;
        Ok(())
    }
/// Encode tree and number of bytes in the source.
///
/// This forms the header of the encoded file.
/// For now, simply dump the number of bits for each symbol.
/// Other strategies could be used depending on which symbols are
/// actually encoded.
Encode tree and number of bytes in the source.
This forms the header of the encoded file.
For now, simply dump the number of bits for each symbol.
Other strategies could be used depending on which symbols are
actually encoded.
Encode tree and number of bytes in the source . This forms the header of the encoded file . For now simply dump the number of bits for each symbol . Other strategies could be used depending on which symbols are actually encoded .
fn encode_header<W: Write>(&self, writer: &mut W) -> io::Result<()> {
        let tree_rep: Vec<u8> = (0..=u8::MAX)
            .into_iter()
            .map(|b| self.hbook.get(&b)
                 .map(|s| s.nbits as u8).unwrap_or(0))
            .collect();
        writer.write_all(&tree_rep)?;
        writer.write_all(&self.input_size.to_le_bytes())?;
        writer.flush()?;
        Ok(())
    }
fn encode_header < W : Write > ( & self , writer : & mut W ) -> io :: Result < ( ) > { let tree_rep : Vec < u8 > = ( 0 ..= u8 :: MAX ) . into_iter ( ) . map ( | b | self . hbook . get ( & b ) . map ( | s | s . nbits as u8 ) . unwrap_or ( 0 ) ) . collect ( ) ; writer . write_all ( & tree_rep ) ? ; writer . write_all ( & self . input_size . to_le_bytes ( ) ) ? ; writer . flush ( ) ? ; Ok ( ( ) ) }
Encode tree and number of bytes in the source.
Encode tree and number of bytes in the source .
&self
writer
&mut W
&self
writer
&mut W