Skip to main content

Type

Trait Type 

Source
pub trait Type: Debug {
    // Required methods
    fn name(&self) -> &str;
    fn as_any(self: Rc<Self>) -> Rc<dyn Any>;
    fn new_instance(self: Rc<Self>) -> Rc<dyn Var>;

    // Provided methods
    fn full_name(&self) -> String { ... }
    fn as_class(self: Rc<Self>) -> Option<Rc<dyn Class>> { ... }
    fn as_predicate(self: Rc<Self>) -> Option<Rc<Predicate>> { ... }
}
Expand description

Runtime type abstraction used by the interpreter.

Implementors expose type identity, optional downcasts to richer kinds (class or predicate), and a way to create a default runtime instance.

Required Methods§

Source

fn name(&self) -> &str

Source

fn as_any(self: Rc<Self>) -> Rc<dyn Any>

Source

fn new_instance(self: Rc<Self>) -> Rc<dyn Var>

Provided Methods§

Source

fn full_name(&self) -> String

Source

fn as_class(self: Rc<Self>) -> Option<Rc<dyn Class>>

Source

fn as_predicate(self: Rc<Self>) -> Option<Rc<Predicate>>

Implementors§