Skip to main content

run

Function run 

Source
pub fn run(
    schemas: &Path,
    out: &Path,
    namespace: Option<&str>,
    format: Formatter,
) -> Result<usize, RunError>
Expand description

Generate the protocol code for the schemas in schemas into out, and the wrapper modules into the protocol crate’s src beside it.

out is crates/protocol/generated, or crates/protocol/generated/<ns> for a namespace run, whose wrappers land in src/<ns>. Every Rust file goes through format. The run then deletes the generated files an earlier run wrote and this one did not. It returns the number of files written.

§Errors

Returns an error when a schema does not load or validate, an emitter or format fails, or a file cannot be written or pruned.