Trait artichoke_core::module_registry::ModuleRegistry[][src]

pub trait ModuleRegistry {
    type Value;
    type Error;
    type Spec: 'static;
    fn def_module<T>(&mut self, spec: Self::Spec) -> Result<(), Self::Error>
    where
        T: Any
;
fn module_spec<T>(&self) -> Result<Option<&Self::Spec>, Self::Error>
    where
        T: Any
;
fn module_of<T>(&mut self) -> Result<Option<Self::Value>, Self::Error>
    where
        T: Any
; fn is_module_defined<T>(&self) -> bool
    where
        T: Any
, { ... } }
Expand description

Define and store module specs on an interpreter.

A module spec is a static set of information the interpreter requires to define a Ruby Module object.

Associated Types

Concrete value type for boxed Ruby values.

Concrete error type for errors encountered when manipulating the module registry.

Type representing a module specification.

Required methods

Create a module definition bound to a Rust type T.

Module definitions have the same lifetime as the interpreter.

Errors

If the module registry state is inaccessible, an error is returned.

Retrieve a module definition from the interpreter bound to Rust type T.

This function returns None if type T has not had a module spec registered for it using ModuleRegistry::def_module.

Errors

If the module registry state is inaccessible, an error is returned.

Retrieve a boxed Ruby value containing a Module object for the Module bound to Rust type T.

If the interpreter cannot find or load a module associated with T, Ok(None) is returned.

Errors

If the module registry state is inaccessible, an error is returned.

Provided methods

Retrieve whether a module definition exists from the interpreter bound to Rust type T

If the interpreter cannot find or load a module associated with T, Ok(None) is returned.

Errors

If the module registry state is inaccessible, an error is returned.

Implementors