yazi/yazi-core/src/tasks/option.rs
2026-05-28 12:05:06 +08:00

49 lines
866 B
Rust

use std::borrow::Cow;
use yazi_scheduler::{TaskIn, file::FileInCut, plugin::PluginInEntry};
use yazi_shared::{Id, SStr};
#[derive(Clone, Debug)]
pub enum TaskOpt {
Cut(FileInCut),
Plugin(PluginInEntry),
}
impl TaskIn for TaskOpt {
type Prog = ();
fn id(&self) -> Id {
match self {
Self::Cut(r#in) => r#in.id(),
Self::Plugin(r#in) => r#in.id(),
}
}
fn set_id(&mut self, id: Id) -> &mut Self {
match self {
Self::Cut(r#in) => _ = r#in.set_id(id),
Self::Plugin(r#in) => _ = r#in.set_id(id),
}
self
}
fn title(&self) -> Cow<'_, str> {
match self {
Self::Cut(r#in) => r#in.title(),
Self::Plugin(r#in) => r#in.title(),
}
}
fn set_title(&mut self, title: impl Into<SStr>) -> &mut Self {
match self {
Self::Cut(r#in) => _ = r#in.set_title(title),
Self::Plugin(r#in) => _ = r#in.set_title(title),
}
self
}
}