Struct io_extras::borrowed::BorrowedReadable
source · [−]#[repr(transparent)]pub struct BorrowedReadable<'a> { /* private fields */ }
Expand description
An owning I/O handle that implements Read
.
This doesn’t implement Into*
or From*
traits.
Platform-specific behavior
On Posix-ish platforms, this reads from the handle as if it were a
[File
]. On Windows, this reads from a file-like handle as if it were a
[File
], and from a socket-like handle as if it were a TcpStream
.
Implementations
sourceimpl<'a> BorrowedReadable<'a>
impl<'a> BorrowedReadable<'a>
sourcepub fn borrow(grip: BorrowedGrip<'a>) -> Self
pub fn borrow(grip: BorrowedGrip<'a>) -> Self
Create a BorrowedReadable
that can read from a BorrowedGrip
.
Trait Implementations
sourceimpl<'a> AsFd for BorrowedReadable<'a>
impl<'a> AsFd for BorrowedReadable<'a>
BorrowedReadable
borrows its handle.
sourcefn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
sourceimpl<'a> Debug for BorrowedReadable<'a>
impl<'a> Debug for BorrowedReadable<'a>
sourceimpl<'a> Read for BorrowedReadable<'a>
impl<'a> Read for BorrowedReadable<'a>
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 more
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
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 more
sourcefn 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 more
sourcefn 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 more
sourcefn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Pull some bytes from this source into the specified buffer. Read more
sourcefn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Read the exact number of bytes required to fill buf
. Read more
1.0.0 · sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read
. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for BorrowedReadable<'a>
impl<'a> Send for BorrowedReadable<'a>
impl<'a> Sync for BorrowedReadable<'a>
impl<'a> Unpin for BorrowedReadable<'a>
impl<'a> UnwindSafe for BorrowedReadable<'a>
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: 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 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> 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) -> 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 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