fn encoding_task(config: Config) -> io::Result<()> {
    let file = File::open(&config.filename)?;
    let hfcanonical = HuffmanCanonical::from_stream(file)?;

    println!("Entropy: {}", hfcanonical.entropy());

    let out_name = format!("{}.huffman", config.filename);
    let input = File::open(&config.filename)?;
    let output = OpenOptions::new()
        .write(true)
        .create_new(true)
        .open(out_name)?;

    hfcanonical.encode(input, output)?;

    Ok(())
}
/// Produce an encoded file from a regular file.
Produce an encoded file from a regular file.
Produce an encoded file from a regular file .
fn encoding_task(config: Config) -> io::Result<()> {
    let file = File::open(&config.filename)?;
    let hfcanonical = HuffmanCanonical::from_stream(file)?;
    println!("Entropy: {}", hfcanonical.entropy());
    let out_name = format!("{}.huffman", config.filename);
    let input = File::open(&config.filename)?;
    let output = OpenOptions::new()
        .write(true)
        .create_new(true)
        .open(out_name)?;
    hfcanonical.encode(input, output)?;
    Ok(())
}
fn encoding_task ( config : Config ) -> io :: Result < ( ) > { let file = File :: open ( & config . filename ) ? ; let hfcanonical = HuffmanCanonical :: from_stream ( file ) ? ; println ! ( " " hfcanonical entropy ( ) ) ; let out_name = format ! ( " " config filename ) ; let input = File :: open ( & config . filename ) ? ; let output = OpenOptions :: new ( ) . write ( true ) . create_new ( true ) . open ( out_name ) ? ; hfcanonical . encode ( input , output ) ? ; Ok ( ( ) ) }
Produce an encoded file from a regular file.
Produce an encoded file from a regular file .
config
Config
config
Config