OutputTarget

Trait OutputTarget 

Source
pub trait OutputTarget:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id(&self) -> &str;
    fn open_overwrite(&self) -> Result<Box<dyn Write + Send>>;
    fn open_append(&self) -> Result<Box<dyn Write + Send>>;
}
Expand description

Trait for synchronous output targets.

Implementors provide a way to open a writable stream to various destinations such as files, stdout/stderr, or in-memory buffers.

Required Methods§

Source

fn id(&self) -> &str

Returns a unique identifier for this output target.

This is used for error messages and logging. Convention: “-” for stdout, file path for files.

Source

fn open_overwrite(&self) -> Result<Box<dyn Write + Send>>

Open the target for writing, truncating any existing content.

Source

fn open_append(&self) -> Result<Box<dyn Write + Send>>

Open the target for appending to existing content.

Implementors§