Struct io_extras::os::windows::RawHandleOrSocket [−][src]
#[repr(transparent)]pub struct RawHandleOrSocket(_);
Expand description
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
. And unlike Posix-ish
platforms where text streams are generally UTF-8, the Windows Console
is UTF-16. This type behaves like an enum which can hold either a
handle or a socket, and to which UTF-8 text can be written.
It’s reasonable to worry that this might be trying too hard to make Windows
work like Posix-ish platforms, 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
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 AsRawHandle::as_raw_handle
, but returns an Option
so that
it can return None
if self
doesn’t contain a RawHandle
.
Like AsRawSocket::as_raw_socket
, but returns an Option
so that
it can return None
if self
doesn’t contain a RawSocket
.
Return a RawHandleOrSocket
representing stdin.
This differs from unowned_from_raw_handle
on the stdin handle in two
ways:
- It tracks the stdin handle, which may change dynamically via
SetStdHandle
. - When stdin is attached to a console, reads from this handle via
RawReadable
are decoded into UTF-8.
Return a RawHandleOrSocket
representing stdout.
This differs from unowned_from_raw_handle
on the stdout handle in two
ways:
- It tracks the stdout handle, which may change dynamically via
SetStdHandle
. - When stdout is attached to a console, writes to this handle via
RawWriteable
are encoded from UTF-8.
Return a RawHandleOrSocket
representing stderr.
This differs from unowned_from_raw_handle
on the stderr handle in two
ways:
- It tracks the stderr handle, which may change dynamically via
SetStdHandle
. - When stderr is attached to a console, writes to this handle via
RawWriteable
are encoded from UTF-8.
Trait Implementations
Like AsRawHandle::as_raw_handle
and AsRawSocket::as_raw_socket
but can return either type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for RawHandleOrSocket
impl Unpin for RawHandleOrSocket
impl UnwindSafe for RawHandleOrSocket
Blanket Implementations
Extracts the raw grip.
Mutably borrows from an owned value. Read more