pub struct OwnedHandle { /* private fields */ }
Expand description
An owned handle.
This closes the handle on drop.
Note that it may have the value -1
, which in OwnedHandle
always
represents a valid handle value, such as the current process handle, and
not INVALID_HANDLE_VALUE
, despite the two having the same value. See
here for the full story.
And, it may have the value NULL
(0), which can occur when consoles are
detached from processes, or when windows_subsystem
is used.
OwnedHandle
uses CloseHandle
to close its handle on drop. As such,
it must not be used with handles to open registry keys which need to be
closed with RegCloseKey
instead.
Implementations§
Trait Implementations§
1.63.0 · Source§impl AsHandle for OwnedHandle
impl AsHandle for OwnedHandle
Source§fn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
1.63.0 · Source§impl AsRawHandle for OwnedHandle
impl AsRawHandle for OwnedHandle
Source§fn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
1.63.0 · Source§impl Debug for OwnedHandle
impl Debug for OwnedHandle
1.63.0 · Source§impl Drop for OwnedHandle
impl Drop for OwnedHandle
1.63.0 · Source§impl From<Child> for OwnedHandle
impl From<Child> for OwnedHandle
1.63.0 · Source§impl From<ChildStderr> for OwnedHandle
impl From<ChildStderr> for OwnedHandle
Source§fn from(child_stderr: ChildStderr) -> OwnedHandle
fn from(child_stderr: ChildStderr) -> OwnedHandle
Takes ownership of a ChildStderr
’s file handle.
1.63.0 · Source§impl From<ChildStdin> for OwnedHandle
impl From<ChildStdin> for OwnedHandle
Source§fn from(child_stdin: ChildStdin) -> OwnedHandle
fn from(child_stdin: ChildStdin) -> OwnedHandle
Takes ownership of a ChildStdin
’s file handle.
1.63.0 · Source§impl From<ChildStdout> for OwnedHandle
impl From<ChildStdout> for OwnedHandle
Source§fn from(child_stdout: ChildStdout) -> OwnedHandle
fn from(child_stdout: ChildStdout) -> OwnedHandle
Takes ownership of a ChildStdout
’s file handle.
1.63.0 · Source§impl From<File> for OwnedHandle
impl From<File> for OwnedHandle
1.63.0 · Source§impl<T> From<JoinHandle<T>> for OwnedHandle
impl<T> From<JoinHandle<T>> for OwnedHandle
Source§fn from(join_handle: JoinHandle<T>) -> OwnedHandle
fn from(join_handle: JoinHandle<T>) -> OwnedHandle
1.74.0 · Source§impl From<OwnedHandle> for ChildStderr
impl From<OwnedHandle> for ChildStderr
Creates a ChildStderr
from the provided OwnedHandle
.
The provided handle must be asynchronous, as reading and writing from and to it is implemented using asynchronous APIs.
Source§fn from(handle: OwnedHandle) -> ChildStderr ⓘ
fn from(handle: OwnedHandle) -> ChildStderr ⓘ
1.74.0 · Source§impl From<OwnedHandle> for ChildStdin
impl From<OwnedHandle> for ChildStdin
Creates a ChildStdin
from the provided OwnedHandle
.
The provided handle must be asynchronous, as reading and writing from and to it is implemented using asynchronous APIs.
Source§fn from(handle: OwnedHandle) -> ChildStdin ⓘ
fn from(handle: OwnedHandle) -> ChildStdin ⓘ
1.74.0 · Source§impl From<OwnedHandle> for ChildStdout
impl From<OwnedHandle> for ChildStdout
Creates a ChildStdout
from the provided OwnedHandle
.
The provided handle must be asynchronous, as reading and writing from and to it is implemented using asynchronous APIs.
Source§fn from(handle: OwnedHandle) -> ChildStdout ⓘ
fn from(handle: OwnedHandle) -> ChildStdout ⓘ
1.63.0 · Source§impl From<OwnedHandle> for File
impl From<OwnedHandle> for File
Source§fn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
Returns a File
that takes ownership of the given handle.
1.63.0 · Source§impl From<OwnedHandle> for Stdio
impl From<OwnedHandle> for Stdio
1.63.0 · Source§impl FromRawHandle for OwnedHandle
impl FromRawHandle for OwnedHandle
Source§unsafe fn from_raw_handle(handle: RawHandle) -> Self
unsafe fn from_raw_handle(handle: RawHandle) -> Self
1.63.0 · Source§impl IntoRawHandle for OwnedHandle
impl IntoRawHandle for OwnedHandle
Source§fn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
1.70.0 · Source§impl IsTerminal for OwnedHandle
impl IsTerminal for OwnedHandle
Source§fn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
true
if the descriptor/handle refers to a terminal/tty. Read more