pub struct ParamSet { /* private fields */ }
Expand description

Represents parameter set for Compression The ParamSet can be obtained from String and &str ParamSet string expression is “key1=value1;key2=value2;key3=value3” format Internally it is a HashMap<String,, String>

Typical paramset used “level=3” (set compression level). See each compression algorithm for supported parameters

You can use “” as ParamSet and it won’t contain any actual parameter

Implementations§

source§

impl ParamSet

source

pub fn get_string<'a, 'b>( &'a self, key: &'b str, default_value: &'b str ) -> &'b strwhere 'a: 'b,

Read parameter identified by key as &str. If not set, use the default_value.

source

pub fn get_bool(&self, key: &str, default_value: bool) -> bool

Read parameter identified by key as bool. If not set, use the default_value.

only true (case insensitive) is considered as true. Other values are false.

source

pub fn get_parse<T: FromStr>(&self, key: &str, default_value: T) -> T

Read parameter identified by key as T (where T:FromStr). If not set, use default_value.

Typical FromStr includes all numbers (i32, usize, etc), or IpAddress, or any other supported type that implements FromStr trait.

Trait Implementations§

source§

impl From<&str> for ParamSet

source§

fn from(what: &str) -> Self

Converts to this type from the input type.
source§

impl From<String> for ParamSet

Load ParamSet from String

source§

fn from(what: String) -> Self

what must be “key=value;key1=value1” format. Empty tokens (e.g. “key=value;;;”) are skipped. If you need to specify values that may contain special characters (e.g. include; or =), you can use ‘%%:’ to prefix your value, and the value should be url encoded. For example format of `key=%%:%3B%3B%3B;key2=%%:%3B%3B%3B“ => key = “;;;”, key2 = “;;;”

What if your key should be “%%:123”?

No worries, “%%:123” => “%%:%25%25%3A123”

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.