miniextendr
A Rust-R interoperability framework for building R packages with Rust backends
Mark functions and impl blocks with #[miniextendr], keep R wrappers generated
from Rust docs, and get ALTREP, ExternalPtr, multiple class systems, and CRAN-minded
packaging as first-class concerns.
🔗Why teams pick miniextendr
miniextendr is a Rust-R interoperability framework built for packages that need to survive real tooling, real release processes, and real data sizes.
- Macro-first exports: mark functions and impl blocks with
#[miniextendr]and keep R wrappers generated from Rust docs. - Runtime built for R’s constraints: unwind protection, GC-aware pointer types, and optional worker-thread execution when you need it.
- Packaging that respects CRAN: vendoring, configure-based builds, and template-driven scaffolding via
minirextendr. Thejustfileprovides all monorepo build recipes.
🔗What the documentation covers
The guide pages below start broad and then narrow into specific subsystems. Use the manual when you want exhaustive behavior, feature switches, packaging details, or edge-case references. Curated entry pages link to the user manual for full reference.
Guides
Getting Started
Create your first R package with a Rust backend
GuideArchitecture
Crate layout, call flow, and build system overview
GuidePackages
A map of every major crate, R package, tool, and fixture package in the repository.
GuideType Conversions
R-Rust type mappings, NA handling, and coercion rules
GuideClass Systems
Env, R6, S3, S4, and S7 -- choosing the right class system
GuideFull Project Tutorial
Walk through the pigworld model project from package skeleton to Rust runtime, configure glue, and generated R wrappers.
GuideALTREP
Lazy and zero-copy vectors via Alternative Representations
GuideExternalPtr
Type-safe opaque pointers with GC-integrated finalizers
GuideError Handling
Panics, Result types, and unwind protection
GuideThread Safety
Calling R APIs from threads, worker thread pattern, and SEXP safety
GuideCRAN & Vendoring
Offline builds, dependency vendoring, and CRAN release prep
GuideFeatures
Cargo features, derive macros, and optional subsystems
GuideAPI Reference
Rustdoc API reference for every miniextendr crate
ReferenceUser Manual
Complete subsystem reference generated from the repo docs.