pub type mx_meth = unsafe extern "C" fn(data: *mut c_void, argc: i32, argv: *const SEXP) -> SEXP;Expand description
Method signature for trait vtable entries.
All trait methods are erased to this uniform signature:
data: Pointer to the concrete object dataargc: Number of arguments inargvargv: Array of SEXP arguments from R- Returns: SEXP result to R
§Argument Handling
The shim generated by #[miniextendr] on a trait is responsible for:
- Checking
argcmatches expected arity - Converting each
argv[i]viaTryFromSexp - Calling the actual method
- Converting the result via
IntoR - Catching panics and converting to R errors
§Safety
This function pointer is unsafe because:
datamust point to valid, properly-aligned data of the expected typeargvmust point toargcvalid SEXP values, each rooted by the caller for the whole call (the shim’s conversions and the method body allocate); the generated View protects each argument before converting the next- The returned SEXP is unprotected; the caller roots it before allocating
- Must be called on R’s main thread
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes