[][src]Struct tokio_modbus::client::util::SharedContext

pub struct SharedContext { /* fields omitted */ }

Reconnectable environment with a shared context.

Methods

impl SharedContext[src]

pub fn new(
    inital_context: Option<Context>,
    new_context: Box<dyn NewContext>
) -> Self
[src]

Create a new instance with an optional, initial context and a trait object for reconnecting the shared context on demand.

pub fn is_connected(&self) -> bool[src]

Checks if a shared context is available.

pub fn share_context(&self) -> Option<Rc<RefCell<Context>>>[src]

Try to obtain a shared context reference. The result is None if no context is available, i.e. if the shared context is not connected.

The result should only be used temporarily for the next asynchronous request and must not be reused later!

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T