API Reference

Rustdoc API reference for every miniextendr crate

The full cargo doc output for each workspace crate – private items, hidden items, and type layouts are included (--document-private-items, --document-hidden-items, --show-type-layout). Links to crates.io dependencies resolve to docs.rs via -Z rustdoc-map.

🔗Core traits

TraitCratePurpose
TryFromSexpminiextendr_apiConvert an R SEXP into a Rust type (fallible)
IntoRminiextendr_apiConvert a Rust type into an R SEXP
IntoRAsminiextendr_apiConvert with explicit storage-type coercion
Coerce<T>miniextendr_apiExplicit coercion between Rust representation types
TypedExternalminiextendr_apiMarker for types wrapped in ExternalPtr (carry R-visible name + type id)
IntoExternalPtrminiextendr_apiConvert a Rust value into an ExternalPtr SEXP
AltrepLenminiextendr_apiRequired for all ALTREP classes: report length
AltIntegerData / AltRealData / …miniextendr_apiPer-type ALTREP data-access traits
AltrepExtractminiextendr_apiAbstraction over materialization (blanket impl for TypedExternal)

🔗Procedural macros

MacroKindPurpose
#[miniextendr]attributeExport a pub fn, impl block, or trait to R; automatic registration via linkme::distributed_slice
miniextendr_init!()function-likeGenerate R_init_<pkg>; calls package_init() for panic hooks, runtime init, ALTREP setup, and routine registration
#[r_ffi_checked]attributeOn unsafe extern blocks: generate checked variants (main-thread assert) and *_unchecked variants
typed_list!(...)function-likeBuild a validated dots spec for #[miniextendr(dots = typed_list!(...))]
list!(...)function-likeConstruct an R list from Rust values inline

See Features for the full derive macro table (20 derives across five groups) and #[miniextendr] attribute options.

🔗Registration model

Items annotated with #[miniextendr] self-register at link time via linkme::distributed_slice. There is no miniextendr_module! macro – it was removed in 2026-03-08. miniextendr_init!() is the only required call in lib.rs.

🔗ExternalPtr storage

ExternalPtr<T> stores Box<Box<dyn Any>>: a thin pointer in R_ExternalPtrAddr pointing to a fat pointer on the heap (carries the Any vtable). Type recovery uses Any::downcast, not R tag symbols. cached_ptr fields must have mutable provenance.