Trait sqrid::mappos::MapPos

source ·
pub trait MapPos<Item, const W: u16, const H: u16, const WORDS: usize, const SIZE: usize> {
    // Required methods
    fn new(item: Item) -> Self;
    fn get(&self, pos: &Pos<W, H>) -> &Item;
    fn set(&mut self, pos: Pos<W, H>, item: Item);
}
Expand description

Trait that abstracts maps with 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: &Pos<W, H>) -> &Item

Get the item corresponding to the provided Pos

source

fn set(&mut self, pos: Pos<W, H>, item: Item)

Set the item corresponding to the provided Pos

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<Item, const W: u16, const H: u16, const WORDS: usize, const SIZE: usize> MapPos<Item, W, H, WORDS, SIZE> for (BTreeMap<Pos<W, H>, Item>, Item)

source§

fn new(item: Item) -> Self

source§

fn get(&self, pos: &Pos<W, H>) -> &Item

source§

fn set(&mut self, pos: Pos<W, H>, item: Item)

source§

impl<Item, const W: u16, const H: u16, const WORDS: usize, const SIZE: usize> MapPos<Item, W, H, WORDS, SIZE> for (HashMap<Pos<W, H>, Item>, Item)

source§

fn new(item: Item) -> Self

source§

fn get(&self, pos: &Pos<W, H>) -> &Item

source§

fn set(&mut self, pos: Pos<W, H>, item: Item)

Implementors§

source§

impl<Item, const W: u16, const H: u16, const WORDS: usize, const SIZE: usize> MapPos<Item, W, H, WORDS, SIZE> for Grid<Item, W, H, SIZE>
where Item: Copy,