Skip to main content

AltrepBuffer

Struct AltrepBuffer 

Source
pub struct AltrepBuffer<T: RNativeType> {
    values: Vec<T>,
    exposed: bool,
    retired: Vec<Vec<T>>,
}
Expand description

A growable native buffer whose exposed allocations survive later edits.

Wrap in Altrep to return it to R. Built-in classes use value semantics: R duplication clones the current values, so a copy R makes keeps its own values. An edit through the owner of an R object changes that object in place, for every binding R has of it.

edit detaches first if R has requested a data pointer, and keeps the old allocation until this owner is dropped. Previously returned pointers then refer to the prior values; subsequent callbacks see the new values. R provides no pointer-release notification, so repeated exposure followed by editing retains one buffer per such edit. No buffer is copied when it has only been read through Elt or Get_region.

This type deliberately has no DerefMut or method returning &mut Vec<T>: growth must pass through the edit boundary.

Fields§

§values: Vec<T>§exposed: bool§retired: Vec<Vec<T>>

Implementations§

Source§

impl<T: RNativeType> AltrepBuffer<T>

Source

pub fn new(values: Vec<T>) -> Self

Take ownership without copying or exposing the allocation.

Source

pub fn as_slice(&self) -> &[T]

Read the current values. The borrow prevents concurrent Rust edits.

Source

pub fn edit<R>(&mut self, edit: impl FnOnce(&mut Vec<T>) -> R) -> R

Edit the Vec, retaining its old allocation if a pointer was exposed. A panic in edit leaves earlier pointers valid and keeps any changes already made to the new Vec; it does not roll the edit back.

Source

pub fn len(&self) -> usize

Current number of elements.

Source

pub fn capacity(&self) -> usize

Capacity of the current Vec, excluding retained older allocations.

Source

pub fn is_empty(&self) -> bool

Whether the current vector is empty.

Trait Implementations§

Source§

impl AltComplex for AltrepBuffer<Rcomplex>

Source§

const HAS_ELT: bool = true

Set to true to register elt.
Source§

const HAS_GET_REGION: bool = true

Set to true to register get_region.
Source§

fn elt(x: SEXP, i: R_xlen_t) -> Rcomplex

Get element at index.
Source§

fn get_region( x: SEXP, start: R_xlen_t, len: R_xlen_t, buf: &mut [Rcomplex], ) -> R_xlen_t

Bulk read elements into buffer.
Source§

impl AltComplexData for AltrepBuffer<Rcomplex>

Source§

fn elt(&self, i: usize) -> Rcomplex

Get the complex element at index i.
Source§

fn as_slice(&self) -> Option<&[Rcomplex]>

Optional: return a slice if data is contiguous.
Source§

fn get_region(&self, start: usize, len: usize, buf: &mut [Rcomplex]) -> usize

Optional: bulk read into buffer (clamped to available data). Read more
Source§

impl AltInteger for AltrepBuffer<i32>

Source§

const HAS_ELT: bool = true

Set to true to register elt.
Source§

const HAS_GET_REGION: bool = true

Set to true to register get_region.
Source§

const HAS_IS_SORTED: bool = true

Set to true to register is_sorted.
Source§

const HAS_NO_NA: bool = true

Set to true to register no_na.
Source§

const HAS_SUM: bool = true

Set to true to register sum.
Source§

const HAS_MIN: bool = true

Set to true to register min.
Source§

const HAS_MAX: bool = true

Set to true to register max.
Source§

fn elt(x: SEXP, i: R_xlen_t) -> i32

Get element at index.
Source§

fn get_region( x: SEXP, start: R_xlen_t, len: R_xlen_t, buf: &mut [i32], ) -> R_xlen_t

Bulk read elements into buffer.
Source§

fn is_sorted(x: SEXP) -> i32

Sortedness hint.
Source§

fn no_na(x: SEXP) -> i32

NA-free hint.
Source§

fn sum(x: SEXP, narm: bool) -> SEXP

Optimized sum.
Source§

fn min(x: SEXP, narm: bool) -> SEXP

Optimized min.
Source§

fn max(x: SEXP, narm: bool) -> SEXP

Optimized max.
Source§

impl AltIntegerData for AltrepBuffer<i32>

Source§

fn elt(&self, i: usize) -> i32

Get the integer element at index i.
Source§

fn as_slice(&self) -> Option<&[i32]>

Optional: return a pointer to contiguous data if available. Default returns None (no contiguous backing).
Source§

fn get_region(&self, start: usize, len: usize, buf: &mut [i32]) -> usize

Optional: bulk read into buffer. Returns number of elements read. Read more
Source§

fn is_sorted(&self) -> Option<Sortedness>

