pub struct WithCachedTypeInfo<T> {
pub internee: T,
pub stable_hash: Fingerprint,
pub flags: TypeFlags,
pub outer_exclusive_binder: DebruijnIndex,
}
Expand description
A helper type that you can wrap round your own type in order to automatically cache the stable hash, type flags and debruijn index on creation and not recompute it whenever the information is needed. This is only done in incremental mode. You can also opt out of caching by using StableHash::ZERO for the hash, in which case the hash gets computed each time. This is useful if you have values that you intern but never (can?) use for stable hashing.
Fields§
§internee: T
§stable_hash: Fingerprint
§flags: TypeFlags
This field provides fast access to information that is also contained
in kind
.
This field shouldn’t be used directly and may be removed in the future.
Use Ty::flags()
instead.
outer_exclusive_binder: DebruijnIndex
This field provides fast access to information that is also contained
in kind
.
This is a kind of confusing thing: it stores the smallest binder such that
(a) the binder itself captures nothing but (b) all the late-bound things within the type are captured by some sub-binder.
So, for a type without any late-bound things, like u32
, this
will be innermost, because that is the innermost binder that
captures nothing. But for a type &'D u32
, where 'D
is a
late-bound region with De Bruijn index D
, this would be D + 1
– the binder itself does not capture D
, but D
is captured
by an inner binder.
We call this concept an “exclusive” binder D
because all
De Bruijn indices within the type are contained within 0..D
(exclusive).
Trait Implementations§
source§impl<T: Clone> Clone for WithCachedTypeInfo<T>
impl<T: Clone> Clone for WithCachedTypeInfo<T>
source§fn clone(&self) -> WithCachedTypeInfo<T>
fn clone(&self) -> WithCachedTypeInfo<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T> Deref for WithCachedTypeInfo<T>
impl<T> Deref for WithCachedTypeInfo<T>
source§impl<T: Hash> Hash for WithCachedTypeInfo<T>
impl<T: Hash> Hash for WithCachedTypeInfo<T>
source§impl<T: HashStable<CTX>, CTX> HashStable<CTX> for WithCachedTypeInfo<T>
impl<T: HashStable<CTX>, CTX> HashStable<CTX> for WithCachedTypeInfo<T>
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)
source§impl<T: Ord> Ord for WithCachedTypeInfo<T>
impl<T: Ord> Ord for WithCachedTypeInfo<T>
source§fn cmp(&self, other: &WithCachedTypeInfo<T>) -> Ordering
fn cmp(&self, other: &WithCachedTypeInfo<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<T: PartialEq> PartialEq for WithCachedTypeInfo<T>
impl<T: PartialEq> PartialEq for WithCachedTypeInfo<T>
source§impl<T: Ord> PartialOrd for WithCachedTypeInfo<T>
impl<T: Ord> PartialOrd for WithCachedTypeInfo<T>
impl<T: Copy> Copy for WithCachedTypeInfo<T>
impl<T: Eq> Eq for WithCachedTypeInfo<T>
Auto Trait Implementations§
impl<T> Freeze for WithCachedTypeInfo<T>where
T: Freeze,
impl<T> RefUnwindSafe for WithCachedTypeInfo<T>where
T: RefUnwindSafe,
impl<T> Send for WithCachedTypeInfo<T>where
T: Send,
impl<T> Sync for WithCachedTypeInfo<T>where
T: Sync,
impl<T> Unpin for WithCachedTypeInfo<T>where
T: Unpin,
impl<T> UnwindSafe for WithCachedTypeInfo<T>where
T: UnwindSafe,
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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 moresource§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.