Skip to main content

derive_altrep

Function derive_altrep 

Source
pub fn derive_altrep(input: DeriveInput) -> Result<TokenStream>
Expand description

Entry point for #[derive(Altrep)].

Generates ALTREP registration only (TypedExternal, AltrepClass, RegisterAltrep, IntoR, linkme entry, Ref/Mut accessor types).

The struct must already have low-level ALTREP traits implemented. For most use cases, prefer a family-specific derive instead: #[derive(AltrepInteger)], #[derive(AltrepReal)], etc. Those generate both the low-level traits AND registration. Use #[altrep(manual)] on a family derive to skip data trait generation when you provide your own AltrepLen + Alt*Data impls.

§Helper attributes

#[altrep(class = "CustomName")]  // override ALTREP class name (default: struct name)