Skip to main content

FileSystemCapabilities

Struct FileSystemCapabilities 

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

Stable typed capability support for one configured filesystem.

Capabilities have one of two support strengths: conditional capabilities may be attempted and can still be rejected for an individual request, while guaranteed capabilities are promised for every valid request in scope. Derived capabilities must not be stronger than their base capability.

§Examples

use qubit_fs::metadata::{FileSystemCapabilities, FileSystemCapability,
    FileSystemCapabilitySupport};

let capabilities = FileSystemCapabilities::new()
    .with_conditional(FileSystemCapability::Read)
    .with_conditional(FileSystemCapability::RangeRead);
assert_eq!(capabilities.support(FileSystemCapability::RangeRead),
    FileSystemCapabilitySupport::Conditional);
assert_eq!(capabilities.support(FileSystemCapability::Write),
    FileSystemCapabilitySupport::Unsupported);
assert!(capabilities.missing_dependency().is_none());

let invalid = FileSystemCapabilities::new()
    .with_guaranteed(FileSystemCapability::RangeRead)
    .with_conditional(FileSystemCapability::Read);
assert_eq!(invalid.missing_dependency(), Some((
    FileSystemCapability::RangeRead, FileSystemCapability::Read)));

Implementations§

Source§

impl FileSystemCapabilities

Source

pub const fn new() -> Self

Creates an empty capability set.

Source

pub const fn with_conditional(self, capability: FileSystemCapability) -> Self

Returns a copy with one additional conditional capability.

Source

pub const fn with_guaranteed(self, capability: FileSystemCapability) -> Self

Returns a copy with one additional guaranteed capability.

Source

pub const fn set_support( self, capability: FileSystemCapability, support: FileSystemCapabilitySupport, ) -> Self

Replaces the support status of one capability.

Source

pub const fn support( &self, capability: FileSystemCapability, ) -> FileSystemCapabilitySupport

Returns the support status of capability.

Source

pub const fn supports(&self, capability: FileSystemCapability) -> bool

Returns whether the provider can attempt capability.

Source

pub const fn guarantees(&self, capability: FileSystemCapability) -> bool

Returns whether capability is guaranteed in this filesystem scope.

Source

pub const fn len(&self) -> usize

Returns the number of advertised capabilities.

§Returns

Number of set capability flags.

Source

pub const fn is_empty(&self) -> bool

Returns whether no capability is advertised.

§Returns

true when the set contains no capability.

Source

pub fn iter(&self) -> impl Iterator<Item = FileSystemCapability> + '_

Iterates advertised capabilities in stable discriminant order.

§Returns

An iterator over every capability contained in this set.

Source

pub fn iter_with_support( &self, ) -> impl Iterator<Item = (FileSystemCapability, FileSystemCapabilitySupport)> + '_

Iterates advertised capabilities with their support status.

Source

pub fn missing_dependency( &self, ) -> Option<(FileSystemCapability, FileSystemCapability)>

Returns the first advertised capability whose required base capability is absent.

None means that every advertised derived capability has its required base capability. The returned pair contains the derived capability followed by the missing base capability.

§Returns

Some with the first derived capability and missing base capability, or None when no advertised dependency is missing.

Trait Implementations§

Source§

impl Clone for FileSystemCapabilities

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FileSystemCapabilities

Source§

impl Debug for FileSystemCapabilities

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

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

impl Default for FileSystemCapabilities

Source§

fn default() -> Self

Creates an empty capability set.

Source§

impl Eq for FileSystemCapabilities

Source§

impl PartialEq for FileSystemCapabilities

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileSystemCapabilities

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, !>

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.