Function lib_rapid::compsci::compression::huffman::read_from_file
source · pub fn read_from_file(path: String) -> String
Expand description
Reads and decodes the message stored in the .hlr and .htlr files.
Arguments
path
- The path to be read from.
Returns
A String containing the decoded message.
Examples
use lib_rapid::compsci::compression::huffman::{Encode, Decode, write_to_file, read_from_file};
let s: &str = "Lorem Ipsum123123123";
let enc = s.full_encode(); // Encodes the String s into enc.
let dec = enc.full_decode(); // Decodes the BitVec which was created by the last line.
write_to_file("test".to_string(), &enc.0, &enc.1);
let dec_written = read_from_file("test".to_string());
assert_eq!(dec_written, "Lorem Ipsum123123123");