Skip to main content

AltIntegerData

Trait AltIntegerData 

Source
pub trait AltIntegerData: AltrepLen {
    // Required method
    fn elt(&self, i: usize) -> i32;

    // Provided methods
    fn as_slice(&self) -> Option<&[i32]> { ... }
    fn get_region(&self, start: usize, len: usize, buf: &mut [i32]) -> usize { ... }
    fn is_sorted(&self) -> Option<Sortedness> { ... }
    fn no_na(&self) -> Option<bool> { ... }
    fn sum(&self, _na_rm: bool) -> Option<i64> { ... }
    fn min(&self, _na_rm: bool) -> Option<i32> { ... }
    fn max(&self, _na_rm: bool) -> Option<i32> { ... }
}
Expand description

Trait for types that can back an ALTINTEGER vector.

Implement this to create custom integer ALTREP classes.

Required Methods§

Source

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

Get the integer element at index i.

Provided Methods§

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.

Bounds are clamped to the vector length; see fill_region for the shared safety contract.

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).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AltIntegerData for &[i32]

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl AltIntegerData for Box<[i32]>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl AltIntegerData for Cow<'static, [i32]>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl AltIntegerData for Range<i32>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl AltIntegerData for Range<i64>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl AltIntegerData for Vec<i32>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<const N: usize> AltIntegerData for [i32; N]

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§