yazi/yazi-scheduler/src/fetch/in.rs
2026-04-07 11:06:31 +08:00

33 lines
732 B
Rust

use std::borrow::Cow;
use yazi_config::plugin::Fetcher;
use yazi_runner::fetcher::FetchJob;
use yazi_shared::Id;
use crate::{TaskIn, fetch::FetchProg};
#[derive(Debug)]
pub(crate) struct FetchIn {
pub(crate) id: Id,
pub(crate) plugin: &'static Fetcher,
pub(crate) targets: Vec<yazi_fs::File>,
}
impl TaskIn for FetchIn {
type Prog = FetchProg;
fn id(&self) -> Id { self.id }
fn set_id(&mut self, id: Id) -> &mut Self {
self.id = id;
self
}
fn title(&self) -> Cow<'_, str> {
format!("Run fetcher '{}' with {} target(s)", self.plugin.run.name, self.targets.len()).into()
}
}
impl From<FetchIn> for FetchJob {
fn from(value: FetchIn) -> Self { Self { action: &value.plugin.run, files: value.targets } }
}