pub type Value<'tcx> = EarlyBinder<&'tcx List<Clause<'tcx>>>;

Aliased Type§

struct Value<'tcx> {
    value: &'tcx List<Clause<'tcx>>,
}

Fields§

§value: &'tcx List<Clause<'tcx>>

Implementations§

source§

impl<T> EarlyBinder<T>

source

pub fn bind(value: T) -> EarlyBinder<T>

source

pub fn as_ref(&self) -> EarlyBinder<&T>

source

pub fn map_bound_ref<F, U>(&self, f: F) -> EarlyBinder<U>where F: FnOnce(&T) -> U,

source

pub fn map_bound<F, U>(self, f: F) -> EarlyBinder<U>where F: FnOnce(T) -> U,

source

pub fn try_map_bound<F, U, E>(self, f: F) -> Result<EarlyBinder<U>, E>where F: FnOnce(T) -> Result<U, E>,

source

pub fn rebind<U>(&self, value: U) -> EarlyBinder<U>

source

pub fn skip_binder(self) -> T

Skips the binder and returns the “bound” value. This can be used to extract data that does not depend on generic parameters (e.g., getting the DefId of the inner value or getting the number of arguments of an FnSig). Otherwise, consider using instantiate_identity.

To skip the binder on x: &EarlyBinder<T> to obtain &T, leverage EarlyBinder::as_ref: x.as_ref().skip_binder().

See also Binder::skip_binder, which is the analogous operation on super::Binder.

source§

impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>where I::Item: TypeFoldable<TyCtxt<'tcx>>,

source

pub fn iter_instantiated( self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>] ) -> IterInstantiated<'s, 'tcx, I> ⓘ

source

pub fn instantiate_identity_iter(self) -> I::IntoIter

Similar to instantiate_identity, but on an iterator of TypeFoldable values.

source§

impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>where I::Item: Deref, <<I as IntoIterator>::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,

source

pub fn iter_instantiated_copied( self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>] ) -> IterInstantiatedCopied<'s, 'tcx, I> ⓘ

source

pub fn instantiate_identity_iter_copied( self ) -> impl Iterator<Item = <<I as IntoIterator>::Item as Deref>::Target>

Similar to instantiate_identity, but on an iterator of values that deref to a TypeFoldable.

source§

impl<T: IntoIterator> EarlyBinder<T>

source§

impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>>> EarlyBinder<T>

source

pub fn instantiate(self, tcx: TyCtxt<'tcx>, args: &[GenericArg<'tcx>]) -> T

source

pub fn instantiate_identity(self) -> T

Makes the identity replacement T0 => T0, ..., TN => TN. Conceptually, this converts universally bound variables into placeholders when inside of a given item.

For example, consider for<T> fn foo<T>(){ .. }:

  • Outside of foo, T is bound (represented by the presence of EarlyBinder).
  • Inside of the body of foo, we treat T as a placeholder by calling instantiate_identity to discharge the EarlyBinder.
source

pub fn no_bound_vars(self) -> Option<T>

Returns the inner value, but only if it contains no bound vars.

Trait Implementations§

source§

impl<T: Clone> Clone for EarlyBinder<T>

source§

fn clone(&self) -> EarlyBinder<T>

Returns a copy 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<T: Debug> Debug for EarlyBinder<T>

source§

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

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

impl<T, __D: Decoder> Decodable<__D> for EarlyBinder<T>where T: Decodable<__D>,

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl<T, __E: Encoder> Encodable<__E> for EarlyBinder<T>where T: Encodable<__E>,

source§

fn encode(&self, __encoder: &mut __E)

source§

impl<T: EraseType> EraseType for EarlyBinder<T>

§

type Result = <T as EraseType>::Result

source§

impl<T: Hash> Hash for EarlyBinder<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'__ctx, T> HashStable<StableHashingContext<'__ctx>> for EarlyBinder<T>where T: HashStable<StableHashingContext<'__ctx>>,

source§

fn hash_stable( &self, __hcx: &mut StableHashingContext<'__ctx>, __hasher: &mut StableHasher )

source§

impl<T: Ord> Ord for EarlyBinder<T>

source§

fn cmp(&self, other: &EarlyBinder<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<T: ParameterizedOverTcx> ParameterizedOverTcx for EarlyBinder<T>

§

type Value<'tcx> = EarlyBinder<<T as ParameterizedOverTcx>::Value<'tcx>>

source§

impl<T: PartialEq> PartialEq<EarlyBinder<T>> for EarlyBinder<T>

source§

fn eq(&self, other: &EarlyBinder<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd> PartialOrd<EarlyBinder<T>> for EarlyBinder<T>

source§

fn partial_cmp(&self, other: &EarlyBinder<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'tcx, T> !TypeFoldable<TyCtxt<'tcx>> for EarlyBinder<T>

For early binders, you should first call instantiate before using any visitors.

source§

fn try_fold_with<F>( self, folder: &mut F ) -> Result<Self, <F as FallibleTypeFolder<I>>::Error>where F: FallibleTypeFolder<I>,

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
source§

fn fold_with<F>(self, folder: &mut F) -> Selfwhere F: TypeFolder<I>,

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
source§

impl<'tcx, T> !TypeVisitable<TyCtxt<'tcx>> for EarlyBinder<T>

source§

fn visit_with<V>( &self, visitor: &mut V ) -> ControlFlow<<V as TypeVisitor<I>>::BreakTy, ()>where V: TypeVisitor<I>,

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
source§

impl<T: Copy> Copy for EarlyBinder<T>

source§

impl<T: Eq> Eq for EarlyBinder<T>

source§

impl<T> StructuralEq for EarlyBinder<T>

source§

impl<T> StructuralPartialEq for EarlyBinder<T>

Layout§

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:8 bytes