Optional: sortedness hint. Default is unknown.
Source§

fn no_na(&self) -> Option<bool>

Optional: does this vector contain any NA values?
Source§

fn sum(&self, _na_rm: bool) -> Option<i64>

Optional: optimized sum. Default returns None (use R’s default).
Source§

fn min(&self, _na_rm: bool) -> Option<i32>

Optional: optimized min. Default returns None (use R’s default).
Source§

fn max(&self, _na_rm: bool) -> Option<i32>

Optional: optimized max. Default returns None (use R’s default).
Source§

impl AltLogical for AltrepBuffer<RLogical>

Source§

const HAS_ELT: bool = true

Set to true to register elt.
Source§

const HAS_GET_REGION: bool = true

Set to true to register get_region.
Source§

const HAS_IS_SORTED: bool = true

Set to true to register is_sorted.
Source§

const HAS_NO_NA: bool = true

Set to true to register no_na.
Source§

const HAS_SUM: bool = true

Set to true to register sum.
Source§

fn elt(x: SEXP, i: R_xlen_t) -> i32

Returns i32: 0=FALSE, 1=TRUE, NA_LOGICAL=NA
Source§

fn get_region( x: SEXP, start: R_xlen_t, len: R_xlen_t, buf: &mut [i32], ) -> R_xlen_t

Bulk read elements into buffer.
Source§

fn is_sorted(x: SEXP) -> i32

Sortedness hint.
Source§

fn no_na(x: SEXP) -> i32

NA-free hint.
Source§

fn sum(x: SEXP, narm: bool) -> SEXP

Sum for logical = count of TRUE values.
Source§

impl AltLogicalData for AltrepBuffer<RLogical>

Source§

fn elt(&self, i: usize) -> Logical

Get the logical element at index i.
Source§

fn as_r_slice(&self) -> Option<&[i32]>

Optional: return a slice if data is contiguous i32 (R’s internal format). Read more
Source§

fn get_region(&self, start: usize, len: usize, buf: &mut [i32]) -> usize

Optional: bulk read into buffer (clamped to available data). Read more
Source§

fn is_sorted(&self) -> Option<Sortedness>

Optional: sortedness hint.
Source§

fn no_na(&self) -> Option<bool>

Optional: does this vector contain any NA values?
Source§

fn sum(&self, _na_rm: bool) -> Option<i64>

Optional: optimized sum (count of TRUE values).
Source§

impl AltRaw for AltrepBuffer<u8>

Source§

const HAS_ELT: bool = true

Set to true to register elt.
Source§

const HAS_GET_REGION: bool = true

Set to true to register get_region.
Source§

fn elt(x: SEXP, i: R_xlen_t) -> u8

Get element at index.
Source§

fn get_region( x: SEXP, start: R_xlen_t, len: R_xlen_t, buf: &mut [u8], ) -> R_xlen_t

Bulk read elements into buffer.
Source§

impl AltRawData for AltrepBuffer<u8>

Source§

fn elt(&self, i: usize) -> u8

Get the raw byte at index i.
Source§

fn as_slice(&self) -> Option<&[u8]>

Optional: return a slice if data is contiguous.
Source§

fn get_region(&self, start: usize, len: usize, buf: &mut [u8]) -> usize

Optional: bulk read into buffer (clamped to available data). Read more
Source§

impl AltReal for AltrepBuffer<f64>

Source§

const HAS_ELT: bool = true

Set to true to register elt.
Source§

const HAS_GET_REGION: bool = true

Set to true to register get_region.
Source§

const HAS_IS_SORTED: bool = true

Set to true to register is_sorted.
Source§

const HAS_NO_NA: bool = true

Set to true to register no_na.
Source§

const HAS_SUM: bool = true

Set to true to register sum.
Source§

const HAS_MIN: bool = true

Set to true to register min.
Source§

const HAS_MAX: bool = true

Set to true to register max.
Source§

fn elt(x: SEXP, i: R_xlen_t) -> f64

Get element at index.
Source§

fn get_region( x: SEXP, start: R_xlen_t, len: R_xlen_t, buf: &mut [f64], ) -> R_xlen_t

Bulk read elements into buffer.
Source§

fn is_sorted(x: SEXP) -> i32

Sortedness hint.
Source§

fn no_na(x: SEXP) -> i32

NA-free hint.
Source§

fn sum(x: SEXP, narm: bool) -> SEXP

Optimized sum.
Source§

fn min(x: SEXP, narm: bool) -> SEXP

Optimized min.
Source§

fn max(x: SEXP, narm: bool) -> SEXP

Optimized max.
Source§

impl AltRealData for AltrepBuffer<f64>

Source§

fn elt(&self, i: usize) -> f64

