pub enum Path {
BarePath(Interned<ModPath>),
Normal(Box<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(Box<NormalPath>)
Path::Normal
will always have either generics or type anchor.
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_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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<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<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>
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