#[repr(transparent)]pub struct OwnedHandle {
handle: RawHandle,
}
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.
Fields§
§handle: RawHandle
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
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
Source§fn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
Returns a File
that takes ownership of the given handle.
1.87.0 · Source§impl From<OwnedHandle> for PipeReader
impl From<OwnedHandle> for PipeReader
Source§fn from(owned_handle: OwnedHandle) -> Self
fn from(owned_handle: OwnedHandle) -> Self
1.87.0 · Source§impl From<OwnedHandle> for PipeWriter
impl From<OwnedHandle> for PipeWriter
Source§fn from(owned_handle: OwnedHandle) -> Self
fn from(owned_handle: OwnedHandle) -> Self
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) -> Self
fn from(pipe: PipeReader) -> Self
1.87.0 · Source§impl From<PipeWriter> for OwnedHandle
impl From<PipeWriter> for OwnedHandle
Source§fn from(pipe: PipeWriter) -> Self
fn from(pipe: PipeWriter) -> Self
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 more1.63.0 · Source§impl TryFrom<HandleOrInvalid> for OwnedHandle
impl TryFrom<HandleOrInvalid> for OwnedHandle
Source§type Error = InvalidHandleError
type Error = InvalidHandleError
Source§fn try_from(
handle_or_invalid: HandleOrInvalid,
) -> Result<Self, InvalidHandleError>
fn try_from( handle_or_invalid: HandleOrInvalid, ) -> Result<Self, InvalidHandleError>
1.63.0 · Source§impl TryFrom<HandleOrNull> for OwnedHandle
impl TryFrom<HandleOrNull> for OwnedHandle
Source§type Error = NullHandleError
type Error = NullHandleError
Source§fn try_from(handle_or_null: HandleOrNull) -> Result<Self, NullHandleError>
fn try_from(handle_or_null: HandleOrNull) -> Result<Self, NullHandleError>
impl Sealed for OwnedHandle
impl Send for OwnedHandle
impl Sync for OwnedHandle
Auto Trait Implementations§
impl Freeze for OwnedHandle
impl RefUnwindSafe for OwnedHandle
impl Unpin for OwnedHandle
impl UnwindSafe for OwnedHandle
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
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
sized_type_properties
)[Self]
. Read more