Struct litcheck_core::fs::Pattern
source · 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 PartialEq for Pattern
impl PartialEq for Pattern
source§impl PartialOrd for Pattern
impl PartialOrd for Pattern
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl 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