Struct carboncopy_tokio::BufSink[][src]

pub struct BufSink<T: AsyncWriteExt + Unpin + Send + 'static> { /* fields omitted */ }

A sink with memory buffer and periodic flusher built with Tokio facilities so it is suitable for binaries relying on the Tokio executor. It can also be used by async-blind library clients since the Sink trait offers blocking API.

Its interior is guarded by Arc<Mutex<...>>.

Implementations

impl<T: AsyncWriteExt + Unpin + Send + 'static> BufSink<T>[src]

pub fn new(opts: SinkOptions<T>) -> Self[src]

At the same time as the instantiation, a flusher task is spawned in the background whose job is to flush after the buffer overflows or a set timeout has elapsed (whichever happens first), repeatedly in a forever loop until the instance is dropped.

pub async fn flush(&self) -> Result<usize>[src]

Attempts to manually flush the underlying buffer to Stdout.

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

Checks if buffer flushing is being backlogged (not necessarily by errors).

Trait Implementations

impl<T: AsyncWriteExt + Unpin + Send + 'static> Drop for BufSink<T>[src]

impl<T: AsyncWriteExt + Unpin + Send + 'static> Sink for BufSink<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for BufSink<T>

impl<T> Send for BufSink<T>

impl<T> Sync for BufSink<T>

impl<T> Unpin for BufSink<T>

impl<T> !UnwindSafe for BufSink<T>

Blanket Implementations

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

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

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

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.