pub trait WorldGenerator {
// Required methods
fn import_interface(
&mut self,
resolve: &Resolve,
name: &WorldKey,
iface: InterfaceId,
files: &mut Files
);
fn export_interface(
&mut self,
resolve: &Resolve,
name: &WorldKey,
iface: InterfaceId,
files: &mut Files
) -> Result<()>;
fn import_funcs(
&mut self,
resolve: &Resolve,
world: WorldId,
funcs: &[(&str, &Function)],
files: &mut Files
);
fn export_funcs(
&mut self,
resolve: &Resolve,
world: WorldId,
funcs: &[(&str, &Function)],
files: &mut Files
) -> Result<()>;
fn import_types(
&mut self,
resolve: &Resolve,
world: WorldId,
types: &[(&str, TypeId)],
files: &mut Files
);
fn finish(&mut self, resolve: &Resolve, world: WorldId, files: &mut Files);
// Provided methods
fn generate(
&mut self,
resolve: &Resolve,
id: WorldId,
files: &mut Files
) -> Result<()> { ... }
fn finish_imports(
&mut self,
resolve: &Resolve,
world: WorldId,
files: &mut Files
) { ... }
fn preprocess(&mut self, resolve: &Resolve, world: WorldId) { ... }
fn pre_export_interface(
&mut self,
resolve: &Resolve,
files: &mut Files
) -> Result<()> { ... }
}
Called before any exported interfaces are generated.