pub struct NamePattern { /* private fields */ }Expand description
A compiled pattern for one leaf name.
A pattern never spans path separators because the value it is matched against is a single directory entry’s own name, which contains none. There is consequently no “crosses a segment” case to specify.
Implementations§
Source§impl NamePattern
impl NamePattern
Sourcepub fn empty() -> Self
pub fn empty() -> Self
A pattern matching only the empty name.
A directory entry’s name is never empty, so this matches nothing. It is the identity a builder starts from, not a useful clause on its own.
Sourcepub fn from_tokens(tokens: Vec<PatternToken>) -> Self
pub fn from_tokens(tokens: Vec<PatternToken>) -> Self
A pattern built from an explicit token sequence.
Sourcepub fn push(&mut self, token: PatternToken)
pub fn push(&mut self, token: PatternToken)
Append one token.
Sourcepub fn with(self, token: PatternToken) -> Self
pub fn with(self, token: PatternToken) -> Self
Append one token, taking and returning the pattern for chaining.
Sourcepub fn tokens(&self) -> &[PatternToken]
pub fn tokens(&self) -> &[PatternToken]
The pattern’s tokens, in order.
Sourcepub fn matches(&self, name: &Wtf16Str, case: CaseSensitivity) -> bool
pub fn matches(&self, name: &Wtf16Str, case: CaseSensitivity) -> bool
Whether this pattern matches name in its entirety.
Trait Implementations§
Source§impl Clone for NamePattern
impl Clone for NamePattern
Source§fn clone(&self) -> NamePattern
fn clone(&self) -> NamePattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NamePattern
impl Debug for NamePattern
Source§impl Default for NamePattern
impl Default for NamePattern
Source§fn default() -> NamePattern
fn default() -> NamePattern
Returns the “default value” for a type. Read more
impl Eq for NamePattern
Source§impl PartialEq for NamePattern
impl PartialEq for NamePattern
impl StructuralPartialEq for NamePattern
Auto Trait Implementations§
impl Freeze for NamePattern
impl RefUnwindSafe for NamePattern
impl Send for NamePattern
impl Sync for NamePattern
impl Unpin for NamePattern
impl UnsafeUnpin for NamePattern
impl UnwindSafe for NamePattern
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