pub trait Transport {
type Error;
// Required methods
async fn read_holding(
&mut self,
offset: u16,
out: &mut [u16],
) -> Result<(), Self::Error>;
async fn read_input(
&mut self,
offset: u16,
out: &mut [u16],
) -> Result<(), Self::Error>;
async fn read_coils(
&mut self,
offset: u16,
out: &mut [bool],
) -> Result<(), Self::Error>;
async fn read_discrete(
&mut self,
offset: u16,
out: &mut [bool],
) -> Result<(), Self::Error>;
async fn write_holding(
&mut self,
offset: u16,
regs: &[u16],
) -> Result<(), Self::Error>;
async fn write_coil(
&mut self,
offset: u16,
on: bool,
) -> Result<(), Self::Error>;
// Provided method
fn max_read_words(&self) -> u16 { ... }
}Expand description
Async register-level transport. offset is the zero-based data-model
offset within the given address space (spec §7.2); implementations apply
any unit/base-address mapping.
Required Associated Types§
Required Methods§
async fn read_holding( &mut self, offset: u16, out: &mut [u16], ) -> Result<(), Self::Error>
async fn read_input( &mut self, offset: u16, out: &mut [u16], ) -> Result<(), Self::Error>
async fn read_coils( &mut self, offset: u16, out: &mut [bool], ) -> Result<(), Self::Error>
async fn read_discrete( &mut self, offset: u16, out: &mut [bool], ) -> Result<(), Self::Error>
async fn write_holding( &mut self, offset: u16, regs: &[u16], ) -> Result<(), Self::Error>
async fn write_coil(&mut self, offset: u16, on: bool) -> Result<(), Self::Error>
Provided Methods§
Sourcefn max_read_words(&self) -> u16
fn max_read_words(&self) -> u16
Largest register window one read may request (Modbus caps at 125; devices sometimes less). The facade chunks larger spans.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.