Struct unsafe_io::UnsafeHandle [−][src]
#[repr(transparent)]pub struct UnsafeHandle(_);
Expand description
A non-owning unsafe I/O handle.
On Posix-ish platforms this is just a RawFd
. On Windows it is a minimal
abstraction over RawHandle
, RawSocket
, and stdio device
identifiers. Similar to Rust raw pointers, it is considered safe to
construct these, but unsafe to do any I/O with them (effectively
dereferencing them).
Implementations
pub const unsafe fn as_readable(self) -> UnsafeReadableⓘNotable traits for UnsafeReadableimpl Read for UnsafeReadable
pub const unsafe fn as_readable(self) -> UnsafeReadableⓘNotable traits for UnsafeReadableimpl Read for UnsafeReadable
impl Read for UnsafeReadable
Obtain self
with a type that implements Read
.
Safety
The resulting UnsafeReadable
value must not outlive the underlying
resource.
Also, callers should avoid mixing uses of UnsafeReadable
with the
type’s Read
or Write
implementations if the type uses buffering, as
for example async_std::fs::File
does.
pub const unsafe fn as_writeable(self) -> UnsafeWriteableⓘNotable traits for UnsafeWriteableimpl Write for UnsafeWriteable
pub const unsafe fn as_writeable(self) -> UnsafeWriteableⓘNotable traits for UnsafeWriteableimpl Write for UnsafeWriteable
impl Write for UnsafeWriteable
Obtain self
with a type that implements Write
.
Safety
The resulting UnsafeWriteable
value must not outlive the underlying
resource.
Also, callers should avoid mixing uses of UnsafeWriteable
with the
type’s Read
or Write
implementation if the type uses buffering, as
for example async_std::fs::File
does.
UnsafeHandle
doesn’t implement Eq
or PartialEq
because comparison
is undefined for dangling handles.
Safety
Both self
and other
must outlive their underlying resources.
Like FromRawHandle::from_raw_handle
, but isn’t unsafe because it
doesn’t imply a dereference.
Like FromRawSocket::from_raw_socket
, but isn’t unsafe because it
doesn’t imply a dereference.
pub const fn unowned_from_raw_handle_or_socket(
raw_handle_or_socket: RawHandleOrSocket
) -> Self
pub const fn unowned_from_raw_handle_or_socket(
raw_handle_or_socket: RawHandleOrSocket
) -> Self
Like FromRawHandle::from_raw_handle
and
FromRawSocket::from_raw_socket
combined, but isn’t unsafe because
it doesn’t imply a dereference.
Trait Implementations
UnsafeHandle
doesn’t own its handle; see the comments for
impl AsRawFd for UnsafeHandle
.
Like AsRawHandle::as_raw_handle
and AsRawSocket::as_raw_socket
but can return either type. Read more
UnsafeHandle
doesn’t own its handle; see the comments for
impl AsRawFd for UnsafeHandle
.
Like FromRawHandle::from_raw_handle
and
FromRawSocket::from_raw_socket
but can be passed either type. Read more
UnsafeHandle
doesn’t own its handle; see the comments for
impl AsRawFd for UnsafeHandle
.
Constructs a new instance of Self
from the given unsafe handle. Read more
UnsafeHandle
doesn’t own its handle; see the comments for
impl AsRawFd for UnsafeHandle
.
Like IntoRawHandle::into_raw_handle
and
IntoRawSocket::into_raw_socket
but can return either type. Read more
Auto Trait Implementations
impl RefUnwindSafe for UnsafeHandle
impl Send for UnsafeHandle
impl Sync for UnsafeHandle
impl Unpin for UnsafeHandle
impl UnwindSafe for UnsafeHandle
Blanket Implementations
Mutably borrows from an owned value. Read more