[][src]Struct winapi_util::HandleRef

pub struct 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]

impl Clone for HandleRef[src]

impl Debug for HandleRef[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.