pub trait Generator: Send + Sync {
type Config: Serialize + Default + Clone + Send + Sync;
// Required methods
fn name(&self) -> &'static str;
fn generate(
&self,
api: &Api,
out_dir: &Utf8Path,
config: &Self::Config,
) -> Result<()>;
// Provided method
fn output_files(
&self,
_api: &Api,
_out_dir: &Utf8Path,
_config: &Self::Config,
) -> Vec<String> { ... }
}Expand description
A language code generator.
Generators are dispatched in parallel, so every implementation must be
safe to share across threads. The associated Config type is owned
by the generator crate so weaveffi-core does not have to know about
target-specific options like swift_module_name or cpp_namespace.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn output_files(
&self,
_api: &Api,
_out_dir: &Utf8Path,
_config: &Self::Config,
) -> Vec<String>
fn output_files( &self, _api: &Api, _out_dir: &Utf8Path, _config: &Self::Config, ) -> Vec<String>
Files that generate would write, relative
to (or anchored under) out_dir. Used by --dry-run and diff.
Default implementation returns the empty list; generators override
to surface the list without doing any I/O.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".