Trait Object

Source
pub trait Object {
    // Required method
    fn typename(&self) -> &str;

    // Provided methods
    fn get(&self, key: &str) -> Option<Value> { ... }
    fn set(&self, key: &str, val: Value) { ... }
}
Expand description

If you want to expose your own structs to Hatter code, this is the trait for you.

Required Methods§

Source

fn typename(&self) -> &str

String name of this type, like “string” or “Person”.

Provided Methods§

Source

fn get(&self, key: &str) -> Option<Value>

obj.KEY

Source

fn set(&self, key: &str, val: Value)

obj.KEY = VAL

Implementors§