pub struct AsyncCountingOutput<O> { /* private fields */ }Expand description
Asynchronous output that counts successfully accepted items.
§Type Parameters
O: Wrapped asynchronous output type.
Implementations§
Source§impl<O> AsyncCountingOutput<O>
impl<O> AsyncCountingOutput<O>
Sourcepub const fn items_written(&self) -> u64
pub const fn items_written(&self) -> u64
Sourcepub fn inner_mut(&mut self) -> &mut O
pub fn inner_mut(&mut self) -> &mut O
Returns a mutable reference to the wrapped output.
Writes performed directly on the returned output are not included in this wrapper’s item count.
§Returns
Returns the wrapped asynchronous output.
Sourcepub fn into_inner(self) -> O
pub fn into_inner(self) -> O
Source§impl<O> AsyncCountingOutput<O>where
O: AsyncOutput<Item = u8>,
impl<O> AsyncCountingOutput<O>where
O: AsyncOutput<Item = u8>,
Sourcepub const fn bytes_written(&self) -> u64
pub const fn bytes_written(&self) -> u64
Returns the successfully accepted byte count.
§Returns
Returns the same value as Self::items_written.
Trait Implementations§
Source§impl<O> AsyncClose for AsyncCountingOutput<O>where
O: AsyncClose,
impl<O> AsyncClose for AsyncCountingOutput<O>where
O: AsyncClose,
Source§fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Polls closing through the wrapped output.
§Parameters
cx: Task context used to register a wake-up.
§Returns
Returns Poll::Pending while closing is incomplete, otherwise a
ready success result.
§Errors
Returns an error reported by the wrapped output. Invalid asynchronous
error kinds are normalized to io::ErrorKind::InvalidData.
Source§fn close_async(&mut self) -> CloseFuture<'_, Self> ⓘ
fn close_async(&mut self) -> CloseFuture<'_, Self> ⓘ
Source§impl<O> AsyncOutput for AsyncCountingOutput<O>where
O: AsyncOutput,
impl<O> AsyncOutput for AsyncCountingOutput<O>where
O: AsyncOutput,
Source§type Item = <O as AsyncOutput>::Item
type Item = <O as AsyncOutput>::Item
Item type counted after successful writes.
Source§fn is_buffered(&self) -> bool
fn is_buffered(&self) -> bool
Preserves the wrapped output’s buffering declaration.
§Returns
Returns the wrapped output’s buffering declaration.
Source§unsafe fn poll_write_unchecked(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
input: &[Self::Item],
index: usize,
count: usize,
) -> Poll<Result<usize>>
unsafe fn poll_write_unchecked( self: Pin<&mut Self>, cx: &mut Context<'_>, input: &[Self::Item], index: usize, count: usize, ) -> Poll<Result<usize>>
Polls a write and counts only a successful ready result.
§Parameters
cx: Task context used to register a wake-up.input: Source item slice.index: Starting source index.count: Maximum number of items to write.
§Returns
Returns Poll::Pending when the output is not ready. A ready success
contains the number of items accepted and added to the saturating count.
§Errors
Returns an I/O error reported by the wrapped output without changing the count.
§Safety
The range index..index + count must be valid for input.
Source§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Polls the wrapped output’s flush operation.
§Parameters
cx: Task context used to register a wake-up.
§Returns
Returns Poll::Pending while flushing is incomplete, otherwise a
ready success result.
§Errors
Returns an error reported by the wrapped output. Invalid asynchronous
error kinds are normalized to io::ErrorKind::InvalidData.