Struct unsafe_io::os::windows::RawHandleOrSocket [−][src]
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
impl RawHandleOrSocket
[src]
#[must_use]pub const fn unowned_from_raw_handle(raw_handle: RawHandle) -> Self
[src]
Like FromRawHandle::from_raw_handle
, but isn’t unsafe because it
doesn’t imply a dereference.
#[must_use]pub const fn unowned_from_raw_socket(raw_socket: RawSocket) -> Self
[src]
Like FromRawSocket::from_raw_socket
, but isn’t unsafe because it
doesn’t imply a dereference.
#[must_use]pub fn as_unowned_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
.
#[must_use]pub const fn as_unowned_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
.
#[must_use]pub const fn stdin() -> Self
[src]
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
UnsafeReadable
are decoded into UTF-8.
#[must_use]pub const fn stdout() -> Self
[src]
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
UnsafeWriteable
are encoded from UTF-8.
#[must_use]pub const fn stderr() -> Self
[src]
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
UnsafeWriteable
are encoded from UTF-8.
Trait Implementations
impl AsRawHandleOrSocket for RawHandleOrSocket
[src]
fn as_raw_handle_or_socket(&self) -> Self
[src]
impl Clone for RawHandleOrSocket
[src]
fn clone(&self) -> RawHandleOrSocket
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for RawHandleOrSocket
[src]
impl Debug for RawHandleOrSocket
[src]
impl Eq for RawHandleOrSocket
[src]
impl Hash for RawHandleOrSocket
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for RawHandleOrSocket
[src]
fn cmp(&self, other: &RawHandleOrSocket) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<RawHandleOrSocket> for RawHandleOrSocket
[src]
fn eq(&self, other: &RawHandleOrSocket) -> bool
[src]
fn ne(&self, other: &RawHandleOrSocket) -> bool
[src]
impl PartialOrd<RawHandleOrSocket> for RawHandleOrSocket
[src]
fn partial_cmp(&self, other: &RawHandleOrSocket) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Send for RawHandleOrSocket
[src]
impl StructuralEq for RawHandleOrSocket
[src]
impl StructuralPartialEq for RawHandleOrSocket
[src]
impl Sync for RawHandleOrSocket
[src]
Auto Trait Implementations
impl RefUnwindSafe for RawHandleOrSocket
impl Unpin for RawHandleOrSocket
impl UnwindSafe for RawHandleOrSocket
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,