mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
28 lines
712 B
Rust
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()) }
|
|
}
|