pub struct Decompressor { /* private fields */ }Implementations§
Source§impl Decompressor
impl Decompressor
Sourcepub fn new(value: &str) -> Result<Self>
pub fn new(value: &str) -> Result<Self>
Construct a new Decompressor using a a JSON string and default values
Example
let mut compacto = compacto::Decompressor::new(r#"[{"0":1,"1": 0},["a","b"]]"#).unwrap();
println!("{:?}", compacto.decompress().unwrap());Sourcepub fn decompress(&mut self) -> Result<String>
pub fn decompress(&mut self) -> Result<String>
Decompress JSON
decompress will first check if the input is an array and its length is equal to two.
If it does not match the “criteria to decompress,” the original input will be returned.
If the input matches the criteria, we rebuilt the JSON using the reference table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decompressor
impl RefUnwindSafe for Decompressor
impl Send for Decompressor
impl Sync for Decompressor
impl Unpin for Decompressor
impl UnwindSafe for Decompressor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more