Struct stubborn_io::tokio::StubbornIo

source ·
pub struct StubbornIo<T, C> { /* private fields */ }
Expand description

The StubbornIo is a wrapper over a tokio AsyncRead/AsyncWrite item that will automatically invoke the UnderlyingIo::establish upon initialization and when a reconnect is needed. Because it implements deref, you are able to invoke all of the original methods on the wrapped IO.

Implementations§

source§

impl<T, C> StubbornIo<T, C>
where T: UnderlyingIo<C>, C: Clone + Send + Unpin + 'static,

source

pub async fn connect(ctor_arg: C) -> Result<Self>

Connects or creates a handle to the UnderlyingIo item, using the default reconnect options.

source

pub async fn connect_with_options( ctor_arg: C, options: ReconnectOptions ) -> Result<Self>

Trait Implementations§

source§

impl<T, C> AsyncRead for StubbornIo<T, C>
where T: UnderlyingIo<C> + AsyncRead, C: Clone + Send + Unpin + 'static,

source§

fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_> ) -> Poll<Result<()>>

Attempts to read from the AsyncRead into buf. Read more
source§

impl<T, C> AsyncWrite for StubbornIo<T, C>
where T: UnderlyingIo<C> + AsyncWrite, C: Clone + Send + Unpin + 'static,

source§

fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8] ) -> Poll<Result<usize>>

Attempt to write bytes from buf into the object. Read more
source§

fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Attempts to flush the object, ensuring that any buffered data reach their destination. Read more
source§

fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more
source§

fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>] ) -> Poll<Result<usize>>

Like poll_write, except that it writes from a slice of buffers. Read more
source§

fn is_write_vectored(&self) -> bool

Determines if this writer has an efficient poll_write_vectored implementation. Read more
source§

impl<T, C> Deref for StubbornIo<T, C>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T, C> DerefMut for StubbornIo<T, C>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<T, C> Freeze for StubbornIo<T, C>
where T: Freeze, C: Freeze,

§

impl<T, C> !RefUnwindSafe for StubbornIo<T, C>

§

impl<T, C> Send for StubbornIo<T, C>
where T: Send, C: Send,

§

impl<T, C> Sync for StubbornIo<T, C>
where T: Sync, C: Sync,

§

impl<T, C> Unpin for StubbornIo<T, C>
where T: Unpin, C: Unpin,

§

impl<T, C> !UnwindSafe for StubbornIo<T, C>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V