pub struct TrackClosed<T> { /* private fields */ }
Expand description

Async wrapper that tracks whether it has been closed.

See the track_closed methods on:

Implementations§

source§

impl<T> TrackClosed<T>

source

pub fn is_closed(&self) -> bool

Check whether this object has been closed.

source

pub fn get_ref(&self) -> &T

Acquires a reference to the underlying object that this adaptor is wrapping.

source

pub fn get_mut(&mut self) -> &mut T

Acquires a mutable reference to the underlying object that this adaptor is wrapping.

source

pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>

Acquires a pinned mutable reference to the underlying object that this adaptor is wrapping.

source

pub fn into_inner(self) -> T

Consumes this adaptor returning the underlying object.

Trait Implementations§

source§

impl<T: AsyncWrite> AsyncWrite for TrackClosed<T>

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<()>>

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

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

Attempt to close the object. Read more
source§

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

Attempt to write bytes from bufs into the object using vectored IO operations. Read more
source§

impl<T: Debug> Debug for TrackClosed<T>

source§

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

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

impl<Item, T: Sink<Item>> Sink<Item> for TrackClosed<T>

§

type Error = <T as Sink<Item>>::Error

The type of value produced by the sink when an error occurs.
source§

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

Attempts to prepare the Sink to receive a value. Read more
source§

fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
source§

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

Flush any remaining output from this sink. Read more
source§

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

Flush any remaining output and close this sink, if necessary. Read more
source§

impl<'pin, T> Unpin for TrackClosed<T>
where __TrackClosed<'pin, T>: Unpin,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for TrackClosed<T>
where T: RefUnwindSafe,

§

impl<T> Send for TrackClosed<T>
where T: Send,

§

impl<T> Sync for TrackClosed<T>
where T: Sync,

§

impl<T> UnwindSafe for TrackClosed<T>
where T: UnwindSafe,

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<W> AsyncWriteExt for W
where W: AsyncWrite + ?Sized,

source§

fn flush(&mut self) -> Flush<'_, Self>
where Self: Unpin,

Creates a future which will entirely flush this AsyncWrite. Read more
source§

fn close(&mut self) -> Close<'_, Self>
where Self: Unpin,

Creates a future which will entirely close this AsyncWrite.
source§

fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>
where Self: Unpin,

Creates a future which will write bytes from buf into the object. Read more
source§

fn write_vectored<'a>( &'a mut self, bufs: &'a [IoSlice<'a>] ) -> WriteVectored<'a, Self>
where Self: Unpin,

Creates a future which will write bytes from bufs into the object using vectored IO operations. Read more
source§

fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self>
where Self: Unpin,

Write data into this object. Read more
source§

impl<W> AsyncWriteTestExt for W
where W: AsyncWrite,

source§

fn assert_unmoved_write(self) -> AssertUnmoved<Self>
where Self: Sized,

Asserts that the given is not moved after being polled. Read more
source§

fn interleave_pending_write(self) -> InterleavePending<Self>
where Self: Sized,

Introduces an extra Poll::Pending in between each operation on the writer. Read more
source§

fn limited_write(self, limit: usize) -> Limited<Self>
where Self: Sized,

Limit the number of bytes allowed to be written on each call to poll_write. Read more
source§

fn track_closed(self) -> TrackClosed<Self>
where Self: Sized,

Track whether this stream has been closed and errors if it is used after closing. 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<Item, W> SinkTestExt<Item> for W
where W: Sink<Item>,

source§

fn assert_unmoved_sink(self) -> AssertUnmoved<Self>
where Self: Sized,

Asserts that the given is not moved after being polled. Read more
source§

fn interleave_pending_sink(self) -> InterleavePending<Self>
where Self: Sized,

Introduces an extra Poll::Pending in between each operation on the sink.
source§

fn track_closed(self) -> TrackClosed<Self>
where Self: Sized,

Track whether this sink has been closed and panics if it is used after closing. Read more
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.