pub struct PathLookup {
ns: PathNS,
path: &'static [Symbol],
once: OnceLock<Vec<DefId>>,
}
Expand description
Lazily resolves a path into a list of DefId
s using lookup_path
.
Typically it will contain one DefId
or none, but in some situations there can be multiple:
Fields§
§ns: PathNS
§path: &'static [Symbol]
§once: OnceLock<Vec<DefId>>
Implementations§
Source§impl PathLookup
impl PathLookup
Sourcepub fn get(&self, cx: &LateContext<'_>) -> &[DefId]
pub fn get(&self, cx: &LateContext<'_>) -> &[DefId]
Returns the list of DefId
s that the path resolves to
Sourcepub fn only(&self, cx: &LateContext<'_>) -> Option<DefId>
pub fn only(&self, cx: &LateContext<'_>) -> Option<DefId>
Sourcepub fn matches(&self, cx: &LateContext<'_>, def_id: DefId) -> bool
pub fn matches(&self, cx: &LateContext<'_>, def_id: DefId) -> bool
Checks if the path resolves to the given def_id
Sourcepub fn matches_path<'tcx>(
&self,
cx: &LateContext<'_>,
maybe_path: &impl MaybePath<'tcx>,
) -> bool
pub fn matches_path<'tcx>( &self, cx: &LateContext<'_>, maybe_path: &impl MaybePath<'tcx>, ) -> bool
Resolves maybe_path
to a DefId
and checks if the PathLookup
matches it
Sourcepub fn matches_ty(&self, cx: &LateContext<'_>, ty: Ty<'_>) -> bool
pub fn matches_ty(&self, cx: &LateContext<'_>, ty: Ty<'_>) -> bool
Checks if the path resolves to ty
’s definition, must be an Adt
Auto Trait Implementations§
impl !Freeze for PathLookup
impl RefUnwindSafe for PathLookup
impl Send for PathLookup
impl Sync for PathLookup
impl Unpin for PathLookup
impl UnwindSafe for PathLookup
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> 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 moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 56 bytes