Skip to main content

return_conversion

Function return_conversion 

Source
pub(crate) fn return_conversion(
    value: &TokenStream,
    call: &TokenStream,
) -> TokenStream
Expand description

The conversion of a returned value to the SEXP a generated entry point returns (#2272): IntoR::try_into_sexp(value), and a failed conversion becomes the tagged condition value of a Result error (kind = "result_err"): the error’s message, classes and fields, read through RConditionData, which every IntoR::Error implements (condition::into_r_err_parts). No panic, so no framework file location in the message.

call is the call slot: Some(__miniextendr_call) in a .Call wrapper, None where the entry has none (sidecar getters, trait vtable shims; the R guard supplies the call).

An infallible IntoR (Error = Infallible) costs nothing: the Err arm is uninhabited and compiles away.