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§

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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.