Enum wax::Variance

source ·
pub enum Variance {
    Invariant(PathBuf),
    Variant,
}
Expand description

Variance of a Pattern.

The variance of a pattern describes the kinds of paths it can match with respect to the platform file system APIs. Patterns are either variant or invariant.

An invariant Pattern can be represented and completely described by an equivalent path using the platform’s file system APIs. For example, the glob expression path/to/file.txt resolves identically to the paths path/to/file.txt and path\to\file.txt on Unix and Windows, respectively.

A variant Pattern resolves differently than any particular path used with the platform’s file system APIs. Such an expression cannot be represented by a single path. This is typically because the expression matches multiple texts using a regular pattern, such as in the glob expression **/*.rs.

Variants§

§

Invariant(PathBuf)

Tuple Fields

§0: PathBuf

An equivalent path that completely describes the invariant Pattern with respect to platform file system APIs.

A Pattern is invariant and equivalent to a path.

Some non-literal expressions may be invariant, such as in the expression path/[t][o]/{file,file}.txt, which is invariant on Unix (but not on Windows, because the character class expressions do not match with case folding).

§

Variant

A Pattern is variant and cannot be completely described by a path.

Variant expressions may be formed from literals or other seemingly invariant expressions. For example, the variance of literals considers the case sensitivity of the platform’s file system APIs, so the expression (?i)path/to/file.txt is variant on Unix but not on Windows. Similarly, the expression path/[t][o]/file.txt is variant on Windows but not on Unix.

Implementations§

source§

impl Variance

source

pub fn path(&self) -> Option<&Path>

Gets the equivalent native path if invariant.

Returns None if variant.

source

pub fn is_invariant(&self) -> bool

Returns true if invariant.

source

pub fn is_variant(&self) -> bool

Returns true if variant.

Trait Implementations§

source§

impl Clone for Variance

source§

fn clone(&self) -> Variance

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Variance

source§

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

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

impl Hash for Variance

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Variance

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Variance

source§

impl StructuralEq for Variance

source§

impl StructuralPartialEq for Variance

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

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 Twhere U: TryFrom<T>,

§

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.