Enum implicit_clone::unsync::IMap  
source · pub enum IMap<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> {
    Static(&'static [(K, V)]),
    Rc(Rc<Map<K, V>>),
}map only.Expand description
An immutable hash map type inspired by Immutable.js.
This type is cheap to clone and thus implements ImplicitClone. It can be created based on a
&'static [(K, V)], or based on a reference counted
IndexMap.
This type has the least stable API at the moment and is subject to change a lot before the 1.0 release.
Variants§
Implementations§
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> IMap<K, V>
sourcepub fn iter(&self) -> IMapIter<'_, K, V> ⓘ
 
pub fn iter(&self) -> IMapIter<'_, K, V> ⓘ
Return an iterator over the key-value pairs of the map, in their order.
sourcepub fn keys(&self) -> IMapKeys<'_, K, V> ⓘ
 
pub fn keys(&self) -> IMapKeys<'_, K, V> ⓘ
Return an iterator over the keys of the map, in their order.
sourcepub fn values(&self) -> IMapValues<'_, K, V> ⓘ
 
pub fn values(&self) -> IMapValues<'_, K, V> ⓘ
Return an iterator over the values of the map, in their order.
sourcepub fn len(&self) -> usize
 
pub fn len(&self) -> usize
Return the number of key-value pairs in the map.
Computes in O(1) time.
sourcepub fn is_empty(&self) -> bool
 
pub fn is_empty(&self) -> bool
Returns true if the map contains no elements.
Computes in O(1) time.
sourcepub fn get<Q>(&self, key: &Q) -> Option<V>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
 
pub fn get<Q>(&self, key: &Q) -> Option<V>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
Return a clone to the value stored for key, if it is present,
else None.
Computes in O(1) time (average).
sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(K, V)>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
 
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(K, V)>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
Return clones to the key-value pair stored for key,
if it is present, else None.
Computes in O(1) time (average).
sourcepub fn get_full<Q>(&self, key: &Q) -> Option<(usize, K, V)>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
 
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, K, V)>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
Return item index, key and value
sourcepub fn get_index(&self, index: usize) -> Option<(K, V)>
 
pub fn get_index(&self, index: usize) -> Option<(K, V)>
Get a key-value pair by index.
Valid indices are 0 <= index < self.len()
Computes in O(1) time.
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
 
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
    K: Borrow<Q>,
    Q: Hash + Eq + ?Sized,
Return item index, if it exists in the map.
Computes in O(1) time (average).
Trait Implementations§
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> Clone for IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> Clone for IMap<K, V>
source§impl<K: Debug + Eq + Hash + ImplicitClone + 'static, V: Debug + PartialEq + ImplicitClone + 'static> Debug for IMap<K, V>
 
impl<K: Debug + Eq + Hash + ImplicitClone + 'static, V: Debug + PartialEq + ImplicitClone + 'static> Debug for IMap<K, V>
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> Default for IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> Default for IMap<K, V>
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> From<&'static [(K, V)]> for IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> From<&'static [(K, V)]> for IMap<K, V>
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> From<IndexMap<K, V, RandomState>> for IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> From<IndexMap<K, V, RandomState>> for IMap<K, V>
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> From<Rc<IndexMap<K, V, RandomState>>> for IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> From<Rc<IndexMap<K, V, RandomState>>> for IMap<K, V>
source§impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> FromIterator<(K, V)> for IMap<K, V>
 
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> FromIterator<(K, V)> for IMap<K, V>
source§impl<K: PartialEq + Eq + Hash + ImplicitClone + 'static, V: PartialEq + PartialEq + ImplicitClone + 'static> PartialEq<IMap<K, V>> for IMap<K, V>
 
impl<K: PartialEq + Eq + Hash + ImplicitClone + 'static, V: PartialEq + PartialEq + ImplicitClone + 'static> PartialEq<IMap<K, V>> for IMap<K, V>
impl<K: Eq + Eq + Hash + ImplicitClone + 'static, V: Eq + PartialEq + ImplicitClone + 'static> Eq for IMap<K, V>
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> ImplicitClone for IMap<K, V>
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> StructuralEq for IMap<K, V>
impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> StructuralPartialEq for IMap<K, V>
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for IMap<K, V>where
    K: RefUnwindSafe,
    V: RefUnwindSafe,
impl<K, V> !Send for IMap<K, V>
impl<K, V> !Sync for IMap<K, V>
impl<K, V> Unpin for IMap<K, V>
impl<K, V> UnwindSafe for IMap<K, V>where
    K: RefUnwindSafe,
    V: RefUnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,
 
impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.