use crate::plugin::PluginRegistry;
#[derive(Debug, Clone)]
pub struct PluginMeta {
pub id: &'static str,
pub name: &'static str,
pub description: &'static str,
pub aliases: &'static [&'static str],
pub default_enabled: bool,
}
impl PluginMeta {
#[must_use]
pub const fn new(
id: &'static str,
name: &'static str,
description: &'static str,
aliases: &'static [&'static str],
default_enabled: bool,
) -> Self {
Self { id, name, description, aliases, default_enabled }
}
#[must_use]
pub fn matches(&self, name: &str) -> bool {
let name_lower = name.to_lowercase();
if self.id.to_lowercase() == name_lower {
return true;
}
self.aliases.iter().any(|alias| alias.to_lowercase() == name_lower)
}
}
pub trait Plugin: Send + Sync {
fn meta(&self) -> &'static PluginMeta;
fn register(&self, registry: &mut PluginRegistry);
}