Convert to lib
This commit is contained in:
parent
34d0f0bafa
commit
96415385ef
@ -1,13 +1,6 @@
|
||||
// https://marknelson.us/posts/2014/10/19/data-compression-with-arithmetic-coding.html
|
||||
#[allow(non_snake_case)]
|
||||
mod modelA;
|
||||
use sac::modelA::ModelA;
|
||||
|
||||
mod bit_buffer;
|
||||
//mod model;
|
||||
use modelA::ModelA;
|
||||
|
||||
fn main() {
|
||||
let data = b"
|
||||
const DATA: &[u8] = b"
|
||||
I'd just like to interject for a moment. What you're refering to as Linux, is in fact, GNU/Linux, or as I've re
|
||||
aken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free compo
|
||||
a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components com
|
||||
@ -23,6 +16,8 @@ an essential part of an operating system, but useless by itself; it can only fun
|
||||
ating system. Linux is normally used in combination with the GNU operating system: the whole system is basicall
|
||||
th Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!
|
||||
";
|
||||
|
||||
fn main() {
|
||||
type CodeValue = u32;
|
||||
println!(
|
||||
"Using model: ModelA<{}>",
|
||||
@ -34,11 +29,11 @@ th Linux added, or GNU/Linux. All the so-called Linux distributions are really d
|
||||
|
||||
let mut compressed = Vec::new();
|
||||
println!("compressing...");
|
||||
model.compress(&data[..], &mut compressed).unwrap();
|
||||
model.compress(&DATA[..], &mut compressed).unwrap();
|
||||
println!("ModelA compressed to {} bytes", compressed.len());
|
||||
println!(
|
||||
"Compression Ratio: {}",
|
||||
data.len() as f64 / compressed.len() as f64
|
||||
DATA.len() as f64 / compressed.len() as f64
|
||||
);
|
||||
println!("");
|
||||
|
||||
5
src/lib.rs
Normal file
5
src/lib.rs
Normal file
@ -0,0 +1,5 @@
|
||||
// https://marknelson.us/posts/2014/10/19/data-compression-with-arithmetic-coding.html
|
||||
#[allow(non_snake_case)]
|
||||
pub mod modelA;
|
||||
|
||||
mod bit_buffer;
|
||||
Loading…
x
Reference in New Issue
Block a user