pub struct Pattern(/* private fields */);
Expand description
Represents a glob pattern which can match strings or paths
Methods from Deref<Target = Pattern>§
Sourcepub fn matches(&self, str: &str) -> bool
pub fn matches(&self, str: &str) -> bool
Return if the given str
matches this Pattern
using the default
match options (i.e. MatchOptions::new()
).
§Examples
use glob::Pattern;
assert!(Pattern::new("c?t").unwrap().matches("cat"));
assert!(Pattern::new("k[!e]tteh").unwrap().matches("kitteh"));
assert!(Pattern::new("d*g").unwrap().matches("doog"));
Sourcepub fn matches_path(&self, path: &Path) -> bool
pub fn matches_path(&self, path: &Path) -> bool
Return if the given Path
, when converted to a str
, matches this
Pattern
using the default match options (i.e. MatchOptions::new()
).
Sourcepub fn matches_with(&self, str: &str, options: MatchOptions) -> bool
pub fn matches_with(&self, str: &str, options: MatchOptions) -> bool
Return if the given str
matches this Pattern
using the specified
match options.
Sourcepub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool
pub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool
Return if the given Path
, when converted to a str
, matches this
Pattern
using the specified match options.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pattern
impl<'de> Deserialize<'de> for Pattern
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> FromIterator<&'a Pattern> for PatternSet
impl<'a> FromIterator<&'a Pattern> for PatternSet
Source§impl FromIterator<Pattern> for PatternSet
impl FromIterator<Pattern> for PatternSet
Source§impl Ord for Pattern
impl Ord for Pattern
Source§impl PartialOrd for Pattern
impl PartialOrd for Pattern
impl Eq for Pattern
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
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
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more