LinearMap

Type Alias LinearMap 

Source
pub type LinearMap<K, V, const N: usize> = LinearMapInner<K, V, OwnedStorage<K, V, N>>;
Expand description

A fixed capacity map/dictionary that performs lookups via linear search.

Note that as this map doesn’t use hashing so most operations are O(n) instead of O(1).

Aliased Type§

pub struct LinearMap<K, V, const N: usize> { /* private fields */ }

Implementations§

Source§

impl<K, V, const N: usize> LinearMap<K, V, N>

Source

pub const fn new() -> Self

Creates an empty LinearMap.

§Examples
use heapless::LinearMap;

// allocate the map on the stack
let mut map: LinearMap<&str, isize, 8> = LinearMap::new();

// allocate the map in a static variable
static mut MAP: LinearMap<&str, isize, 8> = LinearMap::new();

Trait Implementations§

Source§

impl<K, V, const N: usize> Clone for LinearMap<K, V, N>
where K: Eq + Clone, V: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K, V, const N: usize> Default for LinearMap<K, V, N>
where K: Eq,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K, V, const N: usize> FromIterator<(K, V)> for LinearMap<K, V, N>
where K: Eq,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
Source§

impl<K, V, const N: usize> IntoIterator for LinearMap<K, V, N>
where K: Eq,

Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<K, V, N>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more