pub struct Tether<I, T, R> { /* private fields */ }Expand description
A wrapper type which contains the underlying I/O object, it’s initializer, and resolver.
This in the main type exposed by the library. It implements AsyncRead
and AsyncWrite whenever the underlying I/O object implements them.
Calling things like read_buf will result in the I/O automatically reconnecting
if an error is detected during the underlying I/O call.
§Note
Currently, there is no way to obtain a reference into the underlying I/O object. And the only
way to reclaim the inner I/O type is by calling Tether::into_inner. This is by design, since
in the future there may be reason to add unsafe code which cannot be guaranteed if outside
callers can obtain references. In the future I may add these as unsafe functions if those cases
can be described.
Implementations§
source§impl<I, T, R> Tether<I, T, R>
impl<I, T, R> Tether<I, T, R>
sourcepub fn new(inner: T, initializer: I, resolver: R) -> Self
pub fn new(inner: T, initializer: I, resolver: R) -> Self
Construct a tether object from an existing I/O source
sourcepub fn get_resolver(&self) -> &R
pub fn get_resolver(&self) -> &R
Returns a reference to the resolver
sourcepub fn get_resolver_mut(&mut self) -> &mut R
pub fn get_resolver_mut(&mut self) -> &mut R
Returns a mutable reference to the resolver
sourcepub fn get_initializer(&self) -> &I
pub fn get_initializer(&self) -> &I
Returns a reference to the initializer
sourcepub fn get_initializer_mut(&mut self) -> &mut I
pub fn get_initializer_mut(&mut self) -> &mut I
Returns a mutable reference to the initializer
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the Tether, and return the underlying I/O type
sourcepub fn get_context(&self) -> &Context
pub fn get_context(&self) -> &Context
Returns a reference to the context
sourcepub fn get_context_mut(&mut self) -> &mut Context
pub fn get_context_mut(&mut self) -> &mut Context
Returns a mutable reference to the context
Trait Implementations§
source§impl<I, T, R> AsyncWrite for Tether<I, T, R>
impl<I, T, R> AsyncWrite for Tether<I, T, R>
source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize, Error>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Error>>
buf into the object. Read moresource§fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>
fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Error>>
source§fn poll_shutdown(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>
fn poll_shutdown( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Error>>
source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moresource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read more