Struct impl_tools_lib::SimplePath
source · [−]pub struct SimplePath(_);
Expand description
Simple, allocation-free path representation
Implementations
sourceimpl 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
sourceimpl ToTokens for SimplePath
impl ToTokens for SimplePath
sourcefn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Write self
to the given TokenStream
. Read more
sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Spanned for T where
T: Spanned + ?Sized,
impl<T> Spanned for T where
T: Spanned + ?Sized,
sourcefn span(&self) -> Span
fn span(&self) -> Span
Returns a Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty. Read more