yazi/yazi-parser/src/mgr/update_tasks.rs
2025-08-17 16:25:04 +08:00

28 lines
712 B
Rust

use anyhow::bail;
use mlua::{ExternalError, FromLua, IntoLua, Lua, Value};
use yazi_shared::{event::CmdCow, url::UrlBuf};
#[derive(Debug)]
pub struct UpdateTasksOpt {
pub urls: Vec<UrlBuf>,
}
impl TryFrom<CmdCow> for UpdateTasksOpt {
type Error = anyhow::Error;
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
let Some(urls) = c.take_any("urls") else {
bail!("Invalid 'urls' argument in UpdateTasksOpt");
};
Ok(Self { urls })
}
}
impl FromLua for UpdateTasksOpt {
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
}
impl IntoLua for UpdateTasksOpt {
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
}