Skip to main content

ParameterValue

Enum ParameterValue 

Source
pub enum ParameterValue {
    NotSet,
    Bool(bool),
    Integer(i64),
    Double(f64),
    String(String<MAX_STRING_VALUE_LEN>),
    ByteArray(Vec<u8, MAX_BYTE_ARRAY_LEN>),
    BoolArray(Vec<bool, MAX_ARRAY_LEN>),
    IntegerArray(Vec<i64, MAX_ARRAY_LEN>),
    DoubleArray(Vec<f64, MAX_ARRAY_LEN>),
    StringArray(Vec<String<MAX_STRING_VALUE_LEN>, MAX_ARRAY_LEN>),
}
Expand description

Parameter value container

Holds a parameter value of any supported type. Note: This enum is intentionally large to support all parameter types without heap allocation in embedded systems.

Variants§

§

NotSet

Value not set

§

Bool(bool)

Boolean value

§

Integer(i64)

64-bit signed integer value

§

Double(f64)

64-bit floating point value

§

String(String<MAX_STRING_VALUE_LEN>)

String value

§

ByteArray(Vec<u8, MAX_BYTE_ARRAY_LEN>)

Byte array value

§

BoolArray(Vec<bool, MAX_ARRAY_LEN>)

Boolean array value

§

IntegerArray(Vec<i64, MAX_ARRAY_LEN>)

Integer array value

§

DoubleArray(Vec<f64, MAX_ARRAY_LEN>)

Double array value

§

StringArray(Vec<String<MAX_STRING_VALUE_LEN>, MAX_ARRAY_LEN>)

String array value (array of fixed-size strings)

Implementations§

Source§

impl ParameterValue

Source

pub fn param_type(&self) -> ParameterType

Get the parameter type for this value

Source

pub fn is_set(&self) -> bool

Check if the value is set

Source

pub fn as_bool(&self) -> Option<bool>

Try to get the value as a bool

Source

pub fn as_integer(&self) -> Option<i64>

Try to get the value as an integer

Source

pub fn as_double(&self) -> Option<f64>

Try to get the value as a double

Source

pub fn as_string(&self) -> Option<&str>

Try to get the value as a string slice

Source

pub fn as_byte_array(&self) -> Option<&[u8]>

Try to get the value as a byte array slice

Source

pub fn as_bool_array(&self) -> Option<&[bool]>

Try to get the value as a bool array slice

Source

pub fn as_integer_array(&self) -> Option<&[i64]>

Try to get the value as an integer array slice

Source

pub fn as_double_array(&self) -> Option<&[f64]>

Try to get the value as a double array slice

Source

pub fn from_bool(value: bool) -> Self

Create a bool value

Source

pub fn from_integer(value: i64) -> Self

Create an integer value

Source

pub fn from_double(value: f64) -> Self

Create a double value

Source

pub fn from_string(value: &str) -> Option<Self>

Create a string value from a str slice

Trait Implementations§

Source§

impl Clone for ParameterValue

Source§

fn clone(&self) -> ParameterValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParameterValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ParameterValue

Source§

fn default() -> ParameterValue

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.