yazi/yazi-parser/src/mgr/link.rs

25 lines
647 B
Rust

use mlua::{ExternalError, FromLua, IntoLua, Lua, Value};
use serde::Deserialize;
use yazi_shared::event::ActionCow;
#[derive(Debug, Deserialize)]
pub struct LinkForm {
#[serde(default)]
pub relative: bool,
#[serde(default)]
pub force: bool,
}
impl TryFrom<ActionCow> for LinkForm {
type Error = anyhow::Error;
fn try_from(a: ActionCow) -> Result<Self, Self::Error> { Ok(a.deserialize()?) }
}
impl FromLua for LinkForm {
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
}
impl IntoLua for LinkForm {
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
}