pub type Erased<T: Erasable> = ErasedData<impl Copy>;Expand description
A value of T that has been “erased” into some opaque storage type.
This is helpful for reducing the number of concrete instantiations needed during codegen when building the compiler.
Using an opaque type alias allows the type checker to enforce that
Erased<T> and Erased<U> are still distinct types, while allowing
monomorphization to see that they might actually use the same storage type.
Aliased Type§
pub struct Erased<T: Erasable> {
data: MaybeUninit<impl Copy>,
}Fields§
§data: MaybeUninit<impl Copy>We use MaybeUninit here to make sure it’s legal to store a transmuted
value that isn’t actually of type Storage.
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.