[][src]Struct boa::builtins::map::ordered_map::OrderedMap

pub struct OrderedMap<K, V, S = RandomState>(_)
where
    K: Hash + Eq
;

A newtype wrapping indexmap::IndexMap

Implementations

impl<K, V> OrderedMap<K, V> where
    K: Hash + Eq
[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn len(&self) -> usize[src]

Return the number of key-value pairs in the map.

Computes in O(1) time.

pub fn is_empty(&self) -> bool[src]

Returns true if the map contains no elements.

Computes in O(1) time.

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

Insert a key-value pair in the map.

If an equivalent key already exists in the map: the key remains and retains in its place in the order, its corresponding value is updated with value and the older value is returned inside Some(_).

If no equivalent key existed in the map: the new key-value pair is inserted, last in order, and None is returned.

Computes in O(1) time (amortized average).

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

Remove the key-value pair equivalent to key and return its value.

Like Vec::remove, the pair is removed by shifting all of the elements that follow it, preserving their relative order. This perturbs the index of all of those elements!

Return None if key is not in map.

Computes in O(n) time (average).

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

Return a reference to the value stored for key, if it is present, else None.

Computes in O(1) time (average).

pub fn get_index(&self, index: usize) -> Option<(&K, &V)>[src]

Get a key-value pair by index Valid indices are 0 <= index < self.len() Computes in O(1) time.

pub fn iter(&self) -> Iter<'_, K, V>[src]

Return an iterator over the key-value pairs of the map, in their order

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

Return true if an equivalent to key exists in the map.

Computes in O(1) time (average).

Trait Implementations

impl<K: Clone, V: Clone, S: Clone> Clone for OrderedMap<K, V, S> where
    K: Hash + Eq
[src]

impl<K: Hash + Eq + Debug, V: Debug> Debug for OrderedMap<K, V>[src]

impl<K: Hash + Eq, V> Default for OrderedMap<K, V>[src]

impl<K: Eq + Hash + Trace, V: Trace, S: BuildHasher> Finalize for OrderedMap<K, V, S>[src]

impl<'a, K, V, S> IntoIterator for &'a OrderedMap<K, V, S> where
    K: Hash + Eq,
    S: BuildHasher
[src]

type Item = (&'a K, &'a V)

The type of the elements being iterated over.

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?

impl<'a, K, V, S> IntoIterator for &'a mut OrderedMap<K, V, S> where
    K: Hash + Eq,
    S: BuildHasher
[src]

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.

type IntoIter = IterMut<'a, K, V>

Which kind of iterator are we turning this into?

impl<K, V, S> IntoIterator for OrderedMap<K, V, S> where
    K: Hash + Eq,
    S: BuildHasher
[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?

impl<K: Eq + Hash + Trace, V: Trace, S: BuildHasher> Trace for OrderedMap<K, V, S>[src]

Auto Trait Implementations

impl<K, V, S> RefUnwindSafe for OrderedMap<K, V, S> where
    K: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe
[src]

impl<K, V, S> Send for OrderedMap<K, V, S> where
    K: Send,
    S: Send,
    V: Send
[src]

impl<K, V, S> Sync for OrderedMap<K, V, S> where
    K: Sync,
    S: Sync,
    V: Sync
[src]

impl<K, V, S> Unpin for OrderedMap<K, V, S> where
    K: Unpin,
    S: Unpin,
    V: Unpin
[src]

impl<K, V, S> UnwindSafe for OrderedMap<K, V, S> where
    K: UnwindSafe,
    S: UnwindSafe,
    V: UnwindSafe
[src]

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> From<T> for T[src]

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

impl<T> NativeObject for T where
    T: Any + Debug + Trace
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,