pub enum Path {
Normal {
type_anchor: Option<Interned<TypeRef>>,
mod_path: Interned<ModPath>,
generic_args: Option<Box<[Option<Interned<GenericArgs>>]>>,
},
LangItem(LangItemTarget, Option<Name>),
}
Variants§
Normal
Fields
§
type_anchor: Option<Interned<TypeRef>>
Type based path like <T>::foo
.
Note that paths like <Type as Trait>::foo
are desugared to Trait::<Self=Type>::foo
.
§
generic_args: Option<Box<[Option<Interned<GenericArgs>>]>>
Invariant: the same len as self.mod_path.segments
or None
if all segments are None
.
A normal path
LangItem(LangItemTarget, Option<Name>)
A link to a lang item. It is used in desugaring of things like it?
. We can show these
links via a normal path since they might be private and not accessible in the usage place.
Implementations§
source§impl Path
impl Path
sourcepub fn from_src(ctx: &LowerCtx<'_>, path: Path) -> Option<Path>
pub fn from_src(ctx: &LowerCtx<'_>, path: Path) -> Option<Path>
Converts an ast::Path
to Path
. Works with use trees.
It correctly handles $crate
based path from macro call.
sourcepub fn from_known_path(
path: ModPath,
generic_args: impl Into<Box<[Option<Interned<GenericArgs>>]>>
) -> Path
pub fn from_known_path( path: ModPath, generic_args: impl Into<Box<[Option<Interned<GenericArgs>>]>> ) -> Path
Converts a known mod path to Path
.
sourcepub fn from_known_path_with_no_generic(path: ModPath) -> Path
pub fn from_known_path_with_no_generic(path: ModPath) -> Path
Converts a known mod path to Path
.
pub fn kind(&self) -> &PathKind
pub fn type_anchor(&self) -> Option<&TypeRef>
pub fn segments(&self) -> PathSegments<'_>
pub fn mod_path(&self) -> Option<&ModPath>
pub fn qualifier(&self) -> Option<Path>
pub fn is_self_type(&self) -> bool
Trait Implementations§
source§impl PartialEq for Path
impl PartialEq for Path
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoBox<dyn CloneAny> for Twhere
T: CloneAny,
impl<T> IntoBox<dyn CloneAny> for Twhere
T: CloneAny,
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more