[−][src]Struct winapi_util::HandleRef
Represents a borrowed and valid Windows handle to a file-like object, such as stdin/stdout/stderr or an actual file.
When a borrowed handle is dropped, then the underlying raw handle is
not closed. To get an owned handle, use Handle
.
Methods
impl HandleRef
[src]
pub fn stdin() -> HandleRef
[src]
Create a borrowed handle to stdin.
When the returned handle is dropped, stdin is not closed.
pub fn stdout() -> HandleRef
[src]
Create a handle to stdout.
When the returned handle is dropped, stdout is not closed.
pub fn stderr() -> HandleRef
[src]
Create a handle to stderr.
When the returned handle is dropped, stderr is not closed.
pub fn from_file(file: &File) -> HandleRef
[src]
Create a borrowed handle to the given file.
When the returned handle is dropped, the file is not closed.
pub unsafe fn from_raw_handle(handle: RawHandle) -> HandleRef
[src]
Create a borrowed handle from the given raw handle.
Note that unlike the FromRawHandle
trait, this constructor does
not consume ownership of the given handle. That is, when the
borrowed handle created by this constructor is dropped, the underlying
handle will not be closed.
Safety
This is unsafe because there is no guarantee that the given raw handle is a valid handle. The caller must ensure this is true before invoking this constructor.
pub fn as_file(&self) -> &File
[src]
Return this handle as a standard File
reference.
pub fn as_file_mut(&mut self) -> &mut File
[src]
Return this handle as a standard File
mutable reference.
Trait Implementations
impl AsHandleRef for HandleRef
[src]
impl AsRawHandle for HandleRef
[src]
fn as_raw_handle(&self) -> RawHandle
[src]
impl Clone for HandleRef
[src]
impl Debug for HandleRef
[src]
Auto Trait Implementations
impl RefUnwindSafe for HandleRef
impl Send for HandleRef
impl Sync for HandleRef
impl Unpin for HandleRef
impl UnwindSafe for HandleRef
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,