[−][src]Struct boa::builtins::map::ordered_map::OrderedMap
A newtype wrapping indexmap::IndexMap
Implementations
impl<K, V> OrderedMap<K, V> where
K: Hash + Eq,
[src]
K: Hash + Eq,
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]
K: Hash + Eq,
pub fn clone(&self) -> OrderedMap<K, V, S>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
K: Hash + Eq,
S: BuildHasher,
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?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, K, V, S> IntoIterator for &'a mut OrderedMap<K, V, S> where
K: Hash + Eq,
S: BuildHasher,
[src]
K: Hash + Eq,
S: BuildHasher,
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?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<K, V, S> IntoIterator for OrderedMap<K, V, S> where
K: Hash + Eq,
S: BuildHasher,
[src]
K: Hash + Eq,
S: BuildHasher,
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?
pub fn into_iter(self) -> IntoIter<K, V>
[src]
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]
K: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, S> Send for OrderedMap<K, V, S> where
K: Send,
S: Send,
V: Send,
[src]
K: Send,
S: Send,
V: Send,
impl<K, V, S> Sync for OrderedMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,
[src]
K: Sync,
S: Sync,
V: Sync,
impl<K, V, S> Unpin for OrderedMap<K, V, S> where
K: Unpin,
S: Unpin,
V: Unpin,
[src]
K: Unpin,
S: Unpin,
V: Unpin,
impl<K, V, S> UnwindSafe for OrderedMap<K, V, S> where
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
[src]
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> NativeObject for T where
T: Any + Debug + Trace,
[src]
T: Any + Debug + Trace,
pub fn as_any(&Self) -> &(dyn Any + 'static)
[src]
pub fn as_mut_any(&mut Self) -> &mut (dyn Any + 'static)
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,