Struct abstutil::FixedMap[][src]

pub struct FixedMap<K: IndexableKey, V> {
    inner: Vec<Option<V>>,
    key_type: PhantomData<K>,
}

A drop-in replacement for BTreeMap, where the keys have the property of being array indices. Some values may be missing. Much more efficient at operations on individual objects, because it just becomes a simple array lookup.

Fields

inner: Vec<Option<V>>key_type: PhantomData<K>

Implementations

impl<K: IndexableKey, V> FixedMap<K, V>[src]

pub fn new() -> FixedMap<K, V>[src]

pub fn insert(&mut self, key: K, value: V)[src]

pub fn get(&self, key: &K) -> Option<&V>[src]

pub fn get_mut(&mut self, key: &K) -> Option<&mut V>[src]

pub fn contains_key(&self, key: &K) -> bool[src]

pub fn remove(&mut self, key: &K) -> Option<V>[src]

pub fn values(&self) -> Flatten<Iter<'_, Option<V>>>[src]

Trait Implementations

impl<K: Clone + IndexableKey, V: Clone> Clone for FixedMap<K, V>[src]

impl<K: IndexableKey, V> Default for FixedMap<K, V>[src]

impl<'de, K: IndexableKey, V> Deserialize<'de> for FixedMap<K, V> where
    V: Deserialize<'de>, 
[src]

impl<K: IndexableKey, V> Index<&'_ K> for FixedMap<K, V>[src]

type Output = V

The returned type after indexing.

impl<K: IndexableKey, V> Serialize for FixedMap<K, V> where
    V: Serialize
[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for FixedMap<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for FixedMap<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for FixedMap<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for FixedMap<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for FixedMap<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.