Struct terminal_io::TerminalReader
source · pub struct TerminalReader<Inner: Read> { /* private fields */ }
Expand description
A wrapper around a Read
which adds minimal terminal support.
Implementations
sourceimpl<Inner: Read + AsGrip> TerminalReader<Inner>
impl<Inner: Read + AsGrip> TerminalReader<Inner>
sourcepub fn with_handle(inner: Inner) -> Self
pub fn with_handle(inner: Inner) -> Self
Wrap a TerminalReader
around the given stream, autodetecting
terminal properties using its AsGrip
implementation.
sourceimpl<Inner: Read> TerminalReader<Inner>
impl<Inner: Read> TerminalReader<Inner>
sourcepub fn generic(inner: Inner) -> Self
pub fn generic(inner: Inner) -> Self
Wrap a TerminalReader
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: Read + AsFd> AsFd for TerminalReader<Inner>
impl<Inner: Read + AsFd> AsFd for TerminalReader<Inner>
sourcefn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
sourceimpl<Inner: Read + AsRawFd> AsRawFd for TerminalReader<Inner>
impl<Inner: Read + AsRawFd> AsRawFd for TerminalReader<Inner>
sourceimpl<Inner: Debug + Read> Debug for TerminalReader<Inner>
impl<Inner: Debug + Read> Debug for TerminalReader<Inner>
sourceimpl<Inner: Read> Read for TerminalReader<Inner>
impl<Inner: Read> Read for TerminalReader<Inner>
sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
sourcefn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
Like
read
, except that it reads into a slice of buffers. Read moresourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)sourcefn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into
buf
. Read moresourcefn read_to_string(&mut self, buf: &mut String) -> Result<usize>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to
buf
. Read moresourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill
buf
. Read moresourcefn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Pull some bytes from this source into the specified buffer. Read more
sourcefn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Read the exact number of bytes required to fill
cursor
. Read more1.0.0 · sourcefn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read moresourceimpl<Inner: Read> ReadTerminal for TerminalReader<Inner>
impl<Inner: Read> ReadTerminal for TerminalReader<Inner>
sourcefn is_line_by_line(&self) -> bool
fn is_line_by_line(&self) -> bool
Test whether the input is being sent a line at a time.
sourcefn is_input_terminal(&self) -> bool
fn is_input_terminal(&self) -> bool
Test whether the input is connected to a terminal. Read more
impl<Inner: Read> Terminal for TerminalReader<Inner>
Auto Trait Implementations
impl<Inner> RefUnwindSafe for TerminalReader<Inner>where
Inner: RefUnwindSafe,
impl<Inner> Send for TerminalReader<Inner>where
Inner: Send,
impl<Inner> Sync for TerminalReader<Inner>where
Inner: Sync,
impl<Inner> Unpin for TerminalReader<Inner>where
Inner: Unpin,
impl<Inner> UnwindSafe for TerminalReader<Inner>where
Inner: UnwindSafe,
Blanket Implementations
sourceimpl<T> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere
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: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
Return a borrowing view of a resource which dereferences to a
&Target
. Read moresourceimpl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere
T: AsRawFd,
sourcefn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
Returns the raw value.
sourceimpl<T> AsRawGrip for Twhere
T: AsRawFd,
impl<T> AsRawGrip for Twhere
T: AsRawFd,
sourcefn as_raw_grip(&self) -> i32
fn as_raw_grip(&self) -> i32
Extracts the raw grip.
sourceimpl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
sourcefn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
Returns the raw value.
sourceimpl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere
T: AsFd,
sourcefn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
Borrows the reference.
sourcefn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
Return a borrowing view of a resource which dereferences to a
&Target
. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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