pub enum MechObjectDictionaryValue {
Single(MechCommandRegisterValue),
SubIndices(Vec<MechCommandRegisterValue>),
}Expand description
Defines the value storage for an entry in the CANopen Object Dictionary.
MechObjectDictionaryValue can store a single MechCommandRegisterValue
or a vector of MechCommandRegisterValues, representing an array or record
structure with multiple sub-indices. This enum allows flexibility in how
values are stored within the Object Dictionary:
Single: Used for entries that have a single value (e.g., device-specific parameters).SubIndices: Used for entries that contain multiple values, typically whenobject_typeisRecordorArray.
§Example Usage
use mechutil::object_dictionary::{MechObjectDictionaryValue};
use mechutil::register_value::MechCommandRegisterValue;
// Single value example
let single_value = MechObjectDictionaryValue::Single(MechCommandRegisterValue::from_int32(42));
// Array of values example
let array_value = MechObjectDictionaryValue::SubIndices(vec![
MechCommandRegisterValue::from_uint32(0),
MechCommandRegisterValue::from_uint32(1),
MechCommandRegisterValue::from_uint32(2),
]);Variants§
Single(MechCommandRegisterValue)
SubIndices(Vec<MechCommandRegisterValue>)
Trait Implementations§
Source§impl Clone for MechObjectDictionaryValue
impl Clone for MechObjectDictionaryValue
Source§fn clone(&self) -> MechObjectDictionaryValue
fn clone(&self) -> MechObjectDictionaryValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MechObjectDictionaryValue
impl Debug for MechObjectDictionaryValue
Source§impl<'de> Deserialize<'de> for MechObjectDictionaryValue
impl<'de> Deserialize<'de> for MechObjectDictionaryValue
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
Auto Trait Implementations§
impl Freeze for MechObjectDictionaryValue
impl RefUnwindSafe for MechObjectDictionaryValue
impl Send for MechObjectDictionaryValue
impl Sync for MechObjectDictionaryValue
impl Unpin for MechObjectDictionaryValue
impl UnsafeUnpin for MechObjectDictionaryValue
impl UnwindSafe for MechObjectDictionaryValue
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