rclrs

Struct Parameters

Source
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<'_>

Source

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.

Source

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> 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.