pub struct Dict(/* private fields */);Expand description
A dictionary object mapping names to objects.
Implementations§
Source§impl Dict
impl Dict
Sourcepub fn get(&self, key: &str) -> Option<&Object>
pub fn get(&self, key: &str) -> Option<&Object>
Looks up a value by key (without the leading solidus).
Sourcepub fn insert(&mut self, key: Name, value: Object) -> Option<Object>
pub fn insert(&mut self, key: Name, value: Object) -> Option<Object>
Inserts a key/value pair, returning the previous value if any.
Sourcepub fn remove(&mut self, key: &str) -> Option<Object>
pub fn remove(&mut self, key: &str) -> Option<Object>
Removes a key, returning its value if present.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&Name, &Object)>
pub fn iter(&self) -> impl Iterator<Item = (&Name, &Object)>
Iterates over all key/value pairs (unordered).
Trait Implementations§
impl StructuralPartialEq for Dict
Auto Trait Implementations§
impl Freeze for Dict
impl RefUnwindSafe for Dict
impl Send for Dict
impl Sync for Dict
impl Unpin for Dict
impl UnsafeUnpin for Dict
impl UnwindSafe for Dict
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