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§

ErrPartsMode
How the generated Err arm turns an error value into condition parts (message, class vector, structured data).
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 ReturnHandling strategy from a return type: the one rule for standalone functions, inherent methods and trait methods.
detect_return_handling_from_type 🔒
Determines the ReturnHandling variant for a concrete syn::Type.
first_type_argument 🔒
Extracts the first generic type argument from a path segment’s angle-bracketed arguments.