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

Asynchronous Modbus client context

Implementations§

source§

impl Context

source

pub async fn disconnect(&mut self) -> Result<(), Error>

Disconnect the client

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, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Invoke a Modbus function
source§

impl Debug for Context

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Box<dyn Client, Global>> 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>, Error>> + 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>, Error>> + 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>, Error>> + 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>, Error>> + 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>, Error>> + 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<(), Error>> + 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<(), Error>> + 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, data: u16 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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<(), Error>> + 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, address: Address, and_mask: u16, or_mask: u16 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more