Trait Package
pub trait Package {
// Required methods
fn init(module: &mut Module);
fn as_shared_module(&self) -> Arc<Module>;
// Provided methods
fn init_engine(engine: &mut Engine) { ... }
fn register_into_engine(&self, engine: &mut Engine) -> &Self { ... }
}
Expand description
Trait that all packages must implement.
Required Methods§
fn init(module: &mut Module)
fn init(module: &mut Module)
Initialize the package.
Functions should be registered into module
here.
Get a reference to a shared module from this package.
Provided Methods§
fn init_engine(engine: &mut Engine)
fn init_engine(engine: &mut Engine)
Initialize the package with an Engine
.
Perform tasks such as registering custom operators/syntax.
fn register_into_engine(&self, engine: &mut Engine) -> &Self
fn register_into_engine(&self, engine: &mut Engine) -> &Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.