Skip to main content

Module altrep_helpers

Module altrep_helpers 

Source
Expand description

ALTREP helpers for ExternalPtr — data1/data2 slot access.

Convenience functions for ALTREP implementations that store their data in ExternalPtr slots. Also provides the Sidecar marker type for #[r_data] fields.

Re-exports§

use super::ErasedExternalPtr; 🔒
use super::ExternalPtr; 🔒
use super::TypedExternal; 🔒
use crate::SEXP; 🔒

Structs§

Computed
Marker type of a read-only R field computed from the Rust value (#1883).
ComputedProbe 👻
The autoref probe of a computed getter’s value V. The generated getter calls (&&&ComputedProbe::of(&value)).__mx_computed_read(value) with the three traits in scope; method lookup tries the receiver &&&ComputedProbe<V> first, so the impl on the deepest reference that fits V wins: ComputedReadNull for Result<T, ()>, then ComputedReadResult for any Result<T, E>, then ComputedReadValue for anything else.
RSidecar
Marker type for enabling R sidecar accessors in an ExternalPtr struct.

Enums§

ComputedRead 👻
What a computed field’s getter gave, as the generated getter reads it. Sorted by the autoref probe on ComputedProbe, since the derive sees the getter’s path, not its return type.

Traits§

ComputedReadNull 👻
First arm: Result<T, ()>, whose Err(()) reads NULL.
ComputedReadResult 👻
Second arm: any other Result<T, E>, whose Err is raised.
ComputedReadValue 👻
Last arm: any other value, read as it is.

Functions§

altrep_data1_as⚠
Extract the ALTREP data1 slot as a typed ExternalPtr<T>.
altrep_data1_as_unchecked⚠
Extract the ALTREP data1 slot (unchecked version).
altrep_data1_mut⚠
Get a mutable reference to data in ALTREP data1 slot via ErasedExternalPtr.
altrep_data1_mut_unchecked⚠
Get a mutable reference to data in ALTREP data1 slot (unchecked version).
altrep_data2_as⚠
Extract the ALTREP data2 slot as a typed ExternalPtr<T>.
altrep_data2_as_unchecked⚠
Extract the ALTREP data2 slot (unchecked version).
data1_value_mut 🔒 ⚠
The T that erased holds, with no RefCell borrow.