Skip to main content

PluginWrite

Trait PluginWrite 

Source
pub trait PluginWrite<T>: Send + Sync {
    // Required methods
    fn write(&self, data: &T) -> Result<(), ShellError>;
    fn flush(&self) -> Result<(), ShellError>;

    // Provided method
    fn is_stdout(&self) -> bool { ... }
}
Expand description

Write input/output to the stream.

The write should be atomic, without interference from other threads.

Required Methods§

Source

fn write(&self, data: &T) -> Result<(), ShellError>

Source

fn flush(&self) -> Result<(), ShellError>

Flush any internal buffers, if applicable.

Provided Methods§

Source

fn is_stdout(&self) -> bool

True if this output is stdout, so that plugins can avoid using stdout for their own purpose

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<E, T> PluginWrite<T> for (Stdout, E)
where E: Encoder<T>,

Source§

fn write(&self, data: &T) -> Result<(), ShellError>

Source§

fn flush(&self) -> Result<(), ShellError>

Source§

fn is_stdout(&self) -> bool

Source§

impl<W, E, T> PluginWrite<T> for (Mutex<W>, E)
where W: Write + Send, E: Encoder<T>,

Source§

fn write(&self, data: &T) -> Result<(), ShellError>

Source§

fn flush(&self) -> Result<(), ShellError>

Source§

impl<W, T> PluginWrite<T> for &W
where W: PluginWrite<T>,

Source§

fn write(&self, data: &T) -> Result<(), ShellError>

Source§

fn flush(&self) -> Result<(), ShellError>

Source§

fn is_stdout(&self) -> bool

Implementors§