Struct runestick::Object [−][src]
#[repr(transparent)]pub struct Object { /* fields omitted */ }
Expand description
Struct representing a dynamic anonymous object.
Examples
let mut object = runestick::Object::new(); assert!(object.is_empty()); object.insert_value(String::from("foo"), 42)?; object.insert_value(String::from("bar"), true)?; assert_eq!(2, object.len()); assert_eq!(Some(42), object.get_value("foo")?); assert_eq!(Some(true), object.get_value("bar")?); assert_eq!(None::<bool>, object.get_value("baz")?);
Implementations
Construct a new object with the given capacity.
Returns a reference to the value corresponding to the key.
Get the given value at the given index.
Returns a mutable reference to the value corresponding to the key.
Returns true
if the map contains a value for the specified key.
Removes a key from the object, returning the value at the key if the key was previously in the object.
Inserts a key-value pair into the dynamic object, converting it as
necessary through the ToValue
trait.
Inserts a key-value pair into the dynamic object.
Clears the object, removing all key-value pairs. Keeps the allocated memory for reuse.
Convert into inner.
An iterator visiting all key-value pairs in arbitrary order.
The iterator element type is (&'a String, &'a Value)
.
An iterator visiting all keys in arbitrary order.
The iterator element type is &'a String
.
An iterator visiting all values in arbitrary order.
The iterator element type is &'a Value
.
An iterator visiting all key-value pairs in arbitrary order,
with mutable references to the values.
The iterator element type is (&'a String, &'a mut Value)
.
Convert into a runestick iterator.
Trait Implementations
Try to convert to the given type, from the given value.
Hook to install more things into the module.
Creates a consuming iterator, that is, one that moves each key-value pair out of the object in arbitrary order. The object cannot be used after calling this.
Auto Trait Implementations
impl !RefUnwindSafe for Object
impl !UnwindSafe for Object
Blanket Implementations
Mutably borrows from an owned value. Read more