pub unsafe fn from_sexp<T>(x: SEXP) -> TExpand description
Convert an R SEXP to a Rust type, aborting via Rf_error on failure.
Attempts TryFromSexp::try_from_sexp
and calls rf_error (R longjmp, never returns) if conversion fails.
§Type Parameters
T- Target Rust type (must implementTryFromSexp)
§Arguments
x- R value to convert
§Returns
The converted Rust value.
§Safety
xmust be a valid SEXP- Must be called on R’s main thread
§Errors
Calls rf_error (never returns) if conversion fails. Error messages
are generated by TryFromSexp’s error type’s Display impl.
§Example
ⓘ
// In a method shim:
let arg0: i32 = unsafe { from_sexp(argv[0]) };
let arg1: String = unsafe { from_sexp(argv[1]) };