pub struct RSidecar;Expand description
Marker type for enabling R sidecar accessors in an ExternalPtr struct.
When used with #[derive(ExternalPtr)] and #[r_data], this field acts as
a selector that enables R-facing accessors for sibling #[r_data] fields.
§Supported Field Types
SEXP- Raw SEXP access, no conversioni32,f64,bool,u8- Zero-overhead scalars (stored directly in R)- Any
IntoRtype - Automatic conversion (e.g.,String,Vec<T>)
§Example
ⓘ
use miniextendr_api::ffi::SEXP;
#[derive(ExternalPtr)]
pub struct MyType {
pub x: i32,
/// Selector field - enables R wrapper generation
#[r_data]
r: RSidecar,
/// Raw SEXP slot - MyType_get_raw() / MyType_set_raw()
#[r_data]
pub raw: SEXP,
/// Zero-overhead scalar - MyType_get_count() / MyType_set_count()
#[r_data]
pub count: i32,
/// Conversion type - MyType_get_name() / MyType_set_name()
#[r_data]
pub name: String,
}§Design Notes
RSidecaris a ZST (zero-sized type) - no runtime cost- Only
pub#[r_data]fields get R wrapper functions generated - Multiple
RSidecarfields in one struct is a compile error
Trait Implementations§
impl Copy for RSidecar
impl Eq for RSidecar
impl StructuralPartialEq for RSidecar
Auto Trait Implementations§
impl Freeze for RSidecar
impl RefUnwindSafe for RSidecar
impl Send for RSidecar
impl Sync for RSidecar
impl Unpin for RSidecar
impl UnsafeUnpin for RSidecar
impl UnwindSafe for RSidecar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more