#[non_exhaustive]pub enum DataType {
Show 14 variants
Boolean = 1,
Integer8 = 2,
Integer16 = 3,
Integer32 = 4,
Unsigned8 = 5,
Unsigned16 = 6,
Unsigned32 = 7,
Real32 = 8,
Real64 = 17,
Integer64 = 21,
Unsigned64 = 27,
VisibleString = 9,
OctetString = 10,
Domain = 15,
}Expand description
A CANopen basic data type.
The discriminant is the CiA 301 data type index (the object index under
which the type is described, e.g. UNSIGNED32 is 0x0007).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Boolean = 1
BOOLEAN (0x0001), 1 byte.
Integer8 = 2
INTEGER8 (0x0002), 1 byte.
Integer16 = 3
INTEGER16 (0x0003), 2 bytes.
Integer32 = 4
INTEGER32 (0x0004), 4 bytes.
Unsigned8 = 5
UNSIGNED8 (0x0005), 1 byte.
Unsigned16 = 6
UNSIGNED16 (0x0006), 2 bytes.
Unsigned32 = 7
UNSIGNED32 (0x0007), 4 bytes.
Real32 = 8
REAL32 (0x0008), 4 bytes.
Real64 = 17
REAL64 (0x0011), 8 bytes.
Integer64 = 21
INTEGER64 (0x0015), 8 bytes.
Unsigned64 = 27
UNSIGNED64 (0x001B), 8 bytes.
VisibleString = 9
VISIBLE_STRING (0x0009), variable length (ASCII/UTF-8 text).
OctetString = 10
OCTET_STRING (0x000A), variable length (arbitrary bytes).
Domain = 15
DOMAIN (0x000F), variable length (arbitrary bytes).
Implementations§
Source§impl DataType
impl DataType
Sourcepub const fn from_index(index: u16) -> Option<Self>
pub const fn from_index(index: u16) -> Option<Self>
The basic data type for a CiA 301 data type index, or None for an
index this crate does not model.
Sourcepub const fn fixed_size(self) -> Option<usize>
pub const fn fixed_size(self) -> Option<usize>
The fixed encoded size of a value of this type in bytes, or None for a
variable-length type (VISIBLE_STRING, OCTET_STRING, DOMAIN).
Sourcepub const fn is_variable(self) -> bool
pub const fn is_variable(self) -> bool
Whether this is a variable-length type.
Sourcepub const fn size(self) -> usize
pub const fn size(self) -> usize
The fixed encoded size of a value of this type in bytes, or 0 for a
variable-length type (whose size depends on the value — see
fixed_size).