Trait View

Source
pub trait View: Sized {
    type Item;
    type View: View;

    // Required methods
    fn region(&self) -> Region;
    fn get(&self, rank: usize) -> Option<Self::Item>;
    fn subset(&self, region: Region) -> Result<Self::View, ViewError>;
}
Expand description

A View is a collection of items in a space indexed by a Region.

Required Associated Types§

Source

type Item

The type of item in this view.

Source

type View: View

The type of sub-view produced by manipulating (e.g., slicing) this view.

Required Methods§

Source

fn region(&self) -> Region

The ranks contained in this view.

Source

fn get(&self, rank: usize) -> Option<Self::Item>

Retrieve the item corresponding to the given rank in the Region of this view. An implementation MUST return a value for all ranks defined in this view.

Source

fn subset(&self, region: Region) -> Result<Self::View, ViewError>

Subsets this view with the provided ranks. This is mainly used by combinators on Views themselves. The set of ranks passed in must be a subset of the ranks of the base view.

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§

Source§

impl View for Extent

An Extent is also a View.

Source§

impl View for Region

A Region is also a View.

Source§

impl<T: RankedSliceable> View for T
where T::Item: Clone + 'static,

Source§

type Item = <T as Ranked>::Item

Source§

type View = T