Trait rune::Any

source ·
pub trait Any: Named + Any {
    // Required method
    fn type_hash() -> Hash;
}
Expand description

A trait which can be stored inside of an AnyObj.

We use our own marker trait that must be explicitly derived to prevent other VM native types (like strings) which also implement std::any::Any from being stored as an AnyObj.

This means, that only types which derive Any can be used inside of the VM:

use rune::Any;

#[derive(Any)]
struct Npc {
    name: String,
}

Required Methods§

source

fn type_hash() -> Hash

The type hash of the type.

TODO: make const field when TypeId::of is const.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Any for ParseCharError

source§

impl Any for Error

source§

impl Any for ParseFloatError

source§

impl Any for ParseIntError

source§

impl Any for Utf8Error

source§

impl Any for Error

source§

impl Any for Error

Implementors§