Skip to main content

to_sexp

Function to_sexp 

Source
pub unsafe fn to_sexp<T>(x: T) -> SEXP
where T: IntoR,
Expand description

Convert a Rust value to an R SEXP.

Calls IntoR::into_sexp to produce an R value. Used in trait ABI method shims.

§Type Parameters

  • T - Source Rust type (must implement IntoR)

§Arguments

  • x - Rust value to convert

§Returns

R SEXP representation of the value.

§Safety

  • Must be called on R’s main thread
  • The returned SEXP must be protected if used across R allocations

§Example

// In a method shim:
let result: f64 = self_ref.area();
unsafe { to_sexp(result) }