Trait bdrck::cli::AbstractStream

source ·
pub trait AbstractStream {
    type Attributes: AbstractTerminalAttributes + Debug;

    // Required methods
    fn isatty(&self) -> bool;
    fn get_attributes(&self) -> IoResult<Self::Attributes>;
    fn set_attributes(&mut self, attributes: &Self::Attributes) -> IoResult<()>;
    fn as_reader(&self) -> Option<Box<dyn Read>>;
    fn as_writer(&self) -> Option<Box<dyn Write>>;
}
Expand description

This trait describes an abstract input or output stream.

This trait primarily exists for testing purposes. In almost all cases, users will instead just use the concrete type Stream defined below.

Required Associated Types§

source

type Attributes: AbstractTerminalAttributes + Debug

A type which describes the attributes of this stream / terminal.

Required Methods§

source

fn isatty(&self) -> bool

Returns whether or not this stream refers to an interactive terminal (a TTY), as opposed to, for example, a pipe.

source

fn get_attributes(&self) -> IoResult<Self::Attributes>

Retrieve the current attributes of this stream / terminal.

source

fn set_attributes(&mut self, attributes: &Self::Attributes) -> IoResult<()>

Modify this stream’s / terminal’s attributes to match the given state.

source

fn as_reader(&self) -> Option<Box<dyn Read>>

Return a Read for this stream, if reading is supported.

source

fn as_writer(&self) -> Option<Box<dyn Write>>

Return a Write for this stream, if writing is supported.

Implementors§