pub trait FromRawHandle {
// Required method
unsafe fn from_raw_handle(handle: RawHandle) -> Self;
}
Constructs I/O objects from raw handles.
unsafe fn from_raw_handle(handle: RawHandle) -> Self
Constructs a new I/O object from the specified raw handle.
This function is typically used to consume ownership of the handle given, passing responsibility for closing the handle to the returned object. When used in this way, the returned object will take responsibility for closing it when the object goes out of scope.
However, consuming ownership is not strictly required. Use a From<OwnedHandle>::from implementation for an API which strictly consumes ownership.
The handle passed in must:
CloseHandle (as opposed to RegCloseKey or other close functions).Note that the handle may have the value INVALID_HANDLE_VALUE (-1), which is sometimes a valid handle value. See here for the full story.
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
impl FromRawHandle for File
impl FromRawHandle for PipeReader
impl FromRawHandle for PipeWriter
impl FromRawHandle for Stdio
impl FromRawHandle for OwnedHandle
© 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/trait.FromRawHandle.html