#[repr(transparent)]pub struct OwnedHandle { /* private fields */ }
Available on Windows only.
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§
source§impl AsHandle for OwnedHandle
impl AsHandle for OwnedHandle
source§fn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
Borrows the handle. Read more
source§impl AsRawHandle for OwnedHandle
impl AsRawHandle for OwnedHandle
source§fn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
Extracts the raw handle. Read more
source§impl Debug for OwnedHandle
impl Debug for OwnedHandle
source§impl Drop for OwnedHandle
impl Drop for OwnedHandle
source§impl From<Child> for OwnedHandle
impl From<Child> for OwnedHandle
source§fn from(child: Child) -> OwnedHandle
fn from(child: Child) -> OwnedHandle
Converts to this type from the input type.
source§impl From<ChildStderr> for OwnedHandle
impl From<ChildStderr> for OwnedHandle
source§fn from(child_stderr: ChildStderr) -> OwnedHandle
fn from(child_stderr: ChildStderr) -> OwnedHandle
Converts to this type from the input type.
source§impl From<ChildStdin> for OwnedHandle
impl From<ChildStdin> for OwnedHandle
source§fn from(child_stdin: ChildStdin) -> OwnedHandle
fn from(child_stdin: ChildStdin) -> OwnedHandle
Converts to this type from the input type.
source§impl From<ChildStdout> for OwnedHandle
impl From<ChildStdout> for OwnedHandle
source§fn from(child_stdout: ChildStdout) -> OwnedHandle
fn from(child_stdout: ChildStdout) -> OwnedHandle
Converts to this type from the input type.
source§impl From<File> for OwnedHandle
impl From<File> for OwnedHandle
source§fn from(file: File) -> OwnedHandle
fn from(file: File) -> OwnedHandle
Converts to this type from the input type.
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
Converts to this type from the input type.
source§impl From<OwnedHandle> for File
impl From<OwnedHandle> for File
source§fn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
Converts to this type from the input type.
source§impl From<OwnedHandle> for Stdio
impl From<OwnedHandle> for Stdio
source§fn from(handle: OwnedHandle) -> Stdio
fn from(handle: OwnedHandle) -> Stdio
Converts to this type from the input type.
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
Constructs a new I/O object from the specified raw handle. Read more
source§impl IntoRawHandle for OwnedHandle
impl IntoRawHandle for OwnedHandle
source§fn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
Consumes this object, returning the raw underlying handle. Read more
1.70.0 · source§impl IsTerminal for OwnedHandle
impl IsTerminal for OwnedHandle
source§fn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
Returns
true
if the descriptor/handle refers to a terminal/tty. Read moresource§impl TryFrom<HandleOrInvalid> for OwnedHandle
impl TryFrom<HandleOrInvalid> for OwnedHandle
§type Error = InvalidHandleError
type Error = InvalidHandleError
The type returned in the event of a conversion error.
source§fn try_from(
handle_or_invalid: HandleOrInvalid
) -> Result<Self, InvalidHandleError>
fn try_from( handle_or_invalid: HandleOrInvalid ) -> Result<Self, InvalidHandleError>
Performs the conversion.
source§impl TryFrom<HandleOrNull> for OwnedHandle
impl TryFrom<HandleOrNull> for OwnedHandle
§type Error = NullHandleError
type Error = NullHandleError
The type returned in the event of a conversion error.
source§fn try_from(handle_or_null: HandleOrNull) -> Result<Self, NullHandleError>
fn try_from(handle_or_null: HandleOrNull) -> Result<Self, NullHandleError>
Performs the conversion.
impl Send for OwnedHandle
impl Sync for OwnedHandle
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more