Skip to main content

Module altrep

Module altrep 

Source
Expand description

ALTREP registration code generation.

This module generates the full ALTREP registration stack for data structs: TypedExternal, AltrepClass, RegisterAltrep, IntoR, linkme entry, and Ref/Mut accessor types.

§Usage

For types with field-based derives (auto-generates trait impls):

#[derive(AltrepInteger)]
#[altrep(len = "len", elt = "value", class = "MyConstInt")]
struct MyConstInt { value: i32, len: usize }

For types with manual trait impls (lowlevel + registration, user writes data traits):

#[derive(AltrepInteger)]
#[altrep(manual, class = "MyCustom", serialize)]
struct MyCustomData { ... }

impl AltrepLen for MyCustomData { ... }
impl AltIntegerData for MyCustomData { ... }
// Family derived from AltrepInteger — generates Altrep, AltVec, AltInteger, InferBase.

Functions§

derive_altrep
Entry point for #[derive(Altrep)].
generate_direct_altrep_registration 🔒
Generates full ALTREP registration for a data struct.