Trait extendr_api::wrapper::altrep::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.

Object Safety§

This trait is not object safe.

Implementors§