Get the real element at index i.
Source§

fn as_slice(&self) -> Option<&[f64]>

Optional: return a pointer to contiguous data if available.
Source§

fn get_region(&self, start: usize, len: usize, buf: &mut [f64]) -> usize

Optional: bulk read into buffer (clamped to available data). Read more
Source§

fn is_sorted(&self) -> Option<Sortedness>

Optional: sortedness hint.
Source§

fn no_na(&self) -> Option<bool>

Optional: Some(true) promises the vector holds no NA and no NaN. Read more
Source§

fn sum(&self, _na_rm: bool) -> Option<f64>

Optional: optimized sum.
Source§

fn min(&self, _na_rm: bool) -> Option<f64>

Optional: optimized min.
Source§

fn max(&self, _na_rm: bool) -> Option<f64>

Optional: optimized max.
Source§

impl AltVec for AltrepBuffer<i32>

Source§

const HAS_DATAPTR: bool = true

Set to true to register dataptr.
Source§

const HAS_DATAPTR_OR_NULL: bool = true

Set to true to register dataptr_or_null.
Source§

fn dataptr(x: SEXP, writable: bool) -> *mut c_void

Get raw data pointer.
Source§

fn dataptr_or_null(x: SEXP) -> *const c_void

Get data pointer without forcing materialization.
Source§

const HAS_EXTRACT_SUBSET: bool = false

Set to true to register extract_subset.
Source§

fn extract_subset(_x: SEXP, _indx: SEXP, _call: SEXP) -> SEXP

Optimized subsetting.
Source§

impl AltVec for AltrepBuffer<f64>

Source§

const HAS_DATAPTR: bool = true

Set to true to register dataptr.
Source§

const HAS_DATAPTR_OR_NULL: bool = true

Set to true to register dataptr_or_null.
Source§

fn dataptr(x: SEXP, writable: bool) -> *mut c_void

Get raw data pointer.
Source§

fn dataptr_or_null(x: SEXP) -> *const c_void

Get data pointer without forcing materialization.
Source§

const HAS_EXTRACT_SUBSET: bool = false

Set to true to register extract_subset.
Source§

fn extract_subset(_x: SEXP, _indx: SEXP, _call: SEXP) -> SEXP

Optimized subsetting.
Source§

impl AltVec for AltrepBuffer<u8>

Source§

const HAS_DATAPTR: bool = true

Set to true to register dataptr.
Source§

const HAS_DATAPTR_OR_NULL: bool = true

Set to true to register dataptr_or_null.
Source§

fn dataptr(x: SEXP, writable: bool) -> *mut c_void

Get raw data pointer.
Source§

fn dataptr_or_null(x: SEXP) -> *const c_void

Get data pointer without forcing materialization.
Source§

const HAS_EXTRACT_SUBSET: bool = false

Set to true to register extract_subset.
Source§

fn extract_subset(_x: SEXP, _indx: SEXP, _call: SEXP) -> SEXP

Optimized subsetting.
Source§

impl AltVec for AltrepBuffer<Rcomplex>

Source§

const HAS_DATAPTR: bool = true

Set to true to register dataptr.
Source§

const HAS_DATAPTR_OR_NULL: bool = true

Set to true to register dataptr_or_null.
Source§

fn dataptr(x: SEXP, writable: bool) -> *mut c_void

Get raw data pointer.
Source§

fn dataptr_or_null(x: SEXP) -> *const c_void

Get data pointer without forcing materialization.
Source§

const HAS_EXTRACT_SUBSET: bool = false

Set to true to register extract_subset.
Source§

fn extract_subset(_x: SEXP, _indx: SEXP, _call: SEXP) -> SEXP

Optimized subsetting.
Source§

impl AltVec for AltrepBuffer<RLogical>

Source§

const HAS_DATAPTR: bool = true

Set to true to register dataptr.
Source§

const HAS_DATAPTR_OR_NULL: bool = true

Set to true to register dataptr_or_null.
Source§

fn dataptr(x: SEXP, writable: bool) -> *mut c_void

Get raw data pointer.
Source§

fn dataptr_or_null(x: SEXP) -> *const c_void

Get data pointer without forcing materialization.
Source§

const HAS_EXTRACT_SUBSET: bool = false

Set to true to register extract_subset.
Source§

fn extract_subset(_x: SEXP, _indx: SEXP, _call: SEXP) -> SEXP

Optimized subsetting.
Source§

impl Altrep for AltrepBuffer<i32>

Source§

const GUARD: AltrepGuard = crate::altrep_traits::AltrepGuard::RUnwind

The guard mode for native reads and inspection on this type. Read more
Source§

const HAS_DUPLICATE: bool = true

Set to true to register duplicate.
Source§

const HAS_SERIALIZED_STATE: bool = true

Set to true to register serialized_state.
Source§

const HAS_UNSERIALIZE: bool = true

Set to true to register unserialize.
Source§

fn duplicate(x: SEXP, _deep: bool) -> SEXP

Duplicate the ALTREP object.
Source§

fn length(x: SEXP) -> R_xlen_t

Returns the length of the ALTREP vector. This is REQUIRED - R cannot determine vector length without it.
Source§

fn serialized_state(x: SEXP) -> SEXP

Return serialization state.
Source§

fn unserialize(class: SEXP, state: SEXP) -> SEXP

Reconstruct ALTREP from serialized state.
Source§

const HAS_UNSERIALIZE_EX: bool = false

Set to true to register unserialize_ex.
Source§

fn unserialize_ex( _class: SEXP, _state: SEXP, _attr: SEXP, _objf: i32, _levs: i32, ) -> SEXP

Extended unserialization with attributes.
Source§

const HAS_DUPLICATE_EX: bool = false

Set to true to register duplicate_ex.
Source§

fn duplicate_ex(_x: SEXP, _deep: bool) -> SEXP

Extended duplication.
Source§

const HAS_COERCE: bool = false

Set to true to register coerce.
Source§

fn coerce(_x: SEXP, _to_type: SEXPTYPE) -> SEXP

Coerce to another type.
Source§

const HAS_INSPECT: bool = false

Set to true to register inspect.
Source§

fn inspect( _x: SEXP, _pre: i32, _deep: i32, _pvec: i32, _inspect_subtree: Option<unsafe extern "C-unwind" fn(SEXP, i32, i32, i32)>, ) -> bool

Custom inspection for .Internal(inspect()).
Source§

impl Altrep for AltrepBuffer<f64>

Source§

const GUARD: AltrepGuard = crate::altrep_traits::AltrepGuard::RUnwind

The guard mode for native reads and inspection on this type. Read more
Source§

const HAS_DUPLICATE: bool = true

Set to true to register duplicate.
Source§

const HAS_SERIALIZED_STATE: bool = true

Set to true to register serialized_state.
Source§

const HAS_UNSERIALIZE: bool = true

Set to true to register unserialize.
Source§

fn duplicate(x: SEXP, _deep: bool) -> SEXP

Duplicate the ALTREP object.
Source§

fn length(x: SEXP) -> R_xlen_t

Returns the length of the ALTREP vector. This is REQUIRED - R cannot determine vector length without it.
Source§

fn serialized_state(x: SEXP) -> SEXP

Return serialization state.
Source§

fn unserialize(class: SEXP, state: SEXP) -> SEXP

Reconstruct ALTREP from serialized state.
Source§

const HAS_UNSERIALIZE_EX: bool = false

Set to true to register unserialize_ex.
Source§

fn unserialize_ex( _class: SEXP, _state: SEXP, _attr: SEXP, _objf: i32, _levs: i32, ) -> SEXP

Extended unserialization with attributes.
Source§

const HAS_DUPLICATE_EX: bool = false

Set to true to register duplicate_ex.
Source§

fn duplicate_ex(_x: SEXP, _deep: bool) -> SEXP

Extended duplication.
Source§

const HAS_COERCE: bool = false

Set to true to register coerce.
Source§

fn coerce(_x: SEXP, _to_type: SEXPTYPE) -> SEXP

Coerce to another type.
Source§

const HAS_INSPECT: bool = false

Set to true to register inspect.
Source§

fn inspect( _x: SEXP, _pre: i32, _deep: i32, _pvec: i32, _inspect_subtree: Option<unsafe extern "C-unwind" fn(SEXP, i32, i32, i32)>, ) -> bool

Custom inspection for .Internal(inspect()).
Source§

impl Altrep for AltrepBuffer<u8>

Source§

const GUARD: AltrepGuard = crate::altrep_traits::AltrepGuard::RUnwind

The guard mode for native reads and inspection on this type. Read more
Source§

const HAS_DUPLICATE: bool = true

Set to true to register duplicate.
Source§

const HAS_SERIALIZED_STATE: bool = true

Set to true to register serialized_state.
Source§

const HAS_UNSERIALIZE: bool = true

Set to true to register unserialize.
Source§

fn duplicate(x: SEXP, _deep: bool) -> SEXP

Duplicate the ALTREP object.
Source§

fn length(x: SEXP) -> R_xlen_t

Returns the length of the ALTREP vector. This is REQUIRED - R cannot determine vector length without it.
Source§

fn serialized_state(x: SEXP) -> SEXP

Return serialization state.
Source§

fn unserialize(class: SEXP, state: SEXP) -> SEXP

