mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-24 08:11:04 +00:00
27 lines
728 B
Rust
27 lines
728 B
Rust
use mlua::{ExternalError, FromLua, IntoLua, Lua, Value};
|
|
use serde::Deserialize;
|
|
use yazi_shared::{event::ActionCow, strand::StrandBuf};
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct CreateForm {
|
|
#[serde(alias = "0", default)]
|
|
pub target: StrandBuf,
|
|
#[serde(default)]
|
|
pub dir: bool,
|
|
#[serde(default)]
|
|
pub force: bool,
|
|
}
|
|
|
|
impl TryFrom<ActionCow> for CreateForm {
|
|
type Error = anyhow::Error;
|
|
|
|
fn try_from(a: ActionCow) -> Result<Self, Self::Error> { Ok(a.deserialize()?) }
|
|
}
|
|
|
|
impl FromLua for CreateForm {
|
|
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
|
|
}
|
|
|
|
impl IntoLua for CreateForm {
|
|
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
|
|
}
|