On this page
Struct std::os::windows::io::OwnedHandle
pub struct OwnedHandle { /* private fields */ }
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
impl OwnedHandle
pub fn try_clone(&self) -> Result<Self>
Creates a new OwnedHandle
instance that shares the same underlying object as the existing OwnedHandle
instance.
Trait Implementations
impl AsHandle for OwnedHandle
impl AsRawHandle for OwnedHandle
impl Debug for OwnedHandle
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Drop for OwnedHandle
impl From<Child> for OwnedHandle
fn from(child: Child) -> OwnedHandle
impl From<ChildStderr> for OwnedHandle
fn from(child_stderr: ChildStderr) -> OwnedHandle
impl From<ChildStdin> for OwnedHandle
fn from(child_stdin: ChildStdin) -> OwnedHandle
impl From<ChildStdout> for OwnedHandle
fn from(child_stdout: ChildStdout) -> OwnedHandle
impl From<File> for OwnedHandle
fn from(file: File) -> OwnedHandle
impl<T> From<JoinHandle<T>> for OwnedHandle
fn from(join_handle: JoinHandle<T>) -> OwnedHandle
impl From<OwnedHandle> for ChildStderr
Create 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.
fn from(handle: OwnedHandle) -> ChildStderr ⓘ
impl From<OwnedHandle> for ChildStdin
Create 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.
fn from(handle: OwnedHandle) -> ChildStdin ⓘ
impl From<OwnedHandle> for ChildStdout
Create 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.
fn from(handle: OwnedHandle) -> ChildStdout ⓘ
impl From<OwnedHandle> for File
fn from(owned: OwnedHandle) -> Self
impl From<OwnedHandle> for Stdio
fn from(handle: OwnedHandle) -> Stdio
impl FromRawHandle for OwnedHandle
unsafe fn from_raw_handle(handle: RawHandle) -> Self
impl IntoRawHandle for OwnedHandle
fn into_raw_handle(self) -> RawHandle
impl IsTerminal for OwnedHandle
fn is_terminal(&self) -> bool
true
if the descriptor/handle refers to a terminal/tty. Read more
impl TryFrom<HandleOrInvalid> for OwnedHandle
type Error = InvalidHandleError
fn try_from(
handle_or_invalid: HandleOrInvalid
) -> Result<Self, InvalidHandleError>
impl TryFrom<HandleOrNull> for OwnedHandle
type Error = NullHandleError
fn try_from(handle_or_null: HandleOrNull) -> Result<Self, NullHandleError>
impl Send for OwnedHandle
impl Sync for OwnedHandle
Auto Trait Implementations
impl RefUnwindSafe for OwnedHandle
impl Unpin for OwnedHandle
impl UnwindSafe for OwnedHandle
Blanket Implementations
impl<T> Any for T
where
T: 'static + ?Sized,
impl<T> Borrow<T> for T
where
T: ?Sized,
impl<T> BorrowMut<T> for T
where
T: ?Sized,
impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for T
where
U: From<T>,
fn into(self) -> U
Calls U::from(self)
.
That is, this conversion is whatever the implementation of From<T> for U
chooses to do.
impl<T, U> TryFrom<U> for T
where
U: Into<T>,
type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for T
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/windows/io/struct.OwnedHandle.html