Builder

Struct Builder 

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

Compress/decompress with specific options

Use the builder class to compress and decompress using specific options.

If you’re not sure about the options, either use Builder::default or use the convenience functions Engine::compress and Engine::decompress

Implementations§

Source§

impl Builder

Source

pub fn empty() -> Self

Create a builder with an empty custom list

Source

pub fn set_custom(&mut self, list: Vec<&'static str>) -> &mut Self

Move in a new list of custom words

sss supports the use of 32 custom strings which are encoded as two bytes. This list can be replaced completely with this Builder::set_custom function, or it can be modified with the Builder::push_custom or Builder::clear_custom functions.

Note: The protocol only supports 32 custom strings, so only the first 32 strings will be used in the custom vector. Adding more than 32 is not an error, but these extra strings will not be used.

Source

pub fn set_custom_spaces(&mut self, spaces: bool) -> &mut Self

Determines whether the custom words will automatically support space prefixes.

If true, the maximum number of possible custom strings in the table is halved from 32 to 16.

Source

pub fn push_custom(&mut self, custom: &'static str) -> &mut Self

Appends a single string to the custom list. See the Builder::set_custom for more information on custom strings.

Source

pub fn clear_custom(&mut self) -> &mut Self

Clears the custom list. See the Builder::set_custom for more information on custom strings.

Source

pub fn len_custom(&self) -> usize

Returns the current length of the custom string list

Source

pub fn engine(&self) -> Engine

Converts the builder into an Engine

Trait Implementations§

Source§

impl Default for Builder

Source§

fn default() -> Self

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

Auto Trait Implementations§

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.