Trait StartsWith
pub trait StartsWith<Prefix>where
Prefix: ?Sized,{
// Required methods
fn starts_with(&self, prefix: &Prefix) -> bool;
fn starts_with_exactly(&self, prefix: &Prefix) -> bool;
}Expand description
This trait abstracts over the concept of matching a prefix pattern against a path
To understand the semantics of how a given prefix pattern matches against a path, you must check the implementation for the type, but all of the provided implementations are broken down into two categories:
- The prefix is a
PathorPathBuf, in which case each component of the prefix is matched against each component ofselfuntil the entire prefix has been visited, or a mismatch is identified. - The prefix is a
stror something that derefs tostr, in which case the prefix is matched against the first component ofself(which component ofselfis considered “first” is dependent on whether the match must be exact or not).
Required Methods§
fn starts_with(&self, prefix: &Prefix) -> bool
fn starts_with(&self, prefix: &Prefix) -> bool
Returns true if the current path, sans root component, starts with prefix
fn starts_with_exactly(&self, prefix: &Prefix) -> bool
fn starts_with_exactly(&self, prefix: &Prefix) -> bool
Returns true if the current path, including root component, starts with prefix