Skip to main content

Module c_wrapper_builder

Module c_wrapper_builder 

Source
Expand description

Unified C wrapper generation for standalone functions and impl methods.

This module provides shared infrastructure for generating C wrappers that:

  • Handle worker thread vs main thread execution strategies
  • Perform parameter conversion from SEXP to Rust types
  • Convert Rust return values back to SEXP
  • Properly handle panics and R errors

The same infrastructure is used by both #[miniextendr] on standalone functions and #[miniextendr(env|r6|s3|s4|s7)] on impl blocks.

Structs§

CWrapperContext
All information needed to generate a C wrapper function for an R-exported Rust item.
CWrapperContextBuilder
Builder for CWrapperContext.

Enums§

ReturnHandling
Strategy for converting a Rust return value into an R SEXP.
ThreadStrategy
Thread execution strategy for C wrappers.

Functions§

detect_return_handling
Detects the appropriate ReturnHandling strategy from a function’s return type.
detect_return_handling_from_type 🔒
Determines the ReturnHandling variant for a concrete syn::Type.
detect_return_handling_standalone_fn
Detects ReturnHandling for the standalone-#[miniextendr]-fn path.
first_type_argument 🔒
Extracts the first generic type argument from a path segment’s angle-bracketed arguments.