jsonm::packer

Struct Packer

Source
pub struct Packer { /* private fields */ }
Expand description

Packer used to pack/compress json-like structures.

Implementations§

Source§

impl Packer

Source

pub fn new() -> Packer

Source

pub fn pack<T>( &mut self, object: &T, options: &PackOptions, ) -> Result<Value, PackerError>
where T: Serialize,

Pack an JSON-like object.

Source

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.

Source

pub fn reset(&mut self)

Reset the memoization dictionary, allowing consumption by new Unpacker instances.

Source

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§

Source§

impl Debug for Packer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Packer

Source§

fn default() -> Packer

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.