JaggedIndexer

pub trait JaggedIndexer:
    Clone
    + PseudoDefault
    + Send
    + Sync {
    // Required methods
    unsafe fn jagged_index_unchecked<'a, T>(
        &self,
        arrays: &impl Slices<'a, T>,
        flat_index: usize,
    ) -> JaggedIndex
       where T: 'a;
    unsafe fn jagged_index_unchecked_from_slice<'a, T>(
        &self,
        arrays: &[impl AsRawSlice<T>],
        flat_index: usize,
    ) -> JaggedIndex
       where T: 'a;
}
Expand description

An indexer for the raw jagged arrays.

Required Methods§

Source

unsafe fn jagged_index_unchecked<'a, T>( &self, arrays: &impl Slices<'a, T>, flat_index: usize, ) -> JaggedIndex
where T: 'a,

Returns the jagged index of the element flat_index-th position if the raw jagged array defined by the arrays collection would have been flattened.

Unlike jagged_index, this method expects flat_index <= arrays.iter().map(|x| x.len()).sum(), and omits bounds checks.

§SAFETY

Calling this method with an index greater than the total length of the jagged array might possibly lead to undefined behavior.

Source

unsafe fn jagged_index_unchecked_from_slice<'a, T>( &self, arrays: &[impl AsRawSlice<T>], flat_index: usize, ) -> JaggedIndex
where T: 'a,

Returns the jagged index of the element flat_index-th position if the raw jagged array defined by the arrays collection would have been flattened.

Unlike jagged_index, this method expects flat_index <= arrays.iter().map(|x| x.len()).sum(), and omits bounds checks.

§SAFETY

Calling this method with an index greater than the total length of the jagged array might possibly lead to undefined behavior.

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.

Implementations on Foreign Types§

Source§

impl JaggedIndexer for Doubling

Source§

unsafe fn jagged_index_unchecked<'a, T>( &self, _: &impl Slices<'a, T>, flat_index: usize, ) -> JaggedIndex
where T: 'a,

Source§

unsafe fn jagged_index_unchecked_from_slice<'a, T>( &self, _: &[impl AsRawSlice<T>], flat_index: usize, ) -> JaggedIndex
where T: 'a,

Source§

impl JaggedIndexer for Linear

Source§

unsafe fn jagged_index_unchecked<'a, T>( &self, _: &impl Slices<'a, T>, flat_index: usize, ) -> JaggedIndex
where T: 'a,

Source§

unsafe fn jagged_index_unchecked_from_slice<'a, T>( &self, _: &[impl AsRawSlice<T>], flat_index: usize, ) -> JaggedIndex
where T: 'a,

Source§

impl JaggedIndexer for Recursive

Source§

unsafe fn jagged_index_unchecked<'a, T>( &self, arrays: &impl Slices<'a, T>, flat_index: usize, ) -> JaggedIndex
where T: 'a,

Source§

unsafe fn jagged_index_unchecked_from_slice<'a, T>( &self, arrays: &[impl AsRawSlice<T>], flat_index: usize, ) -> JaggedIndex
where T: 'a,

Implementors§