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]
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
Auto Trait Implementations
impl<T> !RefUnwindSafe for BufSink<T>
impl<T> !RefUnwindSafe for BufSink<T>
impl<T> !UnwindSafe for BufSink<T>
impl<T> !UnwindSafe for BufSink<T>