This commit is contained in:
sxyazi 2024-01-27 14:55:26 +08:00
parent c344dcd1a1
commit 84a0d148cd
No known key found for this signature in database
3 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,7 @@
use std::fmt::Display;
use mlua::{ExternalError, ExternalResult, IntoLua, Table, TableExt, Value, Variadic};
use tracing::error;
use tracing::{error, warn};
use yazi_plugin::{LOADED, LUA};
use yazi_shared::{emit, event::Exec, Layer};
@ -26,9 +28,10 @@ impl App {
});
}
pub(crate) fn plugin_do(&mut self, opt: impl TryInto<yazi_plugin::Opt>) {
let Ok(opt) = opt.try_into() else {
return;
pub(crate) fn plugin_do(&mut self, opt: impl TryInto<yazi_plugin::Opt, Error = impl Display>) {
let opt = match opt.try_into() {
Ok(opt) => opt as yazi_plugin::Opt,
Err(e) => return warn!("{e}"),
};
let args = Variadic::from_iter(opt.data.args.into_iter().filter_map(|v| v.into_lua(&LUA).ok()));

View file

@ -22,6 +22,7 @@ pub fn cast_to_renderable(ud: AnyUserData) -> Option<Box<dyn Renderable + Send>>
}
}
#[derive(Debug)]
pub enum ValueSendable {
Nil,
Boolean(bool),
@ -96,7 +97,7 @@ impl ValueSendable {
}
}
#[derive(Hash, PartialEq, Eq)]
#[derive(Debug, Hash, PartialEq, Eq)]
pub enum ValueSendableKey {
Nil,
Boolean(bool),

View file

@ -1,5 +1,6 @@
use std::hash::{Hash, Hasher};
#[derive(Clone, Copy, Debug)]
pub struct OrderedFloat(f64);
impl OrderedFloat {