multiio 0.2.3

A unified I/O orchestration library for CLI/server applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::fmt::Debug;

use async_trait::async_trait;
use tokio::io::AsyncWrite;

#[async_trait]
pub trait AsyncOutputTarget: Send + Sync + Debug {
    /// Returns a unique identifier for this output target.
    fn id(&self) -> &str;

    /// Open the target for writing, truncating any existing content.
    async fn open_overwrite(&self) -> std::io::Result<Box<dyn AsyncWrite + Unpin + Send>>;

    /// Open the target for appending to existing content.
    async fn open_append(&self) -> std::io::Result<Box<dyn AsyncWrite + Unpin + Send>>;
}