Struct tokio_modbus::client::sync::Context

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

A synchronous Modbus client context.

Implementations§

source§

impl Context

source

pub const fn timeout(&self) -> Option<Duration>

Returns the current timeout.

source

pub fn set_timeout(&mut self, duration: impl Into<Option<Duration>>)

Sets a timeout duration for all subsequent operations.

The timeout is disabled by passing None.

source

pub fn reset_timeout(&mut self)

Disables the timeout for all subsequent operations.

Trait Implementations§

source§

impl Client for Context

source§

fn call(&mut self, req: Request<'_>) -> Result<Response>

source§

impl Debug for Context

source§

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

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

impl Reader for Context

source§

fn read_coils(&mut self, addr: Address, cnt: Quantity) -> Result<Vec<bool>>

source§

fn read_discrete_inputs( &mut self, addr: Address, cnt: Quantity, ) -> Result<Vec<bool>>

source§

fn read_input_registers( &mut self, addr: Address, cnt: Quantity, ) -> Result<Vec<u16>>

source§

fn read_holding_registers( &mut self, addr: Address, cnt: Quantity, ) -> Result<Vec<u16>>

source§

fn read_write_multiple_registers( &mut self, read_addr: Address, read_count: Quantity, write_addr: Address, write_data: &[u16], ) -> Result<Vec<u16>>

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_register(&mut self, addr: Address, data: u16) -> Result<()>

source§

fn write_multiple_registers( &mut self, addr: Address, data: &[u16], ) -> Result<()>

source§

fn write_single_coil(&mut self, addr: Address, data: bool) -> Result<()>

source§

fn write_multiple_coils(&mut self, addr: Address, data: &[bool]) -> Result<()>

Auto Trait Implementations§

§

impl !Freeze for Context

§

impl !RefUnwindSafe for Context

§

impl Send for Context

§

impl !Sync for Context

§

impl Unpin for Context

§

impl !UnwindSafe for Context

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>,

§

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>,

§

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.