[][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]

fn as_raw(&self) -> RawHandle
[src]

A convenience routine for extracting a HandleRef from Self, and then extracting a raw handle from the HandleRef. Read more

impl Clone for HandleRef
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for HandleRef
[src]

impl AsRawHandle for HandleRef
[src]

Auto Trait Implementations

impl Send for HandleRef

impl Sync for HandleRef

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.