Skip to main content

Resolution

Enum Resolution 

Source
#[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

Source

pub const fn size(self) -> usize

Returns the size in bytes for this resolution type.

Returns 0 for Ignore.

Source

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.

Source

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.

Source

pub const fn nan_value(self) -> i32

Returns the minimum representable value for integer types.

This value is used to represent NaN in the protocol.

Source

pub const fn max_value(self) -> i32

Returns the maximum representable value for integer types.

Trait Implementations§

Source§

impl Clone for Resolution

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Copy for Resolution

Source§

impl Debug for Resolution

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Resolution

Source§

fn default() -> Resolution

Returns the “default value” for a type. Read more
Source§

impl Display for Resolution

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Resolution

Source§

impl PartialEq for Resolution

Source§

fn eq(&self, other: &Resolution) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Resolution

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.