Skip to main content

Module altrep_impl

Module altrep_impl 

Source
Expand description

ALTREP implementation utilities.

This module provides helper functions used by the declarative macros generated for ALTREP classes. The proc-macro derives (#[derive(AltrepInteger)] etc.) lower to invocations of impl_alt*_from_data! macros which expand to code that references items in this module via $crate::altrep_impl::* paths.

Use crate::altrep_data1_as (re-exported from externalptr) to extract data from an ALTREP’s data1 slot.

§Layout

  • macros#[macro_export] declarative macros (impl_alt*_from_data! and their __impl_* helpers).
  • builtins — crate-private meta-macro + invocations for Vec<T> / Box<[T]> / Cow<T> / Range<T> ALTREP families.
  • arrays — const-generic [T; N] ALTREP impls.
  • static_slices — hand-written &'static [T] ALTREP impls.

Modules§

arrays
ALTREP impls for const-generic arrays [T; N].
builtins
Built-in ALTREP class instantiations for Vec<T>, Box<[T]>, Cow<T>, and Range<T>.
macros
Declarative macros generating ALTREP trait implementations.
static_slices
ALTREP impls for &'static [T].

Functions§

altrep_region_buf
Create a mutable slice from an ALTREP get_region output buffer pointer.
checked_mkchar
Create a CHARSXP from a Rust string, with checked length conversion.