Skip to main content

plugin_interface

Attribute Macro plugin_interface 

Source
#[plugin_interface]
Expand description

Define a plugin interface from a trait.

Generates a #[repr(C)] vtable struct, interface hash constant, capability bit constants, and a descriptor builder function.

§Example

#[plugin_interface(version = 1, buffer = PluginAllocated)]
pub trait Greeter: Send + Sync {
    fn greet(&self, name: String) -> String;

    #[optional(since = 2)]
    fn greet_fancy(&self, name: String) -> String;
}