Skip to main content

CliIo

Trait CliIo 

Source
pub trait CliIo: Sync {
    // Required methods
    fn read_text(&self, source: &str) -> Result<String, String>;
    fn write_stdout(&mut self, text: &str);
    fn write_stderr(&mut self, text: &str);
    fn version(&self) -> &str;
}
Expand description

Everything the command touches outside its arguments.

Required Methods§

Source

fn read_text(&self, source: &str) -> Result<String, String>

The text an argument names: a file, standard input for -, or a URL.

§Errors

Why the source cannot be read; the command names the argument.

Source

fn write_stdout(&mut self, text: &str)

Writes to standard output.

Source

fn write_stderr(&mut self, text: &str)

Writes to standard error.

Source

fn version(&self) -> &str

The version to report.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl CliIo for StandardStreams

Available on crate feature read only.