Reconstruct ALTREP from serialized state.
Source§

const HAS_UNSERIALIZE_EX: bool = false

Set to true to register unserialize_ex.
Source§

fn unserialize_ex( _class: SEXP, _state: SEXP, _attr: SEXP, _objf: i32, _levs: i32, ) -> SEXP

Extended unserialization with attributes.
Source§

const HAS_DUPLICATE_EX: bool = false

Set to true to register duplicate_ex.
Source§

fn duplicate_ex(_x: SEXP, _deep: bool) -> SEXP

Extended duplication.
Source§

const HAS_COERCE: bool = false

Set to true to register coerce.
Source§

fn coerce(_x: SEXP, _to_type: SEXPTYPE) -> SEXP

Coerce to another type.
Source§

const HAS_INSPECT: bool = false

Set to true to register inspect.
Source§

fn inspect( _x: SEXP, _pre: i32, _deep: i32, _pvec: i32, _inspect_subtree: Option<unsafe extern "C-unwind" fn(SEXP, i32, i32, i32)>, ) -> bool

Custom inspection for .Internal(inspect()).
Source§

impl Altrep for AltrepBuffer<Rcomplex>

Source§

const GUARD: AltrepGuard = crate::altrep_traits::AltrepGuard::RUnwind

The guard mode for native reads and inspection on this type. Read more
Source§

const HAS_DUPLICATE: bool = true

Set to true to register duplicate.
Source§

const HAS_SERIALIZED_STATE: bool = true

Set to true to register serialized_state.
Source§

const HAS_UNSERIALIZE: bool = true

Set to true to register unserialize.
Source§

fn duplicate(x: SEXP, _deep: bool) -> SEXP

Duplicate the ALTREP object.
Source§

fn length(x: SEXP) -> R_xlen_t

Returns the length of the ALTREP vector. This is REQUIRED - R cannot determine vector length without it.
Source§

fn serialized_state(x: SEXP) -> SEXP

Return serialization state.
Source§

fn unserialize(class: SEXP, state: SEXP) -> SEXP

Reconstruct ALTREP from serialized state.
Source§

const HAS_UNSERIALIZE_EX: bool = false

Set to true to register unserialize_ex.
Source§

fn unserialize_ex( _class: SEXP, _state: SEXP, _attr: SEXP, _objf: i32, _levs: i32, ) -> SEXP

Extended unserialization with attributes.
Source§

const HAS_DUPLICATE_EX: bool = false

Set to true to register duplicate_ex.
Source§

fn duplicate_ex(_x: SEXP, _deep: bool) -> SEXP

Extended duplication.
Source§

const HAS_COERCE: bool = false

Set to true to register coerce.
Source§

fn coerce(_x: SEXP, _to_type: SEXPTYPE) -> SEXP

Coerce to another type.
Source§

const HAS_INSPECT: bool = false

Set to true to register inspect.
Source§

fn inspect( _x: SEXP, _pre: i32, _deep: i32, _pvec: i32, _inspect_subtree: Option<unsafe extern "C-unwind" fn(SEXP, i32, i32, i32)>, ) -> bool

Custom inspection for .Internal(inspect()).
Source§

impl Altrep for AltrepBuffer<RLogical>

Source§

const GUARD: AltrepGuard = crate::altrep_traits::AltrepGuard::RUnwind

The guard mode for native reads and inspection on this type. Read more
Source§

const HAS_DUPLICATE: bool = true

Set to true to register duplicate.
Source§

const HAS_SERIALIZED_STATE: bool = true

Set to true to register serialized_state.
Source§

const HAS_UNSERIALIZE: bool = true

Set to true to register unserialize.
Source§

fn duplicate(x: SEXP, _deep: bool) -> SEXP

Duplicate the ALTREP object.
Source§

fn length(x: SEXP) -> R_xlen_t

Returns the length of the ALTREP vector. This is REQUIRED - R cannot determine vector length without it.
Source§

fn serialized_state(x: SEXP) -> SEXP

Return serialization state.
Source§

fn unserialize(class: SEXP, state: SEXP) -> SEXP

Reconstruct ALTREP from serialized state.
Source§

const HAS_UNSERIALIZE_EX: bool = false

Set to true to register unserialize_ex.
Source§

fn unserialize_ex( _class: SEXP, _state: SEXP, _attr: SEXP, _objf: i32, _levs: i32, ) -> SEXP

Extended unserialization with attributes.
Source§

const HAS_DUPLICATE_EX: bool = false

Set to true to register duplicate_ex.
Source§

fn duplicate_ex(_x: SEXP, _deep: bool) -> SEXP

Extended duplication.
Source§

const HAS_COERCE: bool = false

Set to true to register coerce.
Source§

