Struct io_lifetimes::OwnedHandle
source · [−]#[repr(transparent)]pub struct OwnedHandle { /* private fields */ }
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
sourceimpl OwnedHandle
impl OwnedHandle
Trait Implementations
sourceimpl AsHandle for OwnedHandle
impl AsHandle for OwnedHandle
sourcefn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
Borrows the handle. Read more
sourceimpl AsRawHandle for OwnedHandle
impl AsRawHandle for OwnedHandle
sourcefn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
Extracts the raw handle. Read more
sourceimpl Debug for OwnedHandle
impl Debug for OwnedHandle
sourceimpl Drop for OwnedHandle
impl Drop for OwnedHandle
sourceimpl From<Child> for OwnedHandle
impl From<Child> for OwnedHandle
sourceimpl From<ChildStderr> for OwnedHandle
impl From<ChildStderr> for OwnedHandle
sourcefn from(owned: ChildStderr) -> Self
fn from(owned: ChildStderr) -> Self
Converts to this type from the input type.
sourceimpl From<ChildStdin> for OwnedHandle
impl From<ChildStdin> for OwnedHandle
sourcefn from(owned: ChildStdin) -> Self
fn from(owned: ChildStdin) -> Self
Converts to this type from the input type.
sourceimpl From<ChildStdout> for OwnedHandle
impl From<ChildStdout> for OwnedHandle
sourcefn from(owned: ChildStdout) -> Self
fn from(owned: ChildStdout) -> Self
Converts to this type from the input type.
sourceimpl From<File> for OwnedHandle
impl From<File> for OwnedHandle
sourceimpl<T> From<JoinHandle<T>> for OwnedHandle
impl<T> From<JoinHandle<T>> for OwnedHandle
sourcefn from(owned: JoinHandle<T>) -> Self
fn from(owned: JoinHandle<T>) -> Self
Converts to this type from the input type.
sourceimpl From<OwnedHandle> for File
impl From<OwnedHandle> for File
sourcefn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
Converts to this type from the input type.
sourceimpl From<OwnedHandle> for HandleOrInvalid
impl From<OwnedHandle> for HandleOrInvalid
sourcefn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
Converts to this type from the input type.
sourceimpl From<OwnedHandle> for Stdio
impl From<OwnedHandle> for Stdio
sourcefn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
Converts to this type from the input type.
sourceimpl FromHandle for OwnedHandle
impl FromHandle for OwnedHandle
sourcefn from_handle(owned: OwnedHandle) -> Self
fn from_handle(owned: OwnedHandle) -> Self
Constructs a new instance of
Self
from the given handle. Read moresourcefn from_into_handle<Owned: IntoHandle>(into_owned: Owned) -> Selfwhere
Self: Sized,
fn from_into_handle<Owned: IntoHandle>(into_owned: Owned) -> Selfwhere
Self: Sized,
sourceimpl FromRawHandle for OwnedHandle
impl FromRawHandle for OwnedHandle
sourceunsafe 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
sourceimpl IntoHandle for OwnedHandle
impl IntoHandle for OwnedHandle
sourcefn into_handle(self) -> OwnedHandle
fn into_handle(self) -> OwnedHandle
Consumes this object, returning the underlying handle. Read more
sourceimpl IntoRawHandle for OwnedHandle
impl IntoRawHandle for OwnedHandle
sourcefn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
Consumes this object, returning the raw underlying handle. Read more
sourceimpl 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.
sourcefn try_from(
handle_or_invalid: HandleOrInvalid
) -> Result<Self, InvalidHandleError>
fn try_from(
handle_or_invalid: HandleOrInvalid
) -> Result<Self, InvalidHandleError>
Performs the conversion.
impl FilelikeViewType for OwnedHandle
impl Send for OwnedHandle
impl Sync for OwnedHandle
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> AsRawFilelike for Twhere
T: AsRawHandle,
impl<T> AsRawFilelike for Twhere
T: AsRawHandle,
sourcefn as_raw_filelike(&self) -> *mut c_void
fn as_raw_filelike(&self) -> *mut c_void
Returns the raw value.
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromRawFilelike for Twhere
T: FromRawHandle,
impl<T> FromRawFilelike for Twhere
T: FromRawHandle,
sourceunsafe fn from_raw_filelike(raw: *mut c_void) -> T
unsafe fn from_raw_filelike(raw: *mut c_void) -> T
Constructs
Self
from the raw value.sourceimpl<T> IntoRawFilelike for Twhere
T: IntoRawHandle,
impl<T> IntoRawFilelike for Twhere
T: IntoRawHandle,
sourcefn into_raw_filelike(self) -> *mut c_void
fn into_raw_filelike(self) -> *mut c_void
Returns the raw value.