pub enum ModbusTypedValue {
Bool(bool),
I16(i16),
U16(u16),
I32(i32),
U32(u32),
F32(f32),
F64(f64),
Str(String),
}Expand description
Strongly-typed value decoded from a Modbus register array.
This is a richer type than crate::mapping::ModbusValue; it preserves
the exact Rust primitive and supports lossless f64 conversion for
arithmetic / scaling.
Variants§
Bool(bool)
Boolean decoded from a coil or discrete input
I16(i16)
Signed 16-bit integer (single register)
U16(u16)
Unsigned 16-bit integer (single register)
I32(i32)
Signed 32-bit integer (two registers)
U32(u32)
Unsigned 32-bit integer (two registers)
F32(f32)
IEEE-754 single-precision float (two registers)
F64(f64)
IEEE-754 double-precision float (four registers)
Str(String)
ASCII string decoded from N register pairs
Implementations§
Source§impl ModbusTypedValue
impl ModbusTypedValue
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Convert to f64 for scaling and range checks.
Returns None for string values which cannot be meaningfully converted.
Trait Implementations§
Source§impl Clone for ModbusTypedValue
impl Clone for ModbusTypedValue
Source§fn clone(&self) -> ModbusTypedValue
fn clone(&self) -> ModbusTypedValue
Returns a duplicate of the value. Read more
1.0.0 · 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 ModbusTypedValue
impl Debug for ModbusTypedValue
Source§impl Display for ModbusTypedValue
impl Display for ModbusTypedValue
Source§impl PartialEq for ModbusTypedValue
impl PartialEq for ModbusTypedValue
impl StructuralPartialEq for ModbusTypedValue
Auto Trait Implementations§
impl Freeze for ModbusTypedValue
impl RefUnwindSafe for ModbusTypedValue
impl Send for ModbusTypedValue
impl Sync for ModbusTypedValue
impl Unpin for ModbusTypedValue
impl UnsafeUnpin for ModbusTypedValue
impl UnwindSafe for ModbusTypedValue
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.