Macro fj::register_model
source · macro_rules! register_model {
($init:expr) => { ... };
}
Expand description
Define the initialization routine used when registering models.
See the crate::model
macro if your model can be implemented as a pure
function.
Examples
use fj::models::*;
fj::register_model!(|host: &mut dyn Host| {
host.register_model(MyModel::default());
Ok(Metadata::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")))
});
#[derive(Default)]
struct MyModel { }
impl Model for MyModel {
fn metadata(&self) -> ModelMetadata { todo!() }
fn shape(&self, ctx: &dyn Context) -> Result<fj::Shape, Error> {
todo!()
}
}