pub struct Packer { /* private fields */ }
Expand description
Packer used to pack/compress json-like structures.
Implementations§
Source§impl Packer
impl Packer
pub fn new() -> Packer
Sourcepub fn pack<T>(
&mut self,
object: &T,
options: &PackOptions,
) -> Result<Value, PackerError>where
T: Serialize,
pub fn pack<T>(
&mut self,
object: &T,
options: &PackOptions,
) -> Result<Value, PackerError>where
T: Serialize,
Pack an JSON-like object.
Sourcepub fn pack_string(
&mut self,
string_to_pack: &str,
options: &PackOptions,
) -> Result<Value, PackerError>
pub fn pack_string( &mut self, string_to_pack: &str, options: &PackOptions, ) -> Result<Value, PackerError>
Pack a string. Efficiently packs multi-line strings and JSON strings. When unpacked, a string is always returned again.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the memoization dictionary, allowing consumption by new Unpacker instances.
Sourcepub fn set_max_dict_size(&mut self, value: u64)
pub fn set_max_dict_size(&mut self, value: u64)
Set the maximum dictionary size. Must match the dictionary size used by the unpacker. Default - 2000
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Packer
impl RefUnwindSafe for Packer
impl Send for Packer
impl Sync for Packer
impl Unpin for Packer
impl UnwindSafe for Packer
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