pub enum NodeId {
Unconfigured,
Configured(ConfiguredNodeId),
}Expand description
An enum representing the node ID of a CANopen node. The node ID must be between 1 and 127 for configured devices, with the special value of 255 used to represent an unconfigured device.
Variants§
Unconfigured
A special node ID indicating the node is not configured (255)
Configured(ConfiguredNodeId)
A valid node ID for a configured node
Implementations§
Source§impl NodeId
impl NodeId
Sourcepub const fn new(value: u8) -> Result<Self, InvalidNodeIdError>
pub const fn new(value: u8) -> Result<Self, InvalidNodeIdError>
Try to create a new NodeId from a u8
Will fail if the value is not a valid node ID
Sourcepub fn as_configured(&self) -> Option<ConfiguredNodeId>
pub fn as_configured(&self) -> Option<ConfiguredNodeId>
Attempt to get the node ID as a ConfiguredNodeId
Returns none if the value is NodeId::Unconfigured
Sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
Return true if the NodeId contains a valid configured ID
Sourcepub fn is_unconfigured(&self) -> bool
pub fn is_unconfigured(&self) -> bool
Return true if the node ID is NodeId::Unconfigured
Trait Implementations§
impl Copy for NodeId
impl Eq for NodeId
impl StructuralPartialEq for NodeId
Auto Trait Implementations§
impl Freeze for NodeId
impl RefUnwindSafe for NodeId
impl Send for NodeId
impl Sync for NodeId
impl Unpin for NodeId
impl UnwindSafe for NodeId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more