Res

Enum Res 

Source
pub enum Res<Id = !> {
    Def(DefKind, DefId),
    PrimTy(PrimTy),
    SelfTyAlias {
        alias_to: DefId,
        is_trait_impl: bool,
    },
    SelfTyParam {
        trait_: DefId,
    },
    Param(ParamKind, Id),
    GlobalFunc(SpecFuncKind),
    NumConst(i128),
    Err,
}
Expand description

The resolution of a path

The enum contains a subset of the variants in [rustc_hir::def::Res] plus some extra variants for extra resolutions found in refinements.

Variants§

§

Def(DefKind, DefId)

See [rustc_hir::def::Res::Def]

§

PrimTy(PrimTy)

See [rustc_hir::def::Res::PrimTy]

§

SelfTyAlias

See [rustc_hir::def::Res::SelfTyAlias]

Fields

§alias_to: DefId
§is_trait_impl: bool
§

SelfTyParam

See [rustc_hir::def::Res::SelfTyParam]

Fields

§trait_: DefId
§

Param(ParamKind, Id)

A refinement parameter, e.g., declared with @n syntax

§

GlobalFunc(SpecFuncKind)

A refinement function defined with defs!

§

NumConst(i128)

A hack used to resolve u32::MAX ans similar.

§

Err

Implementations§

Source§

impl<Id> Res<Id>

Source

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

Source

pub fn is_box(&self, tcx: TyCtxt<'_>) -> bool

Source

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

Returns None if this is Res::Err

Source

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

Always returns true if self is Res::Err

Source

pub fn map_param_id<R>(self, f: impl FnOnce(Id) -> R) -> Res<R>

Source

pub fn expect_param(self) -> (ParamKind, Id)

Trait Implementations§

Source§

impl<Id: Clone> Clone for Res<Id>

Source§

fn clone(&self) -> Res<Id>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Id: Debug> Debug for Res<Id>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Id: PartialEq> PartialEq for Res<Id>

Source§

fn eq(&self, other: &Res<Id>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Id1, Id2> TryFrom<Res<Id1>> for Res<Id2>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(res: Res<Id1>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<Id: Copy> Copy for Res<Id>

Source§

impl<Id: Eq> Eq for Res<Id>

Source§

impl<Id> StructuralPartialEq for Res<Id>

Auto Trait Implementations§

§

impl<Id> Freeze for Res<Id>
where Id: Freeze,

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<P> IntoQueryParam<P> for P

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more