Skip to main content

Module async_line_writer

Module async_line_writer 

Source
Expand description

Async line writer using a Tokio-based actor pattern.

The actor owns a background task that performs file I/O via spawn_blocking. The handle (AsyncLineWriter) sends messages through a bounded mpsc channel, so the caller never blocks on I/O. When the handle is dropped, the channel closes and the background task finishes its current write before exiting.

This follows the “Actors with Tokio” pattern:

  • Handle (AsyncLineWriter) is separate from the actor task.
  • Handle is Clone (via mpsc::Sender).
  • Graceful shutdown when all senders are dropped.
  • Bounded channel for backpressure.

Structs§

AsyncLineWriter
Asynchronous line writer that buffers writes on a background Tokio task.
AsyncLineWriterDiagnostics
Snapshot of best-effort exporter writer health.