extendr_api::wrapper::altrep

Trait AltrepImpl

Source
pub trait AltrepImpl: Clone + Debug {
    // Required method
    fn length(&self) -> usize;

    // Provided methods
    fn unserialize(_class: Robj, _state: Robj) -> Robj { ... }
    fn serialized_state(_x: SEXP) -> Robj { ... }
    fn duplicate_ex(x: SEXP, deep: bool) -> Robj { ... }
    fn duplicate(x: SEXP, _deep: bool) -> Robj { ... }
    fn coerce(_x: SEXP, _ty: Rtype) -> Robj { ... }
    fn inspect(&self, _pre: i32, _deep: bool, _pvec: i32) -> bool { ... }
    fn dataptr(x: SEXP, _writeable: bool) -> *mut u8 { ... }
    fn dataptr_or_null(x: SEXP) -> *const u8 { ... }
    fn extract_subset(_x: Robj, _indx: Robj, _call: Robj) -> Robj { ... }
}
Expand description

Rust trait for implementing ALTREP. Implement one or more of these methods to generate an Altrep class. This is likely to be unstable for a while.

Required Methods§

Source

fn length(&self) -> usize

Get the virtual length of the vector. For example for a compact range, return end - start + 1.

Provided Methods§

Source

fn unserialize(_class: Robj, _state: Robj) -> Robj

Simplified constructor that is called when loading an Altrep object from a file.

Source

fn serialized_state(_x: SEXP) -> Robj

Fetch the state of this object when writing to a file.

Source

fn duplicate_ex(x: SEXP, deep: bool) -> Robj

Duplicate this object, possibly duplicating attributes. Currently this manifests the array but preserves the original object.

Source

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

Duplicate this object. Called by Rf_duplicate. Currently this manifests the array but preserves the original object.

Source

fn coerce(_x: SEXP, _ty: Rtype) -> Robj

Coerce this object into some other type, if possible.

Source

fn inspect(&self, _pre: i32, _deep: bool, _pvec: i32) -> bool

Print the text for .Internal(inspect(obj))

Source

fn dataptr(x: SEXP, _writeable: bool) -> *mut u8

Get the data pointer for this vector, possibly expanding the compact representation into a full R vector.

Source

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

Get the data pointer for this vector, returning NULL if the object is unmaterialized.

Source

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

Implement subsetting (eg. x[10:19]) for this Altrep vector.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§