Skip to main content

impl_altinteger_from_data

Macro impl_altinteger_from_data 

Source
macro_rules! impl_altinteger_from_data {
    ($ty:ty) => { ... };
    ($ty:ty, dataptr) => { ... };
    ($ty:ty, serialize) => { ... };
    ($ty:ty, subset) => { ... };
    ($ty:ty, dataptr, serialize) => { ... };
    ($ty:ty, serialize, dataptr) => { ... };
    ($ty:ty, subset, serialize) => { ... };
    ($ty:ty, serialize, subset) => { ... };
    ($ty:ty, materializing_dataptr) => { ... };
    ($ty:ty, materializing_dataptr, serialize) => { ... };
}
Expand description

Generate ALTREP trait implementations for a type that implements AltIntegerData.

This macro generates impl Altrep, impl AltVec, and impl AltInteger for the type, delegating to the high-level AltIntegerData trait methods.

Requires: The type must implement TypedExternal (use #[derive(ExternalPtr)]).

§Variants

// Basic (no dataptr, no serialization):
impl_altinteger_from_data!(MyType);

// With dataptr (type must implement AltrepDataptr<i32>):
impl_altinteger_from_data!(MyType, dataptr);

// With serialization (type must implement AltrepSerialize):
impl_altinteger_from_data!(MyType, serialize);

// With subset optimization (type must implement AltrepExtractSubset):
impl_altinteger_from_data!(MyType, subset);

// Combine multiple options:
impl_altinteger_from_data!(MyType, dataptr, serialize);
impl_altinteger_from_data!(MyType, subset, serialize);