[][src]Trait higher_order_functions::Section

pub trait Section<TOffset, TOut> {
    fn section(&self, offset: TOffset) -> TOut;
}

Operator to retrieve a fixed-size section of an array-like structure.

Examples

Extracting elements from an array:

use higher_order_functions::Section;

let a: [u32; 8] = [1, 2, 3, 4, 5, 6, 7, 8];

let arr: [u32; 4] = a.section(3); // Extracts 4 elements starting at a[3]

assert_eq!(arr, [4, 5, 6, 7]);

Required methods

fn section(&self, offset: TOffset) -> TOut

Get a section of type TOut starting at offset offset.

Panics

Implementors may panic if offset results in the section going out of bounds.

Loading content...

Implementations on Foreign Types

impl<T: Copy, const N: usize, const N_OUT: usize> Section<usize, [T; N_OUT]> for [T; N][src]

Get a sized slice of an array.

Panics

Panics if N_OUT + offset > N.

Loading content...

Implementors

Loading content...