pub trait Plugin: Sized {
type Options: DeserializeOwned;
// Required methods
fn new(options: Self::Options) -> Result<Self>;
fn classify(&self, file: &FileEntry) -> Result<Vec<String>>;
fn mutate(
&self,
file: &FileEntry,
sides: &Pairing<Source>,
) -> Result<Vec<Move>>;
// Provided methods
fn queries(&self) -> Result<Vec<QuerySource>> { ... }
fn enrich(
&self,
_file: &FileEntry,
_sides: &Pairing<Source>,
) -> Result<Vec<Annotation>> { ... }
}Expand description
A diffr plugin: the plugin resource of wit/plugin.wit. diffr makes one
with Plugin::new when it builds its pipeline, before any file, and
calls that one instance for every file of the run.
Required Associated Types§
Sourcetype Options: DeserializeOwned
type Options: DeserializeOwned
The plugin’s options, deserialized from its bundled or external config
entry: a JSON object, validated against the options schema in
plugin.toml and filled with its defaults.
Required Methods§
Sourcefn new(options: Self::Options) -> Result<Self>
fn new(options: Self::Options) -> Result<Self>
Make the plugin from its options. An error, like options that do not deserialize, is a setup error naming the plugin.
Provided Methods§
Sourcefn queries(&self) -> Result<Vec<QuerySource>>
fn queries(&self) -> Result<Vec<QuerySource>>
Named query text, collected once during setup and compiled by diffr.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".