Struct impl_tools_lib::SimplePath
source · pub struct SimplePath(_);Expand description
Simple, allocation-free path representation
Implementations§
source§impl SimplePath
impl SimplePath
sourcepub fn new(path: &'static [&'static str]) -> Self
pub fn new(path: &'static [&'static str]) -> Self
Construct, verifying validity
If the first component is an empty string, this is treated as a leading
colon (e.g. ["", "abc", "Def"] == ::abc::Def`). No other component may
be empty. At least one non-empty component is required.
Panics if requirements are not met.
sourcepub fn matches(&self, path: &Path) -> bool
pub fn matches(&self, path: &Path) -> bool
True if this matches a syn::Path
This must match the path exactly, with two exceptions:
- if
pathhas no leading colon butselfdoes (empty first component), the paths may still match - if the first component of
selfiscoreorallocbut the first component ofpathisstd, the paths may still match
sourcepub fn matches_ident(&self, ident: &Ident) -> bool
pub fn matches_ident(&self, ident: &Ident) -> bool
True if the last component matches a syn::Ident
sourcepub fn matches_ident_or_path(&self, path: &Path) -> bool
pub fn matches_ident_or_path(&self, path: &Path) -> bool
If input path has a single component with no leading colon, then
match via Self::matches_ident; otherwise match via
Self::matches.
Trait Implementations§
source§impl Display for SimplePath
impl Display for SimplePath
source§impl PartialEq<SimplePath> for SimplePath
impl PartialEq<SimplePath> for SimplePath
source§fn eq(&self, other: &SimplePath) -> bool
fn eq(&self, other: &SimplePath) -> bool
This method tests for
self and other values to be equal, and is used
by ==.