[][src]Trait artichoke_backend::class_registry::ClassRegistry

pub trait ClassRegistry {
    pub fn def_class<T>(&mut self, spec: Spec) -> Result<(), Error>
    where
        T: Any
;
pub fn class_spec<T>(&self) -> Result<Option<&Spec>, Error>
    where
        T: Any
;
pub fn class_of<T>(&mut self) -> Result<Option<Value>, Error>
    where
        T: Any
;
pub fn new_instance<T>(
        &mut self,
        args: &[Value]
    ) -> Result<Option<Value>, Error>
    where
        T: Any
; pub fn is_class_defined<T>(&self) -> bool
    where
        T: Any
, { ... } }

Required methods

pub fn def_class<T>(&mut self, spec: Spec) -> Result<(), Error> where
    T: Any
[src]

pub fn class_spec<T>(&self) -> Result<Option<&Spec>, Error> where
    T: Any
[src]

pub fn class_of<T>(&mut self) -> Result<Option<Value>, Error> where
    T: Any
[src]

pub fn new_instance<T>(
    &mut self,
    args: &[Value]
) -> Result<Option<Value>, Error> where
    T: Any
[src]

Loading content...

Provided methods

pub fn is_class_defined<T>(&self) -> bool where
    T: Any
[src]

Loading content...

Implementors

impl ClassRegistry for Artichoke[src]

pub fn def_class<T>(&mut self, spec: Spec) -> Result<(), Error> where
    T: Any
[src]

Create a class definition bound to a Rust type T.

Class definitions have the same lifetime as the State because the class def owns the mrb_data_type for the type, which must be long-lived.

pub fn class_spec<T>(&self) -> Result<Option<&Spec>, Error> where
    T: Any
[src]

Retrieve a class definition from the state bound to Rust type T.

This function returns None if type T has not had a class spec registered for it using ClassRegistry::def_class.

Loading content...