From 53e6e1bc0ab4d28b5946c548ec45a0ff56147fcf Mon Sep 17 00:00:00 2001 From: sxyazi Date: Fri, 29 Dec 2023 01:26:39 +0800 Subject: [PATCH] .. [no ci] --- yazi-scheduler/src/lib.rs | 1 + yazi-scheduler/src/plugin/mod.rs | 5 +++++ yazi-scheduler/src/plugin/op.rs | 10 ++++++++++ yazi-scheduler/src/{workers => plugin}/plugin.rs | 12 +----------- yazi-scheduler/src/scheduler.rs | 2 +- yazi-scheduler/src/task.rs | 2 +- yazi-scheduler/src/workers/mod.rs | 2 -- 7 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 yazi-scheduler/src/plugin/mod.rs create mode 100644 yazi-scheduler/src/plugin/op.rs rename yazi-scheduler/src/{workers => plugin}/plugin.rs (90%) diff --git a/yazi-scheduler/src/lib.rs b/yazi-scheduler/src/lib.rs index f1e67485..e401021d 100644 --- a/yazi-scheduler/src/lib.rs +++ b/yazi-scheduler/src/lib.rs @@ -2,6 +2,7 @@ mod blocker; mod file; +mod plugin; mod running; mod scheduler; mod task; diff --git a/yazi-scheduler/src/plugin/mod.rs b/yazi-scheduler/src/plugin/mod.rs new file mode 100644 index 00000000..dacceffe --- /dev/null +++ b/yazi-scheduler/src/plugin/mod.rs @@ -0,0 +1,5 @@ +mod op; +mod plugin; + +pub use op::*; +pub use plugin::*; diff --git a/yazi-scheduler/src/plugin/op.rs b/yazi-scheduler/src/plugin/op.rs new file mode 100644 index 00000000..abe506e0 --- /dev/null +++ b/yazi-scheduler/src/plugin/op.rs @@ -0,0 +1,10 @@ +#[derive(Debug)] +pub enum PluginOp { + Entry(PluginOpEntry), +} + +#[derive(Clone, Debug)] +pub struct PluginOpEntry { + pub id: usize, + pub name: String, +} diff --git a/yazi-scheduler/src/workers/plugin.rs b/yazi-scheduler/src/plugin/plugin.rs similarity index 90% rename from yazi-scheduler/src/workers/plugin.rs rename to yazi-scheduler/src/plugin/plugin.rs index c28edd52..fc5e168b 100644 --- a/yazi-scheduler/src/workers/plugin.rs +++ b/yazi-scheduler/src/plugin/plugin.rs @@ -1,6 +1,7 @@ use anyhow::Result; use tokio::sync::mpsc; +use super::{PluginOp, PluginOpEntry}; use crate::TaskProg; pub struct Plugin { @@ -10,17 +11,6 @@ pub struct Plugin { prog: mpsc::UnboundedSender, } -#[derive(Debug)] -pub enum PluginOp { - Entry(PluginOpEntry), -} - -#[derive(Clone, Debug)] -pub struct PluginOpEntry { - pub id: usize, - pub name: String, -} - impl Plugin { pub fn new(prog: mpsc::UnboundedSender) -> Self { let (tx, rx) = async_channel::unbounded(); diff --git a/yazi-scheduler/src/scheduler.rs b/yazi-scheduler/src/scheduler.rs index d03e047b..b5c434d8 100644 --- a/yazi-scheduler/src/scheduler.rs +++ b/yazi-scheduler/src/scheduler.rs @@ -7,7 +7,7 @@ use yazi_config::{open::Opener, plugin::PluginRule, TASKS}; use yazi_shared::{emit, event::Exec, fs::{unique_path, Url}, Layer, Throttle}; use super::{Running, TaskProg, TaskStage}; -use crate::{file::{File, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash}, workers::{Plugin, PluginOpEntry, Preload, PreloadOpRule, PreloadOpSize, Process, ProcessOpOpen}, TaskKind, TaskOp}; +use crate::{file::{File, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash}, plugin::{Plugin, PluginOpEntry}, workers::{Preload, PreloadOpRule, PreloadOpSize, Process, ProcessOpOpen}, TaskKind, TaskOp}; pub struct Scheduler { pub file: Arc, diff --git a/yazi-scheduler/src/task.rs b/yazi-scheduler/src/task.rs index 40c4a59f..edfc8709 100644 --- a/yazi-scheduler/src/task.rs +++ b/yazi-scheduler/src/task.rs @@ -61,7 +61,7 @@ impl From<&Task> for TaskSummary { #[derive(Debug)] pub enum TaskOp { File(Box), - Plugin(Box), + Plugin(Box), Preload(Box), Process(Box), } diff --git a/yazi-scheduler/src/workers/mod.rs b/yazi-scheduler/src/workers/mod.rs index 220642e5..b7c9297e 100644 --- a/yazi-scheduler/src/workers/mod.rs +++ b/yazi-scheduler/src/workers/mod.rs @@ -1,7 +1,5 @@ -mod plugin; mod preload; mod process; -pub use plugin::*; pub use preload::*; pub use process::*;