pub struct Record<K: RecordKey, V> {
map: IndexMap<K, V>,
}
Expand description
The Record
(open-ended dictionary) type.
Fields§
§map: IndexMap<K, V>
Implementations§
Methods from Deref<Target = IndexMap<K, V>>§
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 iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Return an iterator over the key-value pairs of the map, in their order
sourcepub fn contains_key<Q>(&self, key: &Q) -> boolwhere
Q: Hash + Equivalent<K> + ?Sized,
pub fn contains_key<Q>(&self, key: &Q) -> boolwhere
Q: Hash + Equivalent<K> + ?Sized,
Return true
if an equivalent to key
exists in the map.
Computes in O(1) time (average).
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>where
Q: Hash + Equivalent<K> + ?Sized,
pub fn get<Q>(&self, key: &Q) -> Option<&V>where
Q: Hash + Equivalent<K> + ?Sized,
Return a reference 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
Q: Hash + Equivalent<K> + ?Sized,
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>where
Q: Hash + Equivalent<K> + ?Sized,
Return references 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
Q: Hash + Equivalent<K> + ?Sized,
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>where
Q: Hash + Equivalent<K> + ?Sized,
Return item index, key and value
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
Q: Hash + Equivalent<K> + ?Sized,
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
Q: Hash + Equivalent<K> + ?Sized,
Return item index, if it exists in the map
Trait Implementations§
source§impl<K, V, C> FromJSValConvertible for Record<K, V>where
K: RecordKey,
V: FromJSValConvertible<Config = C>,
C: Clone,
impl<K, V, C> FromJSValConvertible for Record<K, V>where
K: RecordKey,
V: FromJSValConvertible<Config = C>,
C: Clone,
source§unsafe fn from_jsval(
cx: *mut JSContext,
value: HandleValue<'_>,
config: C
) -> Result<ConversionResult<Self>, ()>
unsafe fn from_jsval(
cx: *mut JSContext,
value: HandleValue<'_>,
config: C
) -> Result<ConversionResult<Self>, ()>
Convert
val
to type Self
.
Optional configuration of type T
can be passed as the option
argument.
If it returns Err(())
, a JSAPI exception is pending.
If it returns Ok(Failure(reason))
, there is no pending JSAPI exception.source§impl<K, V> JSTraceable for Record<K, V>where
K: JSTraceable + RecordKey,
V: JSTraceable,
impl<K, V> JSTraceable for Record<K, V>where
K: JSTraceable + RecordKey,
V: JSTraceable,
source§impl<K, V> ToJSValConvertible for Record<K, V>where
K: RecordKey,
V: ToJSValConvertible,
impl<K, V> ToJSValConvertible for Record<K, V>where
K: RecordKey,
V: ToJSValConvertible,
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for Record<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Record<K, V>where
K: Send,
V: Send,
impl<K, V> Sync for Record<K, V>where
K: Sync,
V: Sync,
impl<K, V> Unpin for Record<K, V>where
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for Record<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> MaybeBoxed<Box<T, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
source§fn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert