pub trait Plugin: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn name(&self) -> &str;
fn version(&self) -> &str;
// Provided methods
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn commands(&self) -> Vec<PluginCommand> { ... }
fn routes(&self) -> Option<Router> { ... }
fn tools(&self) -> Vec<Box<dyn Tool>> { ... }
}Expand description
The core Plugin trait. Implement this to extend Smooth.
Plugins can register CLI subcommands, API routes, and smooth-operator tools.
Each plugin has a unique identifier, a human-readable name, and a version string.
Lifecycle hooks (init / shutdown) are called once at startup and shutdown.
Required Methods§
Provided Methods§
Sourcefn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn commands(&self) -> Vec<PluginCommand>
fn commands(&self) -> Vec<PluginCommand>
Register CLI subcommands (returns command definitions).