Skip to main content

sidecar_r_set

Function sidecar_r_set 

Source
#[doc(hidden)]
pub unsafe fn sidecar_r_set<T: TypedExternal>( x: SEXP, index: usize, value: SEXP, require_live: bool, )
Expand description

Stores value, which the caller validated with TryFromSexp::<T>, in T’s Sidecar field index of the external pointer x carries (sidecar_receiver).

Called by the R setters #[derive(ExternalPtr)] generates, after sidecar_r_check with the same require_live. A live struct’s pending value for the field is dropped, since this write supersedes it. The store allocates nothing; reading an S4 receiver’s slot does, and value, an argument of the setter’s .Call(), is rooted by that call.

§Panics

When x carries no external pointer to a T, or with the miniextendr_borrow_conflict R error while a running call holds the value.

§Safety

Must be called from R’s main thread with valid x and value.