[][src]Enum rustc_hir::def::Res

pub enum Res<Id = HirId> {
    Def(DefKindDefId),
    PrimTy(PrimTy),
    SelfTy(Option<DefId>, Option<(DefId, bool)>),
    ToolMod,
    SelfCtor(DefId),
    Local(Id),
    NonMacroAttr(NonMacroAttrKind),
    Err,
}

The resolution of a path or export.

Variants

Def(DefKindDefId)
PrimTy(PrimTy)
SelfTy(Option<DefId>, Option<(DefId, bool)>)

Self, with both an optional trait and impl DefId.

HACK(min_const_generics): impl self types also have an optional requirement to not mention any generic parameters to allow the following with min_const_generics:

impl Foo { fn test() -> [u8; std::mem::size_of::<Self>()] {} }

FIXME(lazy_normalization_consts): Remove this bodge once this feature is stable.

ToolMod
SelfCtor(DefId)
Local(Id)
NonMacroAttr(NonMacroAttrKind)
Err

Implementations

impl<Id> Res<Id>[src]

pub fn def_id(&self) -> DefId where
    Id: Debug
[src]

Return the DefId of this Def if it has an ID, else panic.

pub fn opt_def_id(&self) -> Option<DefId>[src]

Return Some(..) with the DefId of this Res if it has a ID, else None.

pub fn mod_def_id(&self) -> Option<DefId>[src]

Return the DefId of this Res if it represents a module.

pub fn descr(&self) -> &'static str[src]

A human readable name for the res kind ("function", "module", etc.).

pub fn article(&self) -> &'static str[src]

Gets an English article for the Res.

pub fn map_id<R>(self, map: impl FnMut(Id) -> R) -> Res<R>[src]

pub fn macro_kind(self) -> Option<MacroKind>[src]

pub fn ns(&self) -> Option<Namespace>[src]

Returns None if this is Res::Err

pub fn matches_ns(&self, ns: Namespace) -> bool[src]

Always returns true if self is Res::Err

Trait Implementations

impl<Id: Clone> Clone for Res<Id>[src]

impl<Id: Copy> Copy for Res<Id>[src]

impl<Id: Debug> Debug for Res<Id>[src]

impl<Id, __D: Decoder> Decodable<__D> for Res<Id> where
    Id: Decodable<__D>, 
[src]

impl<Id, __E: Encoder> Encodable<__E> for Res<Id> where
    Id: Encodable<__E>, 
[src]

impl<Id: Eq> Eq for Res<Id>[src]

impl<Id: Hash> Hash for Res<Id>[src]

impl<Id, __CTX> HashStable<__CTX> for Res<Id> where
    __CTX: HashStableContext,
    Id: HashStable<__CTX>, 
[src]

impl<Id: PartialEq> PartialEq<Res<Id>> for Res<Id>[src]

impl<Id> StructuralEq for Res<Id>[src]

impl<Id> StructuralPartialEq for Res<Id>[src]

Auto Trait Implementations

impl<Id> RefUnwindSafe for Res<Id> where
    Id: RefUnwindSafe

impl<Id> Send for Res<Id> where
    Id: Send

impl<Id> Sync for Res<Id> where
    Id: Sync

impl<Id> Unpin for Res<Id> where
    Id: Unpin

impl<Id> UnwindSafe for Res<Id> where
    Id: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.