| Crates.io | devker |
| lib.rs | devker |
| version | 0.1.6 |
| created_at | 2020-08-09 22:11:30.562727+00 |
| updated_at | 2020-08-23 15:50:51.996292+00 |
| description | Rust Core Project |
| homepage | |
| repository | https://github.com/TimeEngineer/DevKER |
| max_upload_size | |
| id | 274821 |
| size | 40,447 |
use devker::prelude::{deflate, inflate, BlockType, Cache};
let mut cache = Cache::new();
let v = String::from("Hello world, this is a wonderful world !");
let v_in = v.into_bytes();
// Encode.
let encoded = deflate(&v_in, BlockType::Fixed, &mut cache);
// Decode.
let decoded = inflate(&encoded, &mut cache).unwrap();
assert_eq!(v_in, decoded);
use devker::prelude::{deflate, inflate, BlockType, Cache};
let mut cache = Cache::new();
// First try.
let v = String::from("Hello world, this is a wonderful world !");
let v_in = v.into_bytes();
let encoded = deflate(&v_in, BlockType::Fixed, &mut cache);
let decoded = inflate(&encoded, &mut cache).unwrap();
assert_eq!(v_in, decoded);
// Another try.
let v = String::from("The cache can be reused !");
let v_in = v.into_bytes();
let encoded = deflate(&v_in, BlockType::Fixed, &mut cache);
let decoded = inflate(&encoded, &mut cache).unwrap();
assert_eq!(v_in, decoded);
For the moment, this crate is inspired by libflate.
Add following lines to your Cargo.toml:
[dependencies]
devker = "0"
In the future, this crate gathers most of the algorithms that I use for my projects.
The goal is to have performance and no dependency, in order to fully control the source code.