#[doc(hidden)]pub struct TraitViewData<V> {
data: *mut c_void,
vtable: *const V,
owner: Option<(SEXP, ProtectKey)>,
}Expand description
The checked construction boundary of a generated trait view.
Pointer fields live here, rather than in the expansion’s module: even
code beside the generated view cannot construct or overwrite them safely.
An R owner is rooted in the same pool as owning ExternalPtr handles,
independently of the PROTECT stack, so views can outlive their creating
scope and be dropped in any order.
Raw pointers keep this type (and every generated view) !Send and !Sync.
Fields§
§data: *mut c_void§vtable: *const V§owner: Option<(SEXP, ProtectKey)>Implementations§
Source§impl<V> TraitViewData<V>
impl<V> TraitViewData<V>
Sourcepub unsafe fn new(
data: *mut c_void,
vtable: *const c_void,
owner: Option<SEXP>,
) -> Self
pub unsafe fn new( data: *mut c_void, vtable: *const c_void, owner: Option<SEXP>, ) -> Self
Construct a view’s backing storage.
§Safety
data and vtable must be valid, non-null pointers matching the
generated trait view. The vtable must outlive this value. When supplied,
owner must own data; otherwise the caller must keep data alive.
Calls must respect Rust’s aliasing rules. Construction, use and drop
must run on R’s main thread, inside an R unwind boundary when allocating.
Sourcepub fn data(&self) -> *mut c_void
pub fn data(&self) -> *mut c_void
The concrete data pointer, retaining its original mutable provenance.
Trait Implementations§
Source§impl<V> Drop for TraitViewData<V>
impl<V> Drop for TraitViewData<V>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes