FixedSizeFlatMap

Struct FixedSizeFlatMap 

Source
pub struct FixedSizeFlatMap<K: Eq, V: Clone, const CAPACITY: usize> { /* private fields */ }
Expand description

A compile-time fixed-size, shared-memory compatible FixedSizeFlatMap.

Implementations§

Source§

impl<K: Eq, V: Clone, const CAPACITY: usize> FixedSizeFlatMap<K, V, CAPACITY>

Source

pub fn new() -> Self

Creates a new FixedSizeFlatMap

Source

pub fn insert(&mut self, id: K, value: V) -> Result<(), FlatMapError>

Inserts a new key-value pair into the FixedSizeFlatMap. On success, the method returns Ok, otherwise a FlatMapError describing the failure.

Source

pub fn get(&self, id: &K) -> Option<V>

Returns a copy of the value corresponding to the given key. If there is no such key, None is returned.

Source

pub fn get_ref(&self, id: &K) -> Option<&V>

Returns a reference to the value corresponding to the given key. If there is no such key, None is returned.

Source

pub fn get_mut_ref(&mut self, id: &K) -> Option<&mut V>

Returns a mutable reference to the value corresponding to the given key. If there is no such key, None is returned.

Source

pub fn remove(&mut self, id: &K) -> Option<V>

Removes a key (id) from the FixedSizeFlatMap, returning the Some(value) at the key if the key was previously in the map or None otherwise.

Source

pub fn is_empty(&self) -> bool

Returns true if the FixedSizeFlatMap is empty, otherwise false.

Source

pub fn is_full(&self) -> bool

Returns true if the FixedSizeFlatMap is full, otherwise false.

Source

pub fn contains(&self, id: &K) -> bool

Returns true if the FixedSizeFlatMap contains the given key, otherwise false.

Source

pub fn len(&self) -> usize

Returns the number of stored key-value pairs.

Source

pub fn list_keys<F: FnMut(&K) -> CallbackProgression>(&self, callback: F)

Iterates over all keys of the map and calls the provided callback.

Trait Implementations§

Source§

impl<K: Eq + Debug, V: Clone + Debug, const CAPACITY: usize> Debug for FixedSizeFlatMap<K, V, CAPACITY>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: Eq, V: Clone, const CAPACITY: usize> Default for FixedSizeFlatMap<K, V, CAPACITY>

Source§

fn default() -> Self

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

impl<K: Eq, V: Clone, const CAPACITY: usize> PlacementDefault for FixedSizeFlatMap<K, V, CAPACITY>

Source§

unsafe fn placement_default(ptr: *mut Self)

Performs a initialization of Self at the provided memory position with Default::default(). Read more
Source§

impl<K: Eq + ZeroCopySend, V: Clone + ZeroCopySend, const CAPACITY: usize> ZeroCopySend for FixedSizeFlatMap<K, V, CAPACITY>

Source§

unsafe fn type_name() -> &'static str

The unique identifier of the type. It shall be used to identify a specific type across processes and languages. Read more

Auto Trait Implementations§

§

impl<K, V, const CAPACITY: usize> !Freeze for FixedSizeFlatMap<K, V, CAPACITY>

§

impl<K, V, const CAPACITY: usize> RefUnwindSafe for FixedSizeFlatMap<K, V, CAPACITY>

§

impl<K, V, const CAPACITY: usize> Send for FixedSizeFlatMap<K, V, CAPACITY>
where K: Send, V: Send,

§

impl<K, V, const CAPACITY: usize> Sync for FixedSizeFlatMap<K, V, CAPACITY>
where K: Sync, V: Sync,

§

impl<K, V, const CAPACITY: usize> Unpin for FixedSizeFlatMap<K, V, CAPACITY>
where K: Unpin, V: Unpin,

§

impl<K, V, const CAPACITY: usize> UnwindSafe for FixedSizeFlatMap<K, V, CAPACITY>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.