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
path
has no leading colon butself
does (empty first component), the paths may still match - if the first component of
self
iscore
oralloc
but the first component ofpath
isstd
, 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 ==
.impl Eq for SimplePath
impl StructuralEq for SimplePath
impl StructuralPartialEq for SimplePath
Auto Trait Implementations§
impl RefUnwindSafe for SimplePath
impl Send for SimplePath
impl Sync for SimplePath
impl Unpin for SimplePath
impl UnwindSafe for SimplePath
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