Trait sqrid::MapQa

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

Trait that abstracts maps with Qa indexes

The generic parameters allow us to support implementing Grid.

Required Methods§

source

fn new(item: Item) -> Self

Create a new MapQa with the provided value for all items

source

fn get(&self, qa: &Qa<W, H>) -> &Item

Get the item corresponding to the provided Qa

source

fn set(&mut self, qa: Qa<W, H>, item: Item)

Set the item corresponding to the provided Qa

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> MapQa<Item, W, H, WORDS, SIZE> for (BTreeMap<Qa<W, H>, Item>, Item)

source§

fn new(item: Item) -> Self

source§

fn get(&self, qa: &Qa<W, H>) -> &Item

source§

fn set(&mut self, qa: Qa<W, H>, item: Item)

source§

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

source§

fn new(item: Item) -> Self

source§

fn get(&self, qa: &Qa<W, H>) -> &Item

source§

fn set(&mut self, qa: Qa<W, H>, item: Item)

Implementors§

source§

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