Struct winapi_util::Handle [−][src]
pub struct Handle(_);
A handle represents an owned and valid Windows handle to a file-like object.
When an owned handle is dropped, then the underlying raw handle is closed.
To get a borrowed handle, use HandleRef.
Methods
impl Handle[src]
impl Handlepub fn from_file(file: File) -> Handle[src]
pub fn from_file(file: File) -> HandleCreate an owned handle to the given file.
When the returned handle is dropped, the file is closed.
Note that if the given file represents a handle to a directory, then
it is generally required that it have been opened with the
FILE_FLAG_BACKUP_SEMANTICS flag in order to use it in various
calls such as information or typ. To have this done automatically
for you, use the from_path_any constructor.
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Handle>[src]
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Handle>Open a file to the given file path, and return an owned handle to that file.
When the returned handle is dropped, the file is closed.
If there was a problem opening the file, then the corresponding error is returned.
pub fn from_path_any<P: AsRef<Path>>(path: P) -> Result<Handle>[src]
pub fn from_path_any<P: AsRef<Path>>(path: P) -> Result<Handle>Like from_path, but supports opening directory handles as well.
If you use from_path on a directory, then subsequent queries using
that handle will fail.
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 Handle[src]
impl Debug for Handlefn 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 Handle[src]
impl AsRawHandle for Handlefn as_raw_handle(&self) -> RawHandle[src]
fn as_raw_handle(&self) -> RawHandleExtracts the raw handle, without taking any ownership.
impl FromRawHandle for Handle[src]
impl FromRawHandle for Handleunsafe fn from_raw_handle(handle: RawHandle) -> Handle[src]
unsafe fn from_raw_handle(handle: RawHandle) -> HandleConstructs a new I/O object from the specified raw handle. Read more
impl IntoRawHandle for Handle[src]
impl IntoRawHandle for Handlefn into_raw_handle(self) -> RawHandle[src]
fn into_raw_handle(self) -> RawHandleConsumes this object, returning the raw underlying handle. Read more
impl AsHandleRef for Handle[src]
impl AsHandleRef for Handle