Struct winapi_util::HandleRef [−][src]
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]
impl HandleRefpub fn stdin() -> HandleRef[src]
pub fn stdin() -> HandleRefCreate a borrowed handle to stdin.
When the returned handle is dropped, stdin is not closed.
pub fn stdout() -> HandleRef[src]
pub fn stdout() -> HandleRefCreate a handle to stdout.
When the returned handle is dropped, stdout is not closed.
pub fn stderr() -> HandleRef[src]
pub fn stderr() -> HandleRefCreate a handle to stderr.
When the returned handle is dropped, stderr is not closed.
pub fn from_file(file: &File) -> HandleRef[src]
pub fn from_file(file: &File) -> HandleRefCreate 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]
pub unsafe fn from_raw_handle(handle: RawHandle) -> HandleRefCreate 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]
pub fn as_file(&self) -> &FileReturn this handle as a standard File reference.
pub fn as_file_mut(&mut self) -> &mut File[src]
pub fn as_file_mut(&mut self) -> &mut FileReturn this handle as a standard File mutable reference.
Trait Implementations
impl Debug for HandleRef[src]
impl Debug for HandleReffn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl AsRawHandle for HandleRef[src]
impl AsRawHandle for HandleReffn as_raw_handle(&self) -> RawHandle[src]
fn as_raw_handle(&self) -> RawHandleExtracts the raw handle, without taking any ownership.
impl Clone for HandleRef[src]
impl Clone for HandleReffn clone(&self) -> HandleRef[src]
fn clone(&self) -> HandleRefReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl AsHandleRef for HandleRef[src]
impl AsHandleRef for HandleRef