pub struct QueryFileInformationByHandle { /* private fields */ }Expand description
An owned, marshalable parameter set for GetFileInformationByHandle.
§Example
use std::fs;
use std::os::windows::io::AsHandle;
use windows_namespace_request_sys::file_info::QueryFileInformationByHandle;
use windows_namespace_request_sys::CapturedHandle;
let path = std::env::temp_dir().join(format!("wnrs-fi-{}.tmp", std::process::id()));
fs::write(&path, b"example")?;
let file = fs::File::open(&path)?;
let information = QueryFileInformationByHandle::new(
CapturedHandle::capture(file.as_handle())?,
)
.perform()?;
// The 64-bit file index this call reports in one shot, which the Ex form's
// FileIdInfo does not give in this shape.
let index = (u64::from(information.nFileIndexHigh) << 32)
| u64::from(information.nFileIndexLow);
assert_ne!(index, 0);
assert_eq!(information.nFileSizeLow, b"example".len() as u32);Implementations§
Source§impl QueryFileInformationByHandle
impl QueryFileInformationByHandle
Sourcepub fn new(handle: CapturedHandle) -> Self
pub fn new(handle: CapturedHandle) -> Self
Begins a request against handle.
Sourcepub fn handle(&self) -> &CapturedHandle
pub fn handle(&self) -> &CapturedHandle
The owned duplicate of the handle being queried.
Sourcepub fn try_clone(&self) -> Result<Self, HandleCaptureError>
pub fn try_clone(&self) -> Result<Self, HandleCaptureError>
Copies the request, duplicating the handle.
§Errors
Returns the handle-capture failure when the handle cannot be duplicated.
Trait Implementations§
Source§impl Debug for QueryFileInformationByHandle
impl Debug for QueryFileInformationByHandle
Auto Trait Implementations§
impl Freeze for QueryFileInformationByHandle
impl RefUnwindSafe for QueryFileInformationByHandle
impl Send for QueryFileInformationByHandle
impl Sync for QueryFileInformationByHandle
impl Unpin for QueryFileInformationByHandle
impl UnsafeUnpin for QueryFileInformationByHandle
impl UnwindSafe for QueryFileInformationByHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more