server implementation on plugins

This commit is contained in:
2025-09-01 09:34:21 +02:00
parent 323f3c1df0
commit 6b36e2947a
3 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ impl Server {
// Initialize plugins
for plugin in self.plugins.lock().unwrap().iter_mut() {
plugin.init();
plugin.init(self);
}
// Start server
+5 -1
View File
@@ -1,3 +1,7 @@
use std::sync::Arc;
use crate::Server;
pub trait Plugin {
fn init(&mut self);
fn init(&mut self, server: &Arc<Server>);
}
+3 -2
View File
@@ -1,4 +1,5 @@
use voxa_server::{export_plugin, logger, plugin::Plugin};
use std::sync::Arc;
use voxa_server::{Server, export_plugin, logger, plugin::Plugin};
logger! {
const LOGGER "My Plugin"
@@ -8,7 +9,7 @@ logger! {
pub struct MyPlugin;
impl Plugin for MyPlugin {
fn init(&mut self) {
fn init(&mut self, _server: &Arc<Server>) {
LOGGER.info("MyPlugin initialized!");
}
}