pub struct SimplePath(_);
Expand description

Simple, allocation-free path representation

Implementations§

source§

impl SimplePath

source

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.

source

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 but self does (empty first component), the paths may still match
  • if the first component of self is core or alloc but the first component of path is std, the paths may still match
source

pub fn matches_ident(&self, ident: &Ident) -> bool

True if the last component matches a syn::Ident

source

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl PartialEq<SimplePath> for SimplePath

source§

fn eq(&self, other: &SimplePath) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for SimplePath

source§

impl StructuralEq for SimplePath

source§

impl StructuralPartialEq for SimplePath

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.