pub struct Params {
inner: BTreeMap<Param, String>,
}
Expand description
An object for handling key=value parameter lists.
The structure is serialized by calling to_string()
on it.
Only for library-internal use.
Fields§
§inner: BTreeMap<Param, String>
Implementations§
Source§impl Params
impl Params
Sourcepub fn get(&self, key: Param) -> Option<&str>
pub fn get(&self, key: Param) -> Option<&str>
Get the value of the given key, return None
if no value is set.
Sourcepub fn set(&mut self, key: Param, value: impl ToString) -> &mut Self
pub fn set(&mut self, key: Param, value: impl ToString) -> &mut Self
Set the given key to the passed in value.
Sourcepub fn set_optional(
&mut self,
key: Param,
value: Option<impl ToString>,
) -> &mut Self
pub fn set_optional( &mut self, key: Param, value: Option<impl ToString>, ) -> &mut Self
Sets the given key from an optional value.
Removes the key if the value is None
.
Sourcepub fn get_cmd(&self) -> SystemMessage
pub fn get_cmd(&self) -> SystemMessage
Get the parameter behind Param::Cmd
interpreted as SystemMessage
.
Sourcepub fn set_cmd(&mut self, value: SystemMessage)
pub fn set_cmd(&mut self, value: SystemMessage)
Set the parameter behind Param::Cmd
.
Sourcepub fn get_file_blob<'a>(
&self,
context: &'a Context,
) -> Result<Option<BlobObject<'a>>>
pub fn get_file_blob<'a>( &self, context: &'a Context, ) -> Result<Option<BlobObject<'a>>>
Returns a BlobObject for the Param::File parameter.
Sourcepub fn get_file_path(&self, context: &Context) -> Result<Option<PathBuf>>
pub fn get_file_path(&self, context: &Context) -> Result<Option<PathBuf>>
Returns a PathBuf for the Param::File parameter.
Sourcepub fn set_int(&mut self, key: Param, value: i32) -> &mut Self
pub fn set_int(&mut self, key: Param, value: i32) -> &mut Self
Set the given parameter to the passed in i32
.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Params
impl<'de> Deserialize<'de> for Params
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromStr for Params
impl FromStr for Params
impl Eq for Params
impl StructuralPartialEq for Params
Auto Trait Implementations§
impl Freeze for Params
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.