rune::modules::object

Function module

Source
pub fn module() -> Result<Module, ContextError>
Expand description

The dynamic Object container.

This modules contains the Object type, which is a dynamic type erased container.

Objects in Rune are declared using the special #{} syntax, but can also be interacted with through the fundamental Object type.

Fields can be added to objects “on the fly”, simply by assigning to them:

let object = #{};
object.hello = "World";
assert_eq!(object.hello, "World");

§Examples

let object1 = #{hello: "World"};

let object2 = Object::new();
object2.insert("hello", "World");

assert_eq!(object1, object2);