Type Definition warpgrapher::engine::events::BeforeEngineBuildFunc
source · [−]pub type BeforeEngineBuildFunc = fn(_: &mut Configuration) -> Result<(), Error>;
Expand description
Type alias for a function called before the engine is built and enable modifications to the configuration. A common use case is adding common properties to all types in the model.
Examples
fn before_engine_build_func(config: &mut Configuration) -> Result<(), Error> {
for t in config.model.iter_mut() {
let mut_props: &mut Vec<Property> = t.mut_props();
mut_props.push(Property::new(
"global_prop".to_string(),
UsesFilter::all(),
"String".to_string(),
false,
false,
None,
None
));
}
Ok(())
}