Skip to main content

Transport

Trait Transport 

Source
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§

Source

async fn read_holding( &mut self, offset: u16, out: &mut [u16], ) -> Result<(), Self::Error>

Source

async fn read_input( &mut self, offset: u16, out: &mut [u16], ) -> Result<(), Self::Error>

Source

async fn read_coils( &mut self, offset: u16, out: &mut [bool], ) -> Result<(), Self::Error>

Source

async fn read_discrete( &mut self, offset: u16, out: &mut [bool], ) -> Result<(), Self::Error>

Source

async fn write_holding( &mut self, offset: u16, regs: &[u16], ) -> Result<(), Self::Error>

Source

async fn write_coil(&mut self, offset: u16, on: bool) -> Result<(), Self::Error>

Provided Methods§

Source

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".

Implementors§