From cc620511a993b6b4e7add21b68f739d22038ddd7 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Thu, 11 Dec 2025 23:25:08 +0100 Subject: [PATCH] Small plugin structure fix --- src/plugin/loader.rs | 25 ++++++++----------------- src/plugin/mod.rs | 2 +- src/plugin/types.rs | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/plugin/loader.rs b/src/plugin/loader.rs index b321ac8..a919852 100644 --- a/src/plugin/loader.rs +++ b/src/plugin/loader.rs @@ -1,9 +1,14 @@ -use crate::{logger, plugin::Plugin}; -use serde::{Deserialize, Serialize}; +use crate::{ + logger, + plugin::{ + Plugin, + types::{PluginHandshake, PluginJson}, + }, +}; use std::{ collections::HashMap, fs, - io::{BufRead, BufReader, Read}, + io::{BufRead, BufReader}, net::{TcpListener, TcpStream}, path::Path, process::Command, @@ -12,20 +17,6 @@ use std::{ logger!(LOGGER "Plugin Loader"); -#[derive(Debug, Serialize, Deserialize)] -pub struct PluginJson { - pub id: String, - pub version: String, - pub supported_versions: Vec, - pub file: String, - pub args: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct PluginHandshake { - pub id: String, -} - pub struct PluginLoader { plugin_clients: Arc>>, } diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs index 6c083a2..f8ae3bc 100644 --- a/src/plugin/mod.rs +++ b/src/plugin/mod.rs @@ -2,7 +2,7 @@ pub mod loader; pub mod types; use std::{ - io::{BufRead, BufReader, Read, Write}, + io::{BufRead, BufReader, Write}, net::TcpStream, }; diff --git a/src/plugin/types.rs b/src/plugin/types.rs index d4ae513..dd14071 100644 --- a/src/plugin/types.rs +++ b/src/plugin/types.rs @@ -1,5 +1,19 @@ use serde::{Deserialize, Serialize}; +#[derive(Debug, Serialize, Deserialize)] +pub struct PluginJson { + pub id: String, + pub version: String, + pub supported_versions: Vec, + pub file: String, + pub args: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct PluginHandshake { + pub id: String, +} + #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "type", content = "params", rename_all = "snake_case")] pub enum LoaderMessage {}