#[non_exhaustive]#[repr(i8)]pub enum Resolution {
Int8 = 0,
Int16 = 1,
Int32 = 2,
Float = 3,
Ignore = 4,
}Expand description
The resolution (data type) used when encoding or decoding a register value.
Each resolution type determines:
- The number of bytes used on the wire
- The scaling applied to convert between wire format and physical units
- The range of representable values
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Int8 = 0
8-bit signed integer (1 byte)
Int16 = 1
16-bit signed integer (2 bytes)
Int32 = 2
32-bit signed integer (4 bytes)
Float = 3
32-bit IEEE 754 float (4 bytes)
Ignore = 4
This register should be ignored/not transmitted
Implementations§
Source§impl Resolution
impl Resolution
Sourcepub const fn size(self) -> usize
pub const fn size(self) -> usize
Returns the size in bytes for this resolution type.
Returns 0 for Ignore.
Sourcepub const fn type_code(self) -> u8
pub const fn type_code(self) -> u8
Returns the multiplex protocol type code for this resolution.
This is used in the wire protocol to identify the data type.
Sourcepub const fn from_type_code(code: u8) -> Option<Resolution>
pub const fn from_type_code(code: u8) -> Option<Resolution>
Creates a Resolution from a type code.
Returns None if the type code is invalid.
Trait Implementations§
Source§impl Clone for Resolution
impl Clone for Resolution
Source§fn clone(&self) -> Resolution
fn clone(&self) -> Resolution
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 moreimpl Copy for Resolution
Source§impl Debug for Resolution
impl Debug for Resolution
Source§impl Default for Resolution
impl Default for Resolution
Source§fn default() -> Resolution
fn default() -> Resolution
Returns the “default value” for a type. Read more
Source§impl Display for Resolution
impl Display for Resolution
impl Eq for Resolution
Source§impl PartialEq for Resolution
impl PartialEq for Resolution
Source§fn eq(&self, other: &Resolution) -> bool
fn eq(&self, other: &Resolution) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Resolution
Auto Trait Implementations§
impl Freeze for Resolution
impl RefUnwindSafe for Resolution
impl Send for Resolution
impl Sync for Resolution
impl Unpin for Resolution
impl UnsafeUnpin for Resolution
impl UnwindSafe for Resolution
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