Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin<L: Language>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn kind(&self) -> &'static str;
    fn meta(&self) -> &Meta;
    fn generate(&self, cx: &mut PluginContext<'_, L>) -> Result<()>;

    // Provided methods
    fn phase(&self) -> PluginPhase { ... }
    fn enforce(&self) -> Enforce { ... }
    fn supports_native_input(&self) -> bool { ... }
    fn requires(&self) -> Vec<Requirement> { ... }
    fn provides(&self) -> Vec<Provision> { ... }
}

Required Methods§

Source

fn kind(&self) -> &'static str

Source

fn meta(&self) -> &Meta

Source

fn generate(&self, cx: &mut PluginContext<'_, L>) -> Result<()>

Provided Methods§

Source

fn phase(&self) -> PluginPhase

Selects the plugin lifecycle phase. The default honors Self::enforce so a post plugin only needs to override that shorthand.

Source

fn enforce(&self) -> Enforce

Phase shorthand. Existing plugins remain generation plugins.

Source

fn supports_native_input(&self) -> bool

Opt in when this plugin reads protocol contracts instead of the legacy HTTP context. Native generation skips packages containing HTTP-only plugins before loading sources.

Source

fn requires(&self) -> Vec<Requirement>

Source

fn provides(&self) -> Vec<Provision>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§