pub struct RegisterCount(/* private fields */);Expand description
How many 16-bit registers a read asks for.
Function codes 3 and 4 answer with a byte count in a single byte, so 125 registers is the protocol’s own ceiling and not a limit chosen here.
Implementations§
Source§impl RegisterCount
impl RegisterCount
Sourcepub const fn new(count: u16) -> Result<Self, ModbusError>
pub const fn new(count: u16) -> Result<Self, ModbusError>
A register count this protocol can answer.
§Errors
Returns ModbusError::EmptyRead for 0 and
ModbusError::TooManyRegisters above MAX_REGISTERS.
Sourcepub const fn byte_count(self) -> u16
pub const fn byte_count(self) -> u16
How many bytes a device owes in answer to this many registers.
Trait Implementations§
Source§impl Clone for RegisterCount
impl Clone for RegisterCount
impl Copy for RegisterCount
Source§impl Debug for RegisterCount
impl Debug for RegisterCount
impl Eq for RegisterCount
Source§impl Hash for RegisterCount
impl Hash for RegisterCount
Source§impl Ord for RegisterCount
impl Ord for RegisterCount
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for RegisterCount
impl PartialEq for RegisterCount
Source§impl PartialOrd for RegisterCount
impl PartialOrd for RegisterCount
impl StructuralPartialEq for RegisterCount
Auto Trait Implementations§
impl Forget for RegisterCount
impl Freeze for RegisterCount
impl Move for RegisterCount
impl RefUnwindSafe for RegisterCount
impl Send for RegisterCount
impl Sync for RegisterCount
impl Unpin for RegisterCount
impl UnsafeUnpin for RegisterCount
impl UnwindSafe for RegisterCount
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