pub enum Path {
BarePath(Interned<ModPath>),
Normal(NormalPath),
LangItem(LangItemTarget, Option<Name>),
}
Variants§
BarePath(Interned<ModPath>)
BarePath
is used when the path has neither generics nor type anchor, since the vast majority of paths
are in this category, and splitting Path
this way allows it to be more thin. When the path has either generics
or type anchor, it is Path::Normal
with the generics filled with None
even if there are none (practically
this is not a problem since many more paths have generics than a type anchor).
Normal(NormalPath)
Path::Normal
may have empty generics and type anchor (but generic args will be filled with None
).
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: &mut LowerCtx<'_>, path: Path) -> Option<Path>
pub fn from_src(ctx: &mut 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: Vec<Option<GenericArgs>>,
) -> Path
pub fn from_known_path( path: ModPath, generic_args: Vec<Option<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<TypeRefId>
pub fn generic_args(&self) -> Option<&[Option<GenericArgs>]>
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§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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
§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
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>
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>
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>
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