Struct OwnedHandle

struct OwnedHandle { ... }

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

fn try_clone(self: &Self) -> Result<Self>

Creates a new OwnedHandle instance that shares the same underlying object as the existing OwnedHandle instance.

impl AsHandle for OwnedHandle

fn as_handle(self: &Self) -> BorrowedHandle<'_>

impl AsRawHandle for OwnedHandle

fn as_raw_handle(self: &Self) -> RawHandle

impl Debug for OwnedHandle

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Drop for OwnedHandle

fn drop(self: &mut Self)

impl Freeze for OwnedHandle

impl From for OwnedHandle

fn from(file: File) -> OwnedHandle

Takes ownership of a File's underlying file handle.

impl From for OwnedHandle

fn from(child_stdin: ChildStdin) -> OwnedHandle

Takes ownership of a ChildStdin's file handle.

impl From for OwnedHandle

fn from(child_stderr: ChildStderr) -> OwnedHandle

Takes ownership of a ChildStderr's file handle.

impl From for OwnedHandle

fn from(pipe: PipeWriter) -> Self

impl From for OwnedHandle

fn from(child: Child) -> OwnedHandle

Takes ownership of a Child's process handle.

impl From for OwnedHandle

fn from(pipe: PipeReader) -> Self

impl From for OwnedHandle

fn from(child_stdout: ChildStdout) -> OwnedHandle

Takes ownership of a ChildStdout's file handle.

impl FromRawHandle for OwnedHandle

unsafe fn from_raw_handle(handle: RawHandle) -> Self

impl IntoRawHandle for OwnedHandle

fn into_raw_handle(self: Self) -> RawHandle

impl IsTerminal for OwnedHandle

fn is_terminal(self: &Self) -> bool

impl RefUnwindSafe for OwnedHandle

impl Send for OwnedHandle

impl Sync for OwnedHandle

impl TryFrom for OwnedHandle

fn try_from(handle_or_null: HandleOrNull) -> Result<Self, NullHandleError>

impl TryFrom for OwnedHandle

fn try_from(handle_or_invalid: HandleOrInvalid) -> Result<Self, InvalidHandleError>

impl Unpin for OwnedHandle

impl UnsafeUnpin for OwnedHandle

impl UnwindSafe for OwnedHandle

impl<T> Any for OwnedHandle

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for OwnedHandle

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for OwnedHandle

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for OwnedHandle

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> From for OwnedHandle

fn from(join_handle: JoinHandle<T>) -> OwnedHandle

impl<T, U> Into for OwnedHandle

fn into(self: 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 for OwnedHandle

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for OwnedHandle

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>