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, } impl TryFrom for UpdateTasksOpt { type Error = anyhow::Error; fn try_from(mut c: CmdCow) -> Result { 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 { Err("unsupported".into_lua_err()) } } impl IntoLua for UpdateTasksOpt { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } }