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

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.

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.

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.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

UnsafeHandle doesn’t own its handle; see the comments for impl AsRawFd for UnsafeHandle.

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.