Skip to main content

Module error_value

Module error_value 

Source
Expand description

Tagged error value transport for #[miniextendr(error_in_r)] mode.

When error_in_r is enabled, Rust-origin failures (panics, Result::Err, Option::None) are converted to a tagged SEXP value instead of raising an R error immediately. The generated R wrapper inspects this tagged value and escalates it to a proper R error condition past the Rust boundary.

This ensures Rust destructors run cleanly before R sees the error.

§Condition value structure (make_rust_condition_value)

The tagged SEXP is a 4-element named list:

  • error: error message (character scalar)
  • kind: condition kind string — one of the constants in kind
  • class: optional user-supplied custom class (character scalar or NULL)
  • call: the R call SEXP (or NULL if not available)
  • class attribute: "rust_condition_value"
  • __rust_condition__ attribute: TRUE

Modules§

kind
Canonical kind strings for tagged condition values.

Functions§

make_rust_condition_value
Build a tagged condition-value SEXP for transport across the Rust→R boundary.
to_cstring_lossy 🔒
Convert a &str to a CString, falling back to fallback on interior NUL bytes.