pub enum ErasureType {
SelfType,
SelfRef,
SelfRefMut,
SelfAssoc {
assoc_name: String,
bound_trait_id: Option<u32>,
},
Generic {
name: String,
args: Vec<ErasureType>,
},
Reference {
mutable: bool,
inner: Box<ErasureType>,
},
MethodGeneric {
name: String,
},
Concrete {
type_token: u32,
},
}Expand description
Storage-tier projection of the method-signature types Erase_T
operates on. Mirrors the row table in ADR-006 §2.7.24 Q25.C.1:
Input τ | Erase_T(τ) |
|---|---|
Self | dyn T |
&Self / &mut Self | &dyn T / &mut dyn T |
Self::A w/ bound | dyn Bound |
Self::A w/o bound | ETO-001 compile error |
G<τ₁, ...> w/ erasure-safe G | recurse |
| method-generic G | KindedSlot + TypeInfo |
| concrete / builtin | unchanged |
Variants§
SelfType
Self — boxes into dyn T (the trait being erased).
SelfRef
&Self (immutable) — boxes into &dyn T.
SelfRefMut
&mut Self — boxes into &mut dyn T.
SelfAssoc
Self::A — projection of a Self-associated type. If bound_trait_id
is Some, the assoc type’s bound trait id (the type erases to
dyn Bound); if None, this is an ETO-001 compile error
(associated type without a trait bound cannot be erased).
Generic
An erasure-safe generic constructor (Option/Result/Vec/Box/Arc/
HashMap/HashSet/tuple/user-#[erasure_safe]) with type-argument
list to recurse into. name is the constructor’s user-visible
name; the emission tier maps this back to its own Type ctor.
Reference
&G<...> / &mut G<...> — reference to a generic. Reference
itself is not auto-boxed; recurses into the payload.
MethodGeneric
Method-generic parameter (fn foo<G: Bound>(...)). At dispatch
time the call site supplies a KindedSlot payload + a
&TypeInfo per generic — see §Q25.C.3.
Concrete
A concrete or builtin type (int, string, user-defined struct,
closure type, etc.). Carries an opaque token so the emission
tier can map back to its richer representation. Erase_T
leaves these unchanged.
Implementations§
Source§impl ErasureType
impl ErasureType
Sourcepub fn rewrite(&self, trait_id: u32) -> Result<RewriteResult, ErasureError>
pub fn rewrite(&self, trait_id: u32) -> Result<RewriteResult, ErasureError>
Apply the Erase_T(τ) substitution per ADR-006 §2.7.24 Q25.C.1.
Returns the rewritten type, plus a wrap_targets accumulator
describing every Self / Self::A site reached (used by the
emission tier to populate VTableEntry::BoxedReturn::wrap_targets).
The trait_id argument is the surrounding trait’s id — used
for Self → dyn T (T being the surrounding trait) and as
the fallback wrap_as_trait_id for assoc-type erasures.
Returns Err with the ETO error code on unbounded Self::A
per §Q25.C.1 row 5.
Trait Implementations§
Source§impl Clone for ErasureType
impl Clone for ErasureType
Source§fn clone(&self) -> ErasureType
fn clone(&self) -> ErasureType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErasureType
impl Debug for ErasureType
Source§impl PartialEq for ErasureType
impl PartialEq for ErasureType
Source§fn eq(&self, other: &ErasureType) -> bool
fn eq(&self, other: &ErasureType) -> bool
self and other values to be equal, and is used by ==.