mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 00:31:04 +00:00
30 lines
633 B
Rust
30 lines
633 B
Rust
use crate::{file::FileOp, plugin::PluginOp, prework::PreworkOp};
|
|
|
|
#[derive(Debug)]
|
|
pub enum TaskOp {
|
|
File(Box<FileOp>),
|
|
Plugin(Box<PluginOp>),
|
|
Prework(Box<PreworkOp>),
|
|
}
|
|
|
|
impl TaskOp {
|
|
pub fn id(&self) -> usize {
|
|
match self {
|
|
TaskOp::File(op) => op.id(),
|
|
TaskOp::Plugin(op) => op.id(),
|
|
TaskOp::Prework(op) => op.id(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<FileOp> for TaskOp {
|
|
fn from(op: FileOp) -> Self { Self::File(Box::new(op)) }
|
|
}
|
|
|
|
impl From<PluginOp> for TaskOp {
|
|
fn from(op: PluginOp) -> Self { Self::Plugin(Box::new(op)) }
|
|
}
|
|
|
|
impl From<PreworkOp> for TaskOp {
|
|
fn from(op: PreworkOp) -> Self { Self::Prework(Box::new(op)) }
|
|
}
|