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 FromRawFd::from_raw_fd
, but isn’t unsafe because it doesn’t
imply a dereference.
Trait Implementations
UnsafeHandle
doesn’t own its handle, but AsRawFd
doesn’t require any
guarantees about lifetimes, so it’s safe to implement. This is similar to
how RawFd
implements AsRawFd
(see the raw_fd_reflexive_traits
trait
implementations in std
).
UnsafeHandle
doesn’t own its handle; see the comments for
impl AsRawFd for UnsafeHandle
.
Constructs a new instance of Self
from the given raw file
descriptor. 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
.
Consumes this object, returning the raw underlying file descriptor. 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