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