Skip to main content

yazi_core/tasks/
option.rs

1use std::borrow::Cow;
2
3use yazi_scheduler::{TaskIn, plugin::PluginInEntry};
4use yazi_shared::{Id, SStr};
5
6#[derive(Clone, Debug)]
7pub enum TaskOpt {
8	Plugin(PluginInEntry),
9}
10
11impl TaskIn for TaskOpt {
12	type Prog = ();
13
14	fn id(&self) -> Id {
15		match self {
16			Self::Plugin(r#in) => r#in.id(),
17		}
18	}
19
20	fn set_id(&mut self, id: Id) -> &mut Self {
21		match self {
22			Self::Plugin(r#in) => _ = r#in.set_id(id),
23		}
24		self
25	}
26
27	fn title(&self) -> Cow<'_, str> {
28		match self {
29			Self::Plugin(r#in) => r#in.title(),
30		}
31	}
32
33	fn set_title(&mut self, title: impl Into<SStr>) -> &mut Self {
34		match self {
35			Self::Plugin(r#in) => _ = r#in.set_title(title),
36		}
37		self
38	}
39}