fn coerce(_x: SEXP, _to_type: SEXPTYPE) -> SEXP

Coerce to another type.
Source§

const HAS_INSPECT: bool = false

Set to true to register inspect.
Source§

fn inspect( _x: SEXP, _pre: i32, _deep: i32, _pvec: i32, _inspect_subtree: Option<unsafe extern "C-unwind" fn(SEXP, i32, i32, i32)>, ) -> bool

Custom inspection for .Internal(inspect()).
Source§

impl AltrepDataptr<Rcomplex> for AltrepBuffer<Rcomplex>

Source§

fn dataptr(&mut self, _writable: bool) -> Option<*mut Rcomplex>

Get a pointer to the underlying data, possibly triggering materialization. Read more
Source§

fn dataptr_or_null(&self) -> Option<*const T>

Get a read-only pointer without forcing materialization. Read more
Source§

impl AltrepDataptr<f64> for AltrepBuffer<f64>

Source§

fn dataptr(&mut self, _writable: bool) -> Option<*mut f64>

Get a pointer to the underlying data, possibly triggering materialization. Read more
Source§

fn dataptr_or_null(&self) -> Option<*const T>

Get a read-only pointer without forcing materialization. Read more
Source§

impl AltrepDataptr<i32> for AltrepBuffer<i32>

Source§

fn dataptr(&mut self, _writable: bool) -> Option<*mut i32>

Get a pointer to the underlying data, possibly triggering materialization. Read more
Source§

fn dataptr_or_null(&self) -> Option<*const T>

Get a read-only pointer without forcing materialization. Read more
Source§

impl AltrepDataptr<i32> for AltrepBuffer<RLogical>

Source§

fn dataptr(&mut self, _writable: bool) -> Option<*mut i32>

Get a pointer to the underlying data, possibly triggering materialization. Read more
Source§

fn dataptr_or_null(&self) -> Option<*const T>

Get a read-only pointer without forcing materialization. Read more
Source§

impl AltrepDataptr<u8> for AltrepBuffer<u8>

Source§

fn dataptr(&mut self, _writable: bool) -> Option<*mut u8>

Get a pointer to the underlying data, possibly triggering materialization. Read more
Source§

fn dataptr_or_null(&self) -> Option<*const T>

Get a read-only pointer without forcing materialization. Read more
Source§

impl<T: RNativeType> AltrepLen for AltrepBuffer<T>

Source§

fn altrep_len(&self) -> usize

Returns the length of this ALTREP vector.
Source§

fn altrep_is_empty(&self) -> bool

Returns true if the vector is empty.
Source§

impl<T: RNativeType> AltrepSerialize for AltrepBuffer<T>
where Vec<T>: IntoR + TryFromSexp,

Source§

fn serialized_state(&self) -> SEXP

Convert the ALTREP data to a serializable R object.
Source§

fn unserialize(state: SEXP) -> Option<Self>

Reconstruct the ALTREP data from a serialized state. Read more
Source§

impl<T: RNativeType> AsRef<[T]> for AltrepBuffer<T>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: RNativeType> Clone for AltrepBuffer<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + RNativeType> Debug for AltrepBuffer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: RNativeType> From<Vec<T>> for AltrepBuffer<T>

Source§

