[−][src]Struct io_streams::StreamReader
An unbuffered and unlocked input byte stream, abstracted over the source of the input.
It primarily consists of a single file handle, and also contains any resources needed to safely hold the file handle live.
Since it is unbuffered, and since many input sources have high per-call
overhead, it is often beneficial to wrap this in a BufReader
.
Implementations
impl StreamReader
[src]
pub fn stdin() -> Result<Self>
[src]
Read from standard input.
Unlike std::io::stdin
, this stdin
returns a stream which is
unbuffered and unlocked.
This acquires a std::io::StdinLock
to prevent accesses to
std::io::Stdin
while this is live, and fails if a StreamReader
or
StreamDuplexer
for standard input already exists.
#[must_use]pub fn file<Filelike: IntoUnsafeFile + Read + Write + Seek>(
filelike: Filelike
) -> Self
[src]
filelike: Filelike
) -> Self
Read from an open file, taking ownership of it.
This method can be passed a std::fs::File
or similar File
types.
#[must_use]pub fn tcp_stream<Socketlike: IntoUnsafeSocket>(socketlike: Socketlike) -> Self
[src]
Read from an open TCP stream, taking ownership of it.
This method can be passed a std::net::TcpStream
or similar
TcpStream
types.
#[must_use]pub fn unix_stream(unix_stream: UnixStream) -> Self
[src]
Read from an open Unix-domain socket, taking ownership of it.
#[must_use]pub fn pipe_reader(pipe_reader: PipeReader) -> Self
[src]
Read from the reading end of an open pipe, taking ownership of it.
pub fn read_from_command(mut command: Command) -> Result<Self>
[src]
Spawn the given command and read from its standard output.
#[must_use]pub fn child_stdout(child_stdout: ChildStdout) -> Self
[src]
Read from a child process' standard output, taking ownership of it.
#[must_use]pub fn child_stderr(child_stderr: ChildStderr) -> Self
[src]
Read from a child process' standard error, taking ownership of it.
pub fn piped_thread(mut boxed_read: Box<dyn Read + Send>) -> Result<Self>
[src]
Read from a boxed Read
implementation, taking ownership of it. This
works by creating a new thread to read the data and write it through a
pipe.
pub fn str<S: AsRef<str>>(s: S) -> Result<Self>
[src]
Read from the given string.
pub fn bytes(bytes: &[u8]) -> Result<Self>
[src]
Read from the given bytes.
Trait Implementations
impl AsRawFd for StreamReader
[src]
impl Debug for StreamReader
[src]
impl Peek for StreamReader
[src]
impl Read for StreamReader
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
[src]
fn is_read_vectored(&self) -> bool
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
[src]
pub unsafe fn initializer(&self) -> Initializer
[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
pub fn bytes(self) -> Bytes<Self>
1.0.0[src]
pub fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
pub fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl ReadReady for StreamReader
[src]
fn num_ready_bytes(&self) -> Result<u64>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for StreamReader
[src]
impl Send for StreamReader
[src]
impl Sync for StreamReader
[src]
impl Unpin for StreamReader
[src]
impl !UnwindSafe for StreamReader
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsUnsafeFile for T where
T: AsRawFd,
[src]
T: AsRawFd,
pub fn as_unsafe_file(&self) -> UnsafeFile
[src]
pub fn as_file_view(&self) -> View<'_, File>
[src]
pub unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]
pub fn as_pipe_reader_view(&self) -> View<'_, PipeReader>
[src]
pub unsafe fn as_unscoped_pipe_reader_view(&self) -> View<'static, PipeReader>
[src]
pub fn as_pipe_writer_view(&self) -> View<'_, PipeWriter>
[src]
pub unsafe fn as_unscoped_pipe_writer_view(&self) -> View<'static, PipeWriter>
[src]
impl<T> AsUnsafeHandle for T where
T: AsRawFd,
[src]
T: AsRawFd,
pub fn as_unsafe_handle(&self) -> UnsafeHandle
[src]
impl<T> AsUnsafeSocket for T where
T: AsRawFd,
[src]
T: AsRawFd,
pub fn as_unsafe_socket(&self) -> UnsafeSocket
[src]
pub fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]
pub unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]
pub fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]
pub unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]
pub fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]
pub unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]
pub fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]
pub unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> FileIoExt for T where
T: AsRawFd,
[src]
T: AsRawFd,
pub fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<(), Error>
[src]
pub fn allocate(&self, offset: u64, len: u64) -> Result<(), Error>
[src]
pub fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
[src]
pub fn read_exact(&self, buf: &mut [u8]) -> Result<(), Error>
[src]
pub fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize, Error>
[src]
pub fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<(), Error>
[src]
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
[src]
pub fn read_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<usize, Error>
[src]
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<usize, Error>
pub fn is_read_vectored_at(&self) -> bool
[src]
pub fn read_to_end(&self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
[src]
pub fn read_to_end_at(
&self,
buf: &mut Vec<u8, Global>,
offset: u64
) -> Result<usize, Error>
[src]
&self,
buf: &mut Vec<u8, Global>,
offset: u64
) -> Result<usize, Error>
pub fn read_to_string(&self, buf: &mut String) -> Result<usize, Error>
[src]
pub fn read_to_string_at(
&self,
buf: &mut String,
offset: u64
) -> Result<usize, Error>
[src]
&self,
buf: &mut String,
offset: u64
) -> Result<usize, Error>
pub fn peek(&self, buf: &mut [u8]) -> Result<usize, Error>
[src]
pub fn write(&self, buf: &[u8]) -> Result<usize, Error>
[src]
pub fn write_all(&self, buf: &[u8]) -> Result<(), Error>
[src]
pub fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize, Error>
[src]
pub fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error>
[src]
pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
[src]
pub fn write_vectored_at(
&self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<usize, Error>
[src]
&self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<usize, Error>
pub fn is_write_vectored_at(&self) -> bool
[src]
pub fn flush(&self) -> Result<(), Error>
[src]
pub fn write_fmt(&self, fmt: Arguments<'_>) -> Result<(), Error>
[src]
pub fn seek(&self, pos: SeekFrom) -> Result<u64, Error>
[src]
pub fn stream_position(&self) -> Result<u64, Error>
[src]
pub fn read_exact_vectored(
&self,
bufs: &mut [IoSliceMut<'_>]
) -> Result<(), Error>
[src]
&self,
bufs: &mut [IoSliceMut<'_>]
) -> Result<(), Error>
pub fn read_exact_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<(), Error>
[src]
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<(), Error>
pub fn write_all_vectored(&self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
[src]
pub fn write_all_vectored_at(
&self,
bufs: &mut [IoSlice<'_>],
offset: u64
) -> Result<(), Error>
[src]
&self,
bufs: &mut [IoSlice<'_>],
offset: u64
) -> Result<(), Error>
impl<T> From<T> for T
[src]
impl<T> GetSetFdFlags for T where
T: AsUnsafeFile,
[src]
T: AsUnsafeFile,
pub fn get_fd_flags(&self) -> Result<FdFlags, Error>
[src]
pub fn set_fd_flags(&mut self, fd_flags: FdFlags) -> Result<(), Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsReadWrite for T where
T: AsRawFd,
[src]
T: AsRawFd,
impl<T> IsTerminal for T where
T: AsRawFd,
[src]
T: AsRawFd,
pub fn is_terminal(&self) -> bool
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,