Skip to main content

ErasedExternalPtr

Type Alias ErasedExternalPtr 

Source
pub type ErasedExternalPtr = ExternalPtr<()>;
Expand description

Type-erased ExternalPtr for cases where the concrete T is not needed.

Aliased Type§

#[repr(C)]
pub struct ErasedExternalPtr { sexp: SEXP, cached_ptr: NonNull<()>, _marker: PhantomData<()>, }

Fields§

§sexp: SEXP§cached_ptr: NonNull<()>

Cached data pointer, set once at construction time.

This avoids the R_ExternalPtrAddr FFI call on every as_ref()/as_mut(). The pointer remains valid for the lifetime of the ExternalPtr because:

  • R’s finalizer only runs after R garbage-collects the SEXP (which cannot happen while a Rust ExternalPtr value exists).
  • R_ClearExternalPtr is only called in methods that consume or finalize (into_raw, into_inner, release_any).
§_marker: PhantomData<()>

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: 16 bytes