pub enum ResolvedDefId {
Local(LocalDefId),
ExternSpec(LocalDefId, DefId),
Extern(DefId),
}Expand description
Normally, a DefId is either local or external, and DefId::as_local can be used to
distinguish between the two. However, extern specs introduce a third case: a local definition
wrapping an extern spec. This enum is a type level reminder used to differentiate between these
three cases.
The construction of ResolvedDefId is not encapsulated, but it is recommended to use
GlobalEnv::resolve_id to create one.
This is used when we are given a DefId and we need to resolve it into one of these three
cases. For handling local items that may correspond to an extern spec, see MaybeExternId.
Variants§
Local(LocalDefId)
A local definition. Corresponds to MaybeExternId::Local.
ExternSpec(LocalDefId, DefId)
A “dummy” local definition wrapping an extern spec. The LocalDefId is for the local item,
and the DefId is the resolved id for the external spec. Corresponds to
MaybeExternId::Extern.
Extern(DefId)
An external definition with no corresponding (local) extern spec.
Implementations§
Source§impl ResolvedDefId
impl ResolvedDefId
pub fn as_maybe_extern(self) -> Option<MaybeExternId>
Trait Implementations§
Source§impl Clone for ResolvedDefId
impl Clone for ResolvedDefId
Source§fn clone(&self) -> ResolvedDefId
fn clone(&self) -> ResolvedDefId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResolvedDefId
impl Debug for ResolvedDefId
impl Copy for ResolvedDefId
Auto Trait Implementations§
impl Freeze for ResolvedDefId
impl RefUnwindSafe for ResolvedDefId
impl Send for ResolvedDefId
impl Sync for ResolvedDefId
impl Unpin for ResolvedDefId
impl UnwindSafe for ResolvedDefId
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,
§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