pub struct Parameters<'a> { /* private fields */ }
Expand description
Allows access to all parameters via get / set functions, using their name as a key.
Implementations§
Source§impl Parameters<'_>
impl Parameters<'_>
Sourcepub fn get<T: ParameterVariant>(&self, name: &str) -> Option<T>
pub fn get<T: ParameterVariant>(&self, name: &str) -> Option<T>
Tries to read a parameter of the requested type.
Returns Some(T)
if a parameter of the requested type exists, None
otherwise.
Sourcepub fn set<T: ParameterVariant>(
&self,
name: impl Into<Arc<str>>,
value: T,
) -> Result<(), ParameterValueError>
pub fn set<T: ParameterVariant>( &self, name: impl Into<Arc<str>>, value: T, ) -> Result<(), ParameterValueError>
Tries to set a parameter with the requested value.
Returns:
Ok(())
if setting was successful.- [
Err(DeclarationError::TypeMismatch)
] if the type of the requested value is different from the parameter’s type. - [
Err(DeclarationError::OutOfRange)
] if the requested value is out of the parameter’s range. - [
Err(DeclarationError::ReadOnly)
] if the parameter is read only.
Auto Trait Implementations§
impl<'a> Freeze for Parameters<'a>
impl<'a> RefUnwindSafe for Parameters<'a>
impl<'a> Send for Parameters<'a>
impl<'a> Sync for Parameters<'a>
impl<'a> Unpin for Parameters<'a>
impl<'a> UnwindSafe for Parameters<'a>
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