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> DynSend for WithCachedTypeInfo<T>where
T: DynSend,
impl<T> DynSync for WithCachedTypeInfo<T>where
T: DynSync,
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§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<T> Pointable for T
impl<T> Pointable for T
Source§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.