#[repr(transparent)]pub struct OwnedHandle { /* private fields */ }
Available on Windows only.
Expand description
拥有所有权的句柄。
这将会丢弃时关闭句柄。
请注意,它可能具有值 -1
,它在 OwnedHandle
中始终表示有效的句柄值,例如 the current process handle,而不是 INVALID_HANDLE_VALUE
,尽管两者具有相同的值。
有关完整故事,请参见 这个。
并且,它可能具有值 NULL
(0),当控制台与进程分离或使用 windows_subsystem
时,可能会发生这种情况。
OwnedHandle
使用 CloseHandle
在关闭时丢弃其句柄。
因此,它不能与句柄一起使用来打开需要用 RegCloseKey
关闭的注册表项。
Implementations§
Trait Implementations§
source§impl AsHandle for OwnedHandle
impl AsHandle for OwnedHandle
source§fn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
借用句柄。 Read more
source§impl AsRawHandle for OwnedHandle
impl AsRawHandle for OwnedHandle
source§fn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
提取原始句柄。 Read more
source§impl Debug for OwnedHandle
impl Debug for OwnedHandle
source§impl From<Child> for OwnedHandle
impl From<Child> for OwnedHandle
source§fn from(child: Child) -> OwnedHandle
fn from(child: Child) -> OwnedHandle
从输入类型转换为此类型。
source§impl From<ChildStderr> for OwnedHandle
impl From<ChildStderr> for OwnedHandle
source§fn from(child_stderr: ChildStderr) -> OwnedHandle
fn from(child_stderr: ChildStderr) -> OwnedHandle
从输入类型转换为此类型。
source§impl From<ChildStdin> for OwnedHandle
impl From<ChildStdin> for OwnedHandle
source§fn from(child_stdin: ChildStdin) -> OwnedHandle
fn from(child_stdin: ChildStdin) -> OwnedHandle
从输入类型转换为此类型。
source§impl From<ChildStdout> for OwnedHandle
impl From<ChildStdout> for OwnedHandle
source§fn from(child_stdout: ChildStdout) -> OwnedHandle
fn from(child_stdout: ChildStdout) -> OwnedHandle
从输入类型转换为此类型。
source§impl From<File> for OwnedHandle
impl From<File> for OwnedHandle
source§fn from(file: File) -> OwnedHandle
fn from(file: File) -> OwnedHandle
从输入类型转换为此类型。
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
从输入类型转换为此类型。
source§impl From<OwnedHandle> for File
impl From<OwnedHandle> for File
source§fn from(owned: OwnedHandle) -> Self
fn from(owned: OwnedHandle) -> Self
从输入类型转换为此类型。
source§impl From<OwnedHandle> for Stdio
impl From<OwnedHandle> for Stdio
source§fn from(handle: OwnedHandle) -> Stdio
fn from(handle: OwnedHandle) -> Stdio
从输入类型转换为此类型。
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
从指定的原始句柄创建一个新的 I/O 对象。 Read more
source§impl IntoRawHandle for OwnedHandle
impl IntoRawHandle for OwnedHandle
source§fn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
消耗此对象,返回原始底层句柄。 Read more
1.70.0 · source§impl IsTerminal for OwnedHandle
impl IsTerminal for OwnedHandle
source§fn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
如果 descriptor/handle 引用 terminal/tty,则返回
true
。 Read moresource§impl TryFrom<HandleOrInvalid> for OwnedHandle
impl TryFrom<HandleOrInvalid> for OwnedHandle
§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>
执行转换。
source§impl TryFrom<HandleOrNull> for OwnedHandle
impl TryFrom<HandleOrNull> for OwnedHandle
§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>
执行转换。