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§
Source§impl OwnedHandle
impl OwnedHandle
1.63.0 · Sourcepub fn try_clone(&self) -> Result<OwnedHandle, Error>
pub fn try_clone(&self) -> Result<OwnedHandle, Error>
Creates a new OwnedHandle
instance that shares the same underlying
object as the existing OwnedHandle
instance.
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
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
Creates a ChildStderr
from the provided OwnedHandle
.
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
Creates a ChildStdin
from the provided OwnedHandle
.
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
Creates a ChildStdout
from the provided OwnedHandle
.
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
1.87.0 · Source§impl From<OwnedHandle> for PipeReader
impl From<OwnedHandle> for PipeReader
Source§fn from(owned_handle: OwnedHandle) -> PipeReader ⓘ
fn from(owned_handle: OwnedHandle) -> PipeReader ⓘ
1.87.0 · Source§impl From<OwnedHandle> for PipeWriter
impl From<OwnedHandle> for PipeWriter
Source§fn from(owned_handle: OwnedHandle) -> PipeWriter ⓘ
fn from(owned_handle: OwnedHandle) -> PipeWriter ⓘ
1.63.0 · Source§impl From<OwnedHandle> for Stdio
impl From<OwnedHandle> for Stdio
1.87.0 · Source§impl From<PipeReader> for OwnedHandle
impl From<PipeReader> for OwnedHandle
Source§fn from(pipe: PipeReader) -> OwnedHandle
fn from(pipe: PipeReader) -> OwnedHandle
1.87.0 · Source§impl From<PipeWriter> for OwnedHandle
impl From<PipeWriter> for OwnedHandle
Source§fn from(pipe: PipeWriter) -> OwnedHandle
fn from(pipe: PipeWriter) -> OwnedHandle
1.63.0 · Source§impl FromRawHandle for OwnedHandle
impl FromRawHandle for OwnedHandle
Source§unsafe fn from_raw_handle(handle: *mut c_void) -> OwnedHandle
unsafe fn from_raw_handle(handle: *mut c_void) -> OwnedHandle
1.63.0 · Source§impl IntoRawHandle for OwnedHandle
impl IntoRawHandle for OwnedHandle
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