pub unsafe fn from_sexp<T>(x: SEXP) -> TExpand description
Convert an R SEXP to a Rust type, panicking on failure.
Attempts TryFromSexp::try_from_sexp.
Generated shims catch failures with with_r_unwind_protect_shim; View
result conversions unwind to the consumer’s outer boundary.
§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
§Panics
Panics if conversion fails, using TryFromSexp’s error type’s Display
impl. The error is dropped during Rust unwinding.
§Example
ⓘ
// In a method shim:
let arg0: i32 = unsafe { from_sexp(argv[0]) };
let arg1: String = unsafe { from_sexp(argv[1]) };