Context

Struct Context 

Source
pub struct Context { /* private fields */ }
Expand description

Asynchronous Modbus client context

Trait Implementations§

Source§

impl Client for Context

Source§

fn call<'life0, 'life1, 'async_trait>( &'life0 mut self, request: Request<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Invokes a Modbus function.
Source§

fn disconnect<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Disconnects the client. Read more
Source§

impl From<Box<dyn Client>> for Context

Source§

fn from(client: Box<dyn Client>) -> Self

Converts to this type from the input type.
Source§

impl From<Context> for Box<dyn Client>

Source§

fn from(val: Context) -> Self

Converts to this type from the input type.
Source§

impl Reader for Context

Source§

fn read_coils<'a, 'async_trait>( &'a mut self, addr: Address, cnt: Quantity, ) -> Pin<Box<dyn Future<Output = Result<Vec<bool>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Read multiple coils (0x01)
Source§

fn read_discrete_inputs<'a, 'async_trait>( &'a mut self, addr: Address, cnt: Quantity, ) -> Pin<Box<dyn Future<Output = Result<Vec<bool>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Read multiple discrete inputs (0x02)
Source§

fn read_input_registers<'a, 'async_trait>( &'a mut self, addr: Address, cnt: Quantity, ) -> Pin<Box<dyn Future<Output = Result<Vec<u16>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Read multiple input registers (0x04)
Source§

fn read_holding_registers<'a, 'async_trait>( &'a mut self, addr: Address, cnt: Quantity, ) -> Pin<Box<dyn Future<Output = Result<Vec<u16>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Read multiple holding registers (0x03)
Source§

fn read_write_multiple_registers<'a, 'life0, 'async_trait>( &'a mut self, read_addr: Address, read_count: Quantity, write_addr: Address, write_data: &'life0 [u16], ) -> Pin<Box<dyn Future<Output = Result<Vec<u16>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Read and write multiple holding registers (0x17) Read more
Source§

impl SlaveContext for Context

Source§

fn set_slave(&mut self, slave: Slave)

Select a slave device for all subsequent outgoing requests.
Source§

impl Writer for Context

Source§

fn write_single_coil<'a, 'async_trait>( &'a mut self, addr: Address, coil: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Write a single coil (0x05)
Source§

fn write_multiple_coils<'a, 'life0, 'async_trait>( &'a mut self, addr: Address, coils: &'life0 [bool], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Write multiple coils (0x0F)
Source§

fn write_single_register<'a, 'async_trait>( &'a mut self, addr: Address, word: u16, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Write a single holding register (0x06)
Source§

fn write_multiple_registers<'a, 'life0, 'async_trait>( &'a mut self, addr: Address, data: &'life0 [u16], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Write multiple holding registers (0x10)
Source§

fn masked_write_register<'a, 'async_trait>( &'a mut self, addr: Address, and_mask: u16, or_mask: u16, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Set or clear individual bits of a holding register (0x16)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.