logo

Struct std::os::windows::io::OwnedHandle

1.63.0 · source ·
#[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

source

impl OwnedHandle

source

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

source

impl AsHandle for OwnedHandle

source

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

Borrows the handle. Read more

source

impl AsRawHandle for OwnedHandle

source

fn as_raw_handle(&self) -> RawHandle

Extracts the raw handle. Read more

source

impl Debug for OwnedHandle

source

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

Formats the value using the given formatter. Read more

source

impl Drop for OwnedHandle

source

fn drop(&mut self)

Executes the destructor for this type. Read more

source

impl From<Child> for OwnedHandle

source

fn from(child: Child) -> OwnedHandle

Converts to this type from the input type.

source

impl From<ChildStderr> for OwnedHandle

source

fn from(child_stderr: ChildStderr) -> OwnedHandle

Converts to this type from the input type.

source

impl From<ChildStdin> for OwnedHandle

source

fn from(child_stdin: ChildStdin) -> OwnedHandle

Converts to this type from the input type.

source

impl From<ChildStdout> for OwnedHandle

source

fn from(child_stdout: ChildStdout) -> OwnedHandle

Converts to this type from the input type.

source

impl From<File> for OwnedHandle

source

fn from(file: File) -> OwnedHandle

Converts to this type from the input type.

source

impl<T> From<JoinHandle<T>> for OwnedHandle

source

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

Converts to this type from the input type.

source

impl From<OwnedHandle> for File

source

fn from(owned: OwnedHandle) -> Self

Converts to this type from the input type.

source

impl From<OwnedHandle> for Stdio

source

fn from(handle: OwnedHandle) -> Stdio

Converts to this type from the input type.

source

impl FromRawHandle for OwnedHandle

source

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

source

fn into_raw_handle(self) -> RawHandle

Consumes this object, returning the raw underlying handle. Read more

source

impl TryFrom<HandleOrInvalid> for OwnedHandle

type Error = InvalidHandleError

The type returned in the event of a conversion error.

source

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

Performs the conversion.

source

impl TryFrom<HandleOrNull> for OwnedHandle

type Error = NullHandleError

The type returned in the event of a conversion error.

source

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

Performs the conversion.

source

impl Send for OwnedHandle

source

impl Sync for OwnedHandle

Auto Trait Implementations

Blanket Implementations

source

impl<T> Any for T where
T: 'static + ?Sized,

source

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

source

impl<T> Borrow<T> for T where
T: ?Sized,

const: unstable · source

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

source

impl<T> BorrowMut<T> for T where
T: ?Sized,

const: unstable · source

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

Mutably borrows from an owned value. Read more

source

impl<T> From<T> for T

const: unstable · source

fn from(t: T) -> T

Returns the argument unchanged.

source

impl<T, U> Into<U> for T where
U: From<T>,

const: unstable · source

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source

impl<T, U> TryFrom<U> for T where
U: Into<T>,

type Error = Infallible

The type returned in the event of a conversion error.

const: unstable · source

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

Performs the conversion.

source

impl<T, U> TryInto<U> for T where
U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

const: unstable · source

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

Performs the conversion.

AltStyle によって変換されたページ (->オリジナル) /