pub struct CoilPoints { /* private fields */ }Expand description
A local cache of coil values mapped to their Modbus addresses.
Use apply_read to merge values returned by
ModbusClient::read_coils.
Implementations§
Source§impl CoilPoints
impl CoilPoints
Sourcepub fn new(start_address: u16, count: usize) -> Self
pub fn new(start_address: u16, count: usize) -> Self
Create a new coil cache with count coils starting at start_address, all initially false.
Sourcepub fn from_values(start_address: u16, values: Vec<bool>) -> Self
pub fn from_values(start_address: u16, values: Vec<bool>) -> Self
Create a coil cache from existing values.
Sourcepub fn start_address(&self) -> u16
pub fn start_address(&self) -> u16
The starting Modbus address of this cache.
Sourcepub fn get(&self, address: u16) -> Option<bool>
pub fn get(&self, address: u16) -> Option<bool>
Get the coil value at the given Modbus address, or None if out of range.
Sourcepub fn set(&mut self, address: u16, value: bool) -> Result<(), ClientError>
pub fn set(&mut self, address: u16, value: bool) -> Result<(), ClientError>
Set the coil value at the given Modbus address.
Sourcepub fn apply_read(
&mut self,
start_address: u16,
values: &[bool],
) -> Result<(), ClientError>
pub fn apply_read( &mut self, start_address: u16, values: &[bool], ) -> Result<(), ClientError>
Merge a batch of read values into this cache at the given start address.
Trait Implementations§
Source§impl Clone for CoilPoints
impl Clone for CoilPoints
Source§fn clone(&self) -> CoilPoints
fn clone(&self) -> CoilPoints
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 CoilPoints
impl Debug for CoilPoints
Source§impl PartialEq for CoilPoints
impl PartialEq for CoilPoints
impl Eq for CoilPoints
impl StructuralPartialEq for CoilPoints
Auto Trait Implementations§
impl Freeze for CoilPoints
impl RefUnwindSafe for CoilPoints
impl Send for CoilPoints
impl Sync for CoilPoints
impl Unpin for CoilPoints
impl UnsafeUnpin for CoilPoints
impl UnwindSafe for CoilPoints
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