[][src]Struct unsafe_io::RawHandleOrSocket

pub struct RawHandleOrSocket(_);

A Windows analog for the Posix-ish AsRawFd type. Unlike Posix-ish platforms which have a single type for files and sockets, Windows has distinct types, RawHandle and RawSocket; this type behaves like an enum which can hold either.

It's reasonable to worry that this might be trying too hard to make Windows work like Unix, however in this case, the number of types is small, so the enum is simple and the overhead is relatively low, and the benefit is that we can abstract over major Read and Write resources.

Implementations

impl RawHandleOrSocket[src]

pub fn from_raw_handle(raw_handle: RawHandle) -> Self[src]

Like FromRawHandle::from_raw_handle, but isn't unsafe because it doesn't imply a dereference.

pub fn from_raw_socket(raw_socket: RawSocket) -> Self[src]

Like FromRawSocket::from_raw_socket, but isn't unsafe because it doesn't imply a dereference.

pub fn as_raw_handle(&self) -> Option<RawHandle>[src]

Like AsRawHandle::as_raw_handle, but returns an Option so that it can return None if self doesn't contain a RawHandle.

pub fn as_raw_socket(&self) -> Option<RawSocket>[src]

Like AsRawSocket::as_raw_socket, but returns an Option so that it can return None if self doesn't contain a RawSocket.

Trait Implementations

impl AsRawHandleOrSocket for RawHandleOrSocket[src]

impl Clone for RawHandleOrSocket[src]

impl Copy for RawHandleOrSocket[src]

impl Debug for RawHandleOrSocket[src]

impl Eq for RawHandleOrSocket[src]

impl Hash for RawHandleOrSocket[src]

impl Ord for RawHandleOrSocket[src]

impl PartialEq<RawHandleOrSocket> for RawHandleOrSocket[src]

impl PartialOrd<RawHandleOrSocket> for RawHandleOrSocket[src]

impl Send for RawHandleOrSocket[src]

The Windows HANDLE and SOCKET types may be sent between threads.

impl StructuralEq for RawHandleOrSocket[src]

impl StructuralPartialEq for RawHandleOrSocket[src]

impl Sync for RawHandleOrSocket[src]

The Windows HANDLE and SOCKET types may be shared between threads.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.