Trait CustomType

Source
pub trait CustomType:
    'static
    + Send
    + Sync
    + Display
    + Debug
    + Any { }
Expand description

A trait that defines a value that can be created or referenced within the VM.

#[derive(Debug, Default)]
pub struct MyType(i64);
impl spore_vm::val::CustomType for MyType {}
impl std::fmt::Display for MyType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "my number is {}", self.0)
    }
}

Implementorsยง