MapPos

Trait MapPos 

Source
pub trait MapPos<Item, P: PosT, const WORDS: usize, const SIZE: usize> {
    // Required methods
    fn new(item: Item) -> Self;
    fn get(&self, pos: &P) -> &Item;
    fn set(&mut self, pos: P, item: Item);
}
Expand description

Trait that abstracts maps with super::pos::Pos indexes

The generic parameters allow us to support implementing Grid.

Required Methods§

Source

fn new(item: Item) -> Self

Create a new MapPos with the provided value for all items

Source

fn get(&self, pos: &P) -> &Item

Get the item corresponding to the provided super::pos::Pos

Source

fn set(&mut self, pos: P, item: Item)

Set the item corresponding to the provided super::pos::Pos

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<Item, P, const WORDS: usize, const SIZE: usize> MapPos<Item, P, WORDS, SIZE> for (BTreeMap<P, Item>, Item)
where P: Ord + PosT,

Source§

fn new(item: Item) -> Self

Source§

fn get(&self, pos: &P) -> &Item

Source§

fn set(&mut self, pos: P, item: Item)

Source§

impl<Item, P, const WORDS: usize, const SIZE: usize> MapPos<Item, P, WORDS, SIZE> for (HashMap<P, Item>, Item)
where P: Eq + Hash + PosT,

Source§

fn new(item: Item) -> Self

Source§

fn get(&self, pos: &P) -> &Item

Source§

fn set(&mut self, pos: P, item: Item)

Implementors§

Source§

impl<Item, P: PosT, const WORDS: usize, const SIZE: usize> MapPos<Item, P, WORDS, SIZE> for Grid<Item, P, SIZE>
where Item: Copy,