Skip to main content

QueryVolumeInformation

Struct QueryVolumeInformation 

Source
pub struct QueryVolumeInformation { /* private fields */ }
Expand description

An owned, marshalable parameter set for GetVolumeInformationByHandleW.

§Example

use std::fs;
use std::os::windows::io::AsHandle;

use windows_namespace_request_sys::volume::QueryVolumeInformation;
use windows_namespace_request_sys::CapturedHandle;

let path = std::env::temp_dir().join(format!("wnrs-vol-{}.tmp", std::process::id()));
fs::write(&path, b"example")?;
let file = fs::File::open(&path)?;

let volume = QueryVolumeInformation::new(CapturedHandle::capture(file.as_handle())?)
    .perform()?;

// A real volume names its filesystem and reports a component limit.
assert!(!volume.filesystem_name().is_empty());
assert!(volume.maximum_component_length() > 0);

Implementations§

Source§

impl QueryVolumeInformation

Source

pub fn new(handle: CapturedHandle) -> Self

Begins a request against handle.

The handle names any file or directory on the volume; the volume is what gets reported.

Source

pub fn handle(&self) -> &CapturedHandle

The owned duplicate of the handle being queried.

Source

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.

Source

pub fn perform(&self) -> Outcome<VolumeInformation>

Performs the query on the calling thread.

§Errors

Returns the raw Win32 code, unaltered.

Trait Implementations§

Source§

impl Debug for QueryVolumeInformation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Request for QueryVolumeInformation

Source§

type Error = Win32Error

How performing it can fail. Read more
Source§

type Output = VolumeInformation

What performing the request produces.
Source§

fn perform(&self) -> Outcome<VolumeInformation>

Performs the request on the calling thread. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.