Trait bdrck::cli::AbstractStream
source · [−]pub trait AbstractStream {
type Attributes: AbstractTerminalAttributes + Debug;
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.
Associated Types
A type which describes the attributes of this stream / terminal.
Required methods
Returns whether or not this stream refers to an interactive terminal (a TTY), as opposed to, for example, a pipe.
fn get_attributes(&self) -> IoResult<Self::Attributes>
fn get_attributes(&self) -> IoResult<Self::Attributes>
Retrieve the current attributes of this stream / terminal.
fn set_attributes(&mut self, attributes: &Self::Attributes) -> IoResult<()>
fn set_attributes(&mut self, attributes: &Self::Attributes) -> IoResult<()>
Modify this stream’s / terminal’s attributes to match the given state.
Return a Read
for this stream, if reading is supported.