Struct terminal_io::TerminalWriter
source · [−]pub struct TerminalWriter<Inner: Write> { /* private fields */ }
Expand description
A wrapper around a Write
which adds minimal terminal support.
Implementations
sourceimpl<Inner: Write + AsGrip> TerminalWriter<Inner>
impl<Inner: Write + AsGrip> TerminalWriter<Inner>
sourcepub fn with_handle(inner: Inner) -> Self
pub fn with_handle(inner: Inner) -> Self
Wrap a TerminalWriter
around the given stream, autodetecting
terminal properties using its AsGrip
implementation.
sourcepub fn from(
inner: Inner,
is_terminal: bool,
color_support: TerminalColorSupport,
color_preference: bool
) -> Self
pub fn from(
inner: Inner,
is_terminal: bool,
color_support: TerminalColorSupport,
color_preference: bool
) -> Self
Wrap a TerminalWriter
around the given stream, using the given
terminal properties.
sourceimpl<Inner: Write> TerminalWriter<Inner>
impl<Inner: Write> TerminalWriter<Inner>
sourcepub fn generic(inner: Inner) -> Self
pub fn generic(inner: Inner) -> Self
Wrap a TerminalWriter
around the given stream, using
conservative terminal properties.
sourcepub fn into_inner(self) -> Inner
pub fn into_inner(self) -> Inner
Consume self
and return the inner stream.
Trait Implementations
sourceimpl<Inner: Write + AsFd> AsFd for TerminalWriter<Inner>
impl<Inner: Write + AsFd> AsFd for TerminalWriter<Inner>
sourcefn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
sourceimpl<Inner: Write + AsRawFd> AsRawFd for TerminalWriter<Inner>
impl<Inner: Write + AsRawFd> AsRawFd for TerminalWriter<Inner>
sourceimpl<Inner: Debug + Write> Debug for TerminalWriter<Inner>
impl<Inner: Debug + Write> Debug for TerminalWriter<Inner>
sourceimpl<Inner: Write> Write for TerminalWriter<Inner>
impl<Inner: Write> Write for TerminalWriter<Inner>
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
sourcefn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. Read more
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
sourceimpl<Inner: Write> WriteTerminal for TerminalWriter<Inner>
impl<Inner: Write> WriteTerminal for TerminalWriter<Inner>
sourcefn color_support(&self) -> TerminalColorSupport
fn color_support(&self) -> TerminalColorSupport
Test whether this output stream supports color control codes.
sourcefn color_preference(&self) -> bool
fn color_preference(&self) -> bool
Test whether the user has indicated a preference for color output by
default. Respects the NO_COLOR
environment variable where applicable. Read more
sourcefn is_output_terminal(&self) -> bool
fn is_output_terminal(&self) -> bool
Test whether the output is connected to a terminal. Read more
sourcefn color_default(&self) -> bool
fn color_default(&self) -> bool
Test whether color should be used on this terminal by default. This includes both whether color is supported and whether the user has not indicated a preference otherwise. Read more
impl<Inner: Write> Terminal for TerminalWriter<Inner>
Auto Trait Implementations
impl<Inner> RefUnwindSafe for TerminalWriter<Inner> where
Inner: RefUnwindSafe,
impl<Inner> Send for TerminalWriter<Inner> where
Inner: Send,
impl<Inner> Sync for TerminalWriter<Inner> where
Inner: Sync,
impl<Inner> Unpin for TerminalWriter<Inner> where
Inner: Unpin,
impl<Inner> UnwindSafe for TerminalWriter<Inner> where
Inner: UnwindSafe,
Blanket Implementations
sourceimpl<T> AsFilelike for T where
T: AsFd,
impl<T> AsFilelike for T where
T: AsFd,
sourcefn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
Borrows the reference. Read more
sourcefn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target> where
Target: FromFilelike + IntoFilelike,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target> where
Target: FromFilelike + IntoFilelike,
Return a borrowing view of a resource which dereferences to a &Target
or &mut Target
. Read more
sourceimpl<T> AsGrip for T where
T: AsFd,
impl<T> AsGrip for T where
T: AsFd,
sourcefn as_grip(&self) -> BorrowedFd<'_>
fn as_grip(&self) -> BorrowedFd<'_>
Extracts the grip.
sourceimpl<T> AsRawFilelike for T where
T: AsRawFd,
impl<T> AsRawFilelike for T where
T: AsRawFd,
sourcefn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
Returns the raw value.
sourceimpl<T> AsRawGrip for T where
T: AsRawFd,
impl<T> AsRawGrip for T where
T: AsRawFd,
sourcefn as_raw_grip(&self) -> i32
fn as_raw_grip(&self) -> i32
Extracts the raw grip.
sourceimpl<T> AsRawSocketlike for T where
T: AsRawFd,
impl<T> AsRawSocketlike for T where
T: AsRawFd,
sourcefn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
Returns the raw value.
sourceimpl<T> AsSocketlike for T where
T: AsFd,
impl<T> AsSocketlike for T where
T: AsFd,
sourcefn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
Borrows the reference.
sourcefn as_socketlike_view<Target>(&self) -> FilelikeView<'_, Target> where
Target: FromSocketlike + IntoSocketlike,
fn as_socketlike_view<Target>(&self) -> FilelikeView<'_, Target> where
Target: FromSocketlike + IntoSocketlike,
Return a borrowing view of a resource which dereferences to a &Target
or &mut Target
. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more