pub struct DynamicObject { /* private fields */ }Expand description
A bag of named Object values.
For values whose shape is decided entirely at runtime, such as objects in a dynamically typed language.
Implementations§
Source§impl DynamicObject
impl DynamicObject
Sourcepub fn get_mut(&mut self, name: &str) -> Option<&mut Object>
pub fn get_mut(&mut self, name: &str) -> Option<&mut Object>
Borrows a property mutably by name.
Sourcepub fn set(&mut self, name: impl ToString, value: Object)
pub fn set(&mut self, name: impl ToString, value: Object)
Sets a property, replacing anything already there.
Sourcepub fn drain(&mut self) -> impl Iterator<Item = (String, Object)>
pub fn drain(&mut self) -> impl Iterator<Item = (String, Object)>
Removes and yields every property.
Sourcepub fn properties(&self) -> impl Iterator<Item = (&str, &Object)>
pub fn properties(&self) -> impl Iterator<Item = (&str, &Object)>
Iterates names and values.
Sourcepub fn properties_mut(&mut self) -> impl Iterator<Item = (&str, &mut Object)>
pub fn properties_mut(&mut self) -> impl Iterator<Item = (&str, &mut Object)>
Iterates names and values mutably.
Sourcepub fn property_names(&self) -> impl Iterator<Item = &str>
pub fn property_names(&self) -> impl Iterator<Item = &str>
Iterates property names.
Sourcepub fn property_values(&self) -> impl Iterator<Item = &Object>
pub fn property_values(&self) -> impl Iterator<Item = &Object>
Iterates property values.
Sourcepub fn property_values_mut(&mut self) -> impl Iterator<Item = &mut Object>
pub fn property_values_mut(&mut self) -> impl Iterator<Item = &mut Object>
Iterates property values mutably.
Trait Implementations§
Source§impl Default for DynamicObject
impl Default for DynamicObject
Source§fn default() -> DynamicObject
fn default() -> DynamicObject
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Send for DynamicObject
impl !Sync for DynamicObject
impl Freeze for DynamicObject
impl RefUnwindSafe for DynamicObject
impl Unpin for DynamicObject
impl UnsafeUnpin for DynamicObject
impl UnwindSafe for DynamicObject
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
Source§impl<T> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere
T: Default,
Source§fn initialize() -> T
fn initialize() -> T
Returns the initial value of this type.