pub struct RawReadable(/* private fields */);
Expand description
A non-owning unsafe I/O handle that implements Read
. Read
functions
are considered safe, so this type requires unsafe
to construct.
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
.
Trait Implementations§
Source§impl AsRawHandleOrSocket for RawReadable
impl AsRawHandleOrSocket for RawReadable
RawReadable
doesn’t own its handle.
Source§fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket
fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket
Like
AsRawHandle::as_raw_handle
and AsRawSocket::as_raw_socket
but can return either type.Source§impl Clone for RawReadable
impl Clone for RawReadable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RawReadable
impl Debug for RawReadable
Source§impl FromRawHandle for RawReadable
impl FromRawHandle for RawReadable
RawReadable
doesn’t own its handle.
Source§unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self
unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self
Constructs a new I/O object from the specified raw handle. Read more
Source§impl FromRawHandleOrSocket for RawReadable
impl FromRawHandleOrSocket for RawReadable
RawReadable
doesn’t own its handle.
Source§unsafe fn from_raw_handle_or_socket(
raw_handle_or_socket: RawHandleOrSocket,
) -> Self
unsafe fn from_raw_handle_or_socket( raw_handle_or_socket: RawHandleOrSocket, ) -> Self
Like
FromRawHandle::from_raw_handle
and
FromRawSocket::from_raw_socket
but can be passed either type. Read moreSource§impl IntoRawHandleOrSocket for RawReadable
impl IntoRawHandleOrSocket for RawReadable
RawReadable
doesn’t own its handle.
Source§fn into_raw_handle_or_socket(self) -> RawHandleOrSocket
fn into_raw_handle_or_socket(self) -> RawHandleOrSocket
Like
IntoRawHandle::into_raw_handle
and
IntoRawSocket::into_raw_socket
but can return either type.Source§impl Read for RawReadable
impl Read for RawReadable
Source§fn 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
Source§fn 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 moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Reads all bytes until EOF in this source, placing them into
buf
. Read moreSource§fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
Reads all bytes until EOF in this source, appending them to
buf
. Read moreSource§fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Reads the exact number of bytes required to fill
buf
. Read moreSource§fn 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
Source§fn 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
)Reads the exact number of bytes required to fill
cursor
. Read more1.0.0 · Source§fn 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 moreimpl Copy for RawReadable
Auto Trait Implementations§
impl Freeze for RawReadable
impl RefUnwindSafe for RawReadable
impl Send for RawReadable
impl Sync for RawReadable
impl Unpin for RawReadable
impl UnwindSafe for RawReadable
Blanket Implementations§
Source§impl<T> AsRawGrip for Twhere
T: AsRawHandleOrSocket,
impl<T> AsRawGrip for Twhere
T: AsRawHandleOrSocket,
Source§fn as_raw_grip(&self) -> RawHandleOrSocket
fn as_raw_grip(&self) -> RawHandleOrSocket
Extracts the raw grip.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> FromRawFilelike for Twhere
T: FromRawHandle,
impl<T> FromRawFilelike for Twhere
T: FromRawHandle,
Source§unsafe fn from_raw_filelike(raw: *mut c_void) -> T
unsafe fn from_raw_filelike(raw: *mut c_void) -> T
Constructs
Self
from the raw value.Source§impl<T> FromRawGrip for Twhere
T: FromRawHandleOrSocket,
impl<T> FromRawGrip for Twhere
T: FromRawHandleOrSocket,
Source§unsafe fn from_raw_grip(raw_grip: RawHandleOrSocket) -> T
unsafe fn from_raw_grip(raw_grip: RawHandleOrSocket) -> T
Source§impl<T> IntoRawGrip for Twhere
T: IntoRawHandleOrSocket,
impl<T> IntoRawGrip for Twhere
T: IntoRawHandleOrSocket,
Source§fn into_raw_grip(self) -> RawHandleOrSocket
fn into_raw_grip(self) -> RawHandleOrSocket
Consume
self
and convert into an RawGrip
.