pub struct ModbusDecoder;Expand description
Stateless decoder for Modbus register arrays.
All methods are pure functions – no mutable state is held. Create one instance and reuse it freely.
Implementations§
Source§impl ModbusDecoder
impl ModbusDecoder
Sourcepub fn decode(
regs: &[u16],
data_type: DecoderDataType,
byte_order: ByteOrder,
) -> ModbusResult<ModbusTypedValue>
pub fn decode( regs: &[u16], data_type: DecoderDataType, byte_order: ByteOrder, ) -> ModbusResult<ModbusTypedValue>
Decode a slice of raw u16 Modbus registers into a typed value.
§Arguments
regs- Slice starting at the register of interest. Must contain at leastdata_type.register_count()elements.data_type- How to interpret the raw register data.byte_order- Word and byte ordering used by the target device.
§Errors
Returns ModbusError when the slice is too short or the decoded
floating-point value is non-finite (NaN / infinity).
Auto Trait Implementations§
impl Freeze for ModbusDecoder
impl RefUnwindSafe for ModbusDecoder
impl Send for ModbusDecoder
impl Sync for ModbusDecoder
impl Unpin for ModbusDecoder
impl UnsafeUnpin for ModbusDecoder
impl UnwindSafe for ModbusDecoder
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> 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 more