pub enum ParameterValue {
NotSet,
Bool(bool),
Integer(i64),
Double(f64),
String(String<nros_params::::types::ParameterValue::{constant#0}>),
ByteArray(Vec<u8, nros_params::::types::ParameterValue::{constant#1}>),
BoolArray(Vec<bool, nros_params::::types::ParameterValue::{constant#2}>),
IntegerArray(Vec<i64, nros_params::::types::ParameterValue::{constant#3}>),
DoubleArray(Vec<f64, nros_params::::types::ParameterValue::{constant#4}>),
StringArray(Vec<String<nros_params::::types::ParameterValue::{constant#5}>, nros_params::::types::ParameterValue::{constant#6}>),
}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<nros_params::::types::ParameterValue::{constant#0}>)
String value
ByteArray(Vec<u8, nros_params::::types::ParameterValue::{constant#1}>)
Byte array value
BoolArray(Vec<bool, nros_params::::types::ParameterValue::{constant#2}>)
Boolean array value
IntegerArray(Vec<i64, nros_params::::types::ParameterValue::{constant#3}>)
Integer array value
DoubleArray(Vec<f64, nros_params::::types::ParameterValue::{constant#4}>)
Double array value
StringArray(Vec<String<nros_params::::types::ParameterValue::{constant#5}>, nros_params::::types::ParameterValue::{constant#6}>)
String array value (array of fixed-size strings)
Implementations§
Source§impl ParameterValue
impl ParameterValue
Sourcepub fn param_type(&self) -> ParameterType
pub fn param_type(&self) -> ParameterType
Get the parameter type for this value
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Try to get the value as an integer
Sourcepub fn as_byte_array(&self) -> Option<&[u8]>
pub fn as_byte_array(&self) -> Option<&[u8]>
Try to get the value as a byte array slice
Sourcepub fn as_bool_array(&self) -> Option<&[bool]>
pub fn as_bool_array(&self) -> Option<&[bool]>
Try to get the value as a bool array slice
Sourcepub fn as_integer_array(&self) -> Option<&[i64]>
pub fn as_integer_array(&self) -> Option<&[i64]>
Try to get the value as an integer array slice
Sourcepub fn as_double_array(&self) -> Option<&[f64]>
pub fn as_double_array(&self) -> Option<&[f64]>
Try to get the value as a double array slice
Sourcepub fn from_bool(value: bool) -> ParameterValue
pub fn from_bool(value: bool) -> ParameterValue
Create a bool value
Sourcepub fn from_integer(value: i64) -> ParameterValue
pub fn from_integer(value: i64) -> ParameterValue
Create an integer value
Sourcepub fn from_double(value: f64) -> ParameterValue
pub fn from_double(value: f64) -> ParameterValue
Create a double value
Sourcepub fn from_string(value: &str) -> Option<ParameterValue>
pub fn from_string(value: &str) -> Option<ParameterValue>
Create a string value from a str slice
Sourcepub fn from_bool_array(values: &[bool]) -> Option<ParameterValue>
pub fn from_bool_array(values: &[bool]) -> Option<ParameterValue>
Create a bool-array value from a slice.
phase-426 W4 — None when the slice is longer than MAX_ARRAY_LEN,
the same fallible shape from_string has for the
same reason: the value lives in a heapless::Vec inside the server’s
fixed slot and there is no allocator to grow it.
These three exist so a caller outside nros-params can build an array
value without naming heapless or the capacity constant. The C++ FFI
shim is such a caller: nros_cpp_node_declare_param_*_array forwards
nros::ComponentNode’s std::vector<T> facade into the executor’s
store, and the capacity belongs where the storage is.
Sourcepub fn from_integer_array(values: &[i64]) -> Option<ParameterValue>
pub fn from_integer_array(values: &[i64]) -> Option<ParameterValue>
Create an integer-array value from a slice. See
from_bool_array.
Sourcepub fn from_double_array(values: &[f64]) -> Option<ParameterValue>
pub fn from_double_array(values: &[f64]) -> Option<ParameterValue>
Create a double-array value from a slice. See
from_bool_array.
Trait Implementations§
Source§impl Clone for ParameterValue
impl Clone for ParameterValue
Source§fn clone(&self) -> ParameterValue
fn clone(&self) -> ParameterValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more