pub struct Map(/* private fields */);Expand description
A collection of key-value pairs.
Implementations§
source§impl Map
impl Map
sourcepub fn from_iterator(
vm: &mut VmContext<'_, '_>,
iter: impl IntoIterator<Item = (Value, Value)>,
) -> Self
pub fn from_iterator( vm: &mut VmContext<'_, '_>, iter: impl IntoIterator<Item = (Value, Value)>, ) -> Self
Creates a map from an iterator of key-value pairs.
sourcepub fn get(
&self,
vm: &mut VmContext<'_, '_>,
key: &Value,
) -> Result<Option<Value>, Fault>
pub fn get( &self, vm: &mut VmContext<'_, '_>, key: &Value, ) -> Result<Option<Value>, Fault>
Returns the value contained for key, or None if this map does not
contain key.
§Errors
This function does not directly return any errors, but comparing values can result in runtime errors.
sourcepub fn nth(
&self,
index: &Value,
guard: &CollectionGuard<'_>,
) -> Result<Value, Fault>
pub fn nth( &self, index: &Value, guard: &CollectionGuard<'_>, ) -> Result<Value, Fault>
Returns the value contained at index.
§Errors
Returns Fault::OutOfBounds if index is out of bounds of this
collection.
Trait Implementations§
source§impl CustomType for Map
impl CustomType for Map
Auto Trait Implementations§
impl !Freeze for Map
impl !RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more