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 for WithCachedTypeInfo<T>where
T: Clone,
impl<T> Clone for WithCachedTypeInfo<T>where
T: Clone,
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 for WithCachedTypeInfo<T>where
T: Hash,
impl<T> Hash for WithCachedTypeInfo<T>where
T: Hash,
Source§impl<T, CTX> HashStable<CTX> for WithCachedTypeInfo<T>where
T: HashStable<CTX>,
impl<T, CTX> HashStable<CTX> for WithCachedTypeInfo<T>where
T: HashStable<CTX>,
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)
Source§impl<T> Ord for WithCachedTypeInfo<T>where
T: Ord,
impl<T> Ord for WithCachedTypeInfo<T>where
T: Ord,
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 for WithCachedTypeInfo<T>where
T: PartialEq,
impl<T> PartialEq for WithCachedTypeInfo<T>where
T: PartialEq,
Source§impl<T> PartialOrd for WithCachedTypeInfo<T>where
T: Ord,
impl<T> PartialOrd for WithCachedTypeInfo<T>where
T: Ord,
impl<T> Copy for WithCachedTypeInfo<T>where
T: Copy,
impl<T> Eq for WithCachedTypeInfo<T>where
T: Eq,
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<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]
Source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]
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> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§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<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> 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,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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.