fn from(values: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl InferBase for AltrepBuffer<i32>

Source§

const BASE: RBase = crate::altrep::RBase::Int

The inferred R base type.
Source§

unsafe fn make_class( class_name: *const c_char, pkg_name: *const c_char, ) -> R_altrep_class_t

Create the ALTREP class handle. Read more
Source§

unsafe fn install_methods(cls: R_altrep_class_t)

Install ALTREP methods on the class. Read more
Source§

impl InferBase for AltrepBuffer<f64>

Source§

const BASE: RBase = crate::altrep::RBase::Real

The inferred R base type.
Source§

unsafe fn make_class( class_name: *const c_char, pkg_name: *const c_char, ) -> R_altrep_class_t

Create the ALTREP class handle. Read more
Source§

unsafe fn install_methods(cls: R_altrep_class_t)

Install ALTREP methods on the class. Read more
Source§

impl InferBase for AltrepBuffer<u8>

Source§

const BASE: RBase = crate::altrep::RBase::Raw

The inferred R base type.
Source§

unsafe fn make_class( class_name: *const c_char, pkg_name: *const c_char, ) -> R_altrep_class_t

Create the ALTREP class handle. Read more
Source§

unsafe fn install_methods(cls: R_altrep_class_t)

Install ALTREP methods on the class. Read more
Source§

impl InferBase for AltrepBuffer<Rcomplex>

Source§

const BASE: RBase = crate::altrep::RBase::Complex

The inferred R base type.
Source§

unsafe fn make_class( class_name: *const c_char, pkg_name: *const c_char, ) -> R_altrep_class_t

Create the ALTREP class handle. Read more
Source§

unsafe fn install_methods(cls: R_altrep_class_t)

Install ALTREP methods on the class. Read more
Source§

impl InferBase for AltrepBuffer<RLogical>

Source§

const BASE: RBase = crate::altrep::RBase::Logical

The inferred R base type.
Source§

unsafe fn make_class( class_name: *const c_char, pkg_name: *const c_char, ) -> R_altrep_class_t

Create the ALTREP class handle. Read more
Source§

unsafe fn install_methods(cls: R_altrep_class_t)

Install ALTREP methods on the class. Read more
Source§

impl RegisterAltrep for AltrepBuffer<i32>

Source§

fn get_or_init_class() -> R_altrep_class_t

Get the ALTREP class handle, initializing it if this is the first call. Read more
Source§

impl RegisterAltrep for AltrepBuffer<f64>

Source§

fn get_or_init_class() -> R_altrep_class_t

Get the ALTREP class handle, initializing it if this is the first call. Read more
Source§

impl RegisterAltrep for AltrepBuffer<u8>

Source§

fn get_or_init_class() -> R_altrep_class_t

Get the ALTREP class handle, initializing it if this is the first call. Read more
Source§

impl RegisterAltrep for AltrepBuffer<Rcomplex>

Source§

fn get_or_init_class() -> R_altrep_class_t

Get the ALTREP class handle, initializing it if this is the first call. Read more
Source§

impl RegisterAltrep for AltrepBuffer<RLogical>

Source§

fn get_or_init_class() -> R_altrep_class_t

Get the ALTREP class handle, initializing it if this is the first call. Read more
Source§

impl<T: RNativeType> TypedExternal for AltrepBuffer<T>

Source§

const TYPE_NAME: &'static str = "AltrepBuffer"

The type name as a static string (for debugging and display)
Source§

const TYPE_NAME_CSTR: &'static [u8] = b"AltrepBuffer\0"

The type name as a null-terminated C string (for R tag display)
Source§

const TYPE_ID_CSTR: &'static [u8] = b"miniextendr::AltrepBuffer\0"

Namespaced type ID as a null-terminated C string (for diagnostics). Read more
Source§

const R_SLOT_COUNT: usize = 0

Number of Sidecar<T> fields: values the external pointer’s protection list keeps after the type ID and the user slot. Read more
Source§

#[doc(hidden)]
const SIDECAR_NAMES: &'static [&'static str] = _

The R names of the Sidecar fields (#[r_data(name = "..")], else the Rust field name), in slot order: the names the protection list carries, so a save is read back by field name (#2187, #2215).
Source§

const RESTORED_ERROR_CLASS: &'static [&'static str] = _

The package’s condition classes for a pointer of this type restored from a saved session, in front of the miniextendr_restored* classes (RESTORED_NO_VALUE_CLASS / RESTORED_OTHER_VERSION_CLASS, then RESTORED_CLASS), which every restored refusal keeps. Read more
Source§

const RESTORED_ERROR_MESSAGE: Option<&'static str> = None

The package’s message for a pointer of this type restored from a saved session, replacing miniextendr’s in both the no-value and the other-version case (the condition’s saved_version / current_version fields stay), and for a list or environment of the class that carries no pointer (a save in an older format). A static string: one type is one R class, so the package names it literally. Read more
Source§

const FIELD_ERROR_CLASS: &'static [&'static str] = _

The package’s condition classes for the errors the type’s R field readers raise themselves (#1899), in front of their own class: a refused position (subscriptOutOfBoundsError), a name that is not a field (miniextendr_no_field), a computed field assigned to (miniextendr_read_only_field), a pointer of another type, and a receiver that carries no pointer (NO_HANDLE_CLASS). The R accessors of the type read it for the last two; the derive writes the same classes into the R helpers for the others. Read more
Source§

const FIELD_ERROR_MESSAGE: Option<&'static str> = None

The package’s message for the R accessors’ refusal of a receiver whose pointer is not a T or that carries no pointer (#1920), replacing miniextendr’s, which names the receiver’s R class. Read more
Source§

#[doc(hidden)]
fn __mx_visit_sidecars( &self, _visit: &mut dyn FnMut(usize, &'static str, &dyn SidecarField), )

Visits every Sidecar<T> field of self with its slot index and name, so the handle can flush the field’s pending value into its slot or load the slot back into the field. Read more
Source§

#[doc(hidden)]
const REBUILDS: bool = false

Whether a pointer of this type that this version of its crate saved is rebuilt on first use after readRDS(), by Self::__mx_rebuild, instead of refused. Read more
Source§

#[doc(hidden)]
const REBUILDS_ANY_VERSION: bool = false

Whether Self::__mx_rebuild also rebuilds a pointer another version of the crate saved, when the save carries slot names. #[derive(ExternalPtr)] sets it with any_version next to rebuild = path (#2187).
Source§

#[doc(hidden)]
fn __mx_rebuild(saved: &Saved<'_, Self>) -> Result<Self, RCondition>
where Self: Sized,

Rebuilds the value of a pointer of this type restored from a saved session, from what the save kept. #[derive(ExternalPtr)] emits it for #[externalptr(rebuild = path)]: it calls path and turns its Err into a condition.

Auto Trait Implementations§

§

impl<T> Freeze for AltrepBuffer<T>
where Vec<T>: Freeze, Vec<Vec<T>>: Freeze,

§

impl<T> RefUnwindSafe for AltrepBuffer<T>

§

impl<T> Send for AltrepBuffer<T>
where Vec<T>: Send, Vec<Vec<T>>: Send,

§

impl<T> Sync for AltrepBuffer<T>
where Vec<T>: Sync, Vec<Vec<T>>: Sync,

§

impl<T> Unpin for AltrepBuffer<T>
where Vec<T>: Unpin, Vec<Vec<T>>: Unpin,

§

impl<T> UnsafeUnpin for AltrepBuffer<T>
where Vec<T>: UnsafeUnpin, Vec<Vec<T>>: UnsafeUnpin,

§

impl<T> UnwindSafe for AltrepBuffer<T>
where Vec<T>: UnwindSafe, Vec<Vec<T>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> AltrepExtract for T
where T: TypedExternal,

Source§

unsafe fn altrep_extract_ref(x: SEXP) -> &'static T

Extract a shared reference from the ALTREP data1 slot. Read more
Source§

unsafe fn altrep_extract_mut(x: SEXP) -> &'static mut T

Extract a mutable reference from the ALTREP data1 slot. Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConsumingFallible for T
where T: Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRAltrep for T

Source§

fn into_sexp_altrep(self) -> SEXP

Convert to R SEXP using ALTREP zero-copy representation. Read more
Source§

unsafe fn into_sexp_altrep_unchecked(self) -> SEXP

Convert to R SEXP using ALTREP, skipping debug thread assertions. Read more
Source§

fn into_altrep(self) -> Altrep<Self>
where Self: Sized,

Create an Altrep<Self> wrapper. Read more
Source§

impl<T> RClone for T
where T: Clone,

Source§

fn r_clone(&self) -> T

Create a deep copy of this value.
Source§

#[doc(hidden)]
unsafe extern "C" fn __RClone_r_clone_shim( data: *mut c_void, argc: i32, argv: *const SEXP, ) -> SEXP
where Self: Sized + RClone + IntoR,

Method shim for RClone::r_clone. Read more
Source§

impl<T> RDebug for T
where T: Debug,

Source§

fn debug_str(&self) -> String

Get a compact debug string representation.
Source§

fn debug_str_pretty(&self) -> String

Get a pretty-printed debug string with indentation.
Source§

#[doc(hidden)]
unsafe extern "C" fn __RDebug_debug_str_shim( data: *mut c_void, argc: i32, argv: *const SEXP, ) -> SEXP
where Self: Sized + RDebug,

Method shim for RDebug::debug_str. Read more
Source§

#[doc(hidden)]
unsafe extern "C" fn __RDebug_debug_str_pretty_shim( data: *mut c_void, argc: i32, argv: *const SEXP, ) -> SEXP
where Self: Sized + RDebug,

Method shim for RDebug::debug_str_pretty. Read more
Source§

impl<T> SizeHint for T
where T: ?Sized,

Source§

default fn lower_bound(&self) -> usize

🔬This is a nightly-only experimental API. (core_io_internals)
Returns a lower bound on the number of elements this container-like item contains. For example, an array [u8; 12] could return any value between 0 and 12 inclusively as a correct implementation. Read more
Source§

default fn upper_bound(&self) -> Option<usize>

🔬This is a nightly-only experimental API. (core_io_internals)
Returns an upper bound on the number of elements this container-like item contains if it can be determined, otherwise None. Read more
Source§

final fn size_hint(&self) -> (usize, Option<usize>)

🔬This is a nightly-only experimental API. (core_io_internals)
Returns an estimate for the number of elements this container like type contains. Read more
Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)]
const SIZE: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGNMENT: Alignment = _

🔬This is a nightly-only experimental API. (ptr_alignment_type)
Source§

#[doc(hidden)]
const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)]
const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const MAX_SLICE_LEN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
The largest safe length for a [Self]. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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