Rust for serious R packages

Ship Rust-backed R packages without inventing your own glue layer.

miniextendr combines proc-macro exports, ALTREP-aware runtime pieces, multiple R class systems, and CRAN-minded packaging so your package architecture stays deliberate from day one.

  • #[miniextendr] generates exports and wrappers directly from Rust code.
  • ALTREP, ExternalPtr, and class-system support are first-class, not bolted on later.
  • Configure scripts and vendoring keep the path to CRAN realistic.
first package flow

Minimal export surface, generated wrappers, familiar R install flow.

use miniextendr_api::miniextendr;

#[miniextendr]
pub fn add(a: i32, b: i32) -> i32 {
    a + b
}

# R
devtools::document("mypackage")
add(1L, 2L)
# [1] 3
Wrappers generated from Rust docs Type conversions handled at the boundary Ready for R CMD INSTALL
5 R class systems supported
ALTREP lazy and compact vectors built in
CRAN offline-friendly packaging and vendoring

Why miniextendr

🔗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.

🔗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.

What The Site Covers

Move from overview to subsystem detail quickly.

The guide pages on the homepage are for orientation and adoption. The manual is for exact behavior, sharp edges, and implementation details.

Build system

Package like an R package, not like a sidecar experiment.

Configure scripts, vendoring, and template support are designed around the constraints of R package distribution.

Runtime

Use Rust safely at the R boundary.

Unwind protection, GC-aware pointer wrappers, and explicit conversion rules keep boundary behavior visible.

Ergonomics

Keep the authoring model close to ordinary Rust.

Proc macros drive exports, method wrappers, and several higher-level abstractions without requiring a custom DSL.

Documentation

Start with the core guides, then branch into the full reference.

Open the full manual