feat: add support for external plugins and enhance plugin management

This commit is contained in:
2026-03-15 18:54:55 +01:00
parent b8a9a6b02f
commit d1479f41d2
15 changed files with 389 additions and 19 deletions

View File

@@ -3,8 +3,6 @@ use std::sync::Arc;
use async_trait::async_trait;
use futures::future::join_all;
pub type PluginName = &'static str;
// --- Newtypes ---
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
@@ -86,7 +84,7 @@ impl std::fmt::Debug for SearchResult {
#[async_trait]
pub trait Plugin: Send + Sync {
fn name(&self) -> PluginName;
fn name(&self) -> &str;
async fn search(&self, query: &str) -> Vec<SearchResult>;
}
@@ -144,7 +142,7 @@ mod tests {
#[async_trait]
impl Plugin for MockPlugin {
fn name(&self) -> PluginName {
fn name(&self) -> &str {
"mock"
}