mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
e1a9dfd761
commit
5831c62940
1 changed files with 8 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{borrow::Cow, fmt::Debug, str::FromStr};
|
use std::{borrow::Cow, fmt::{self, Debug}, str::FromStr};
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use dyn_clone::DynClone;
|
use dyn_clone::DynClone;
|
||||||
|
|
@ -7,7 +7,7 @@ use mlua::{Lua, Table};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use yazi_shared::{SStr, data::{Data, DataKey}, event::{Cmd, CmdCow}};
|
use yazi_shared::{SStr, data::{Data, DataKey}, event::{Cmd, CmdCow}};
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct PluginOpt {
|
pub struct PluginOpt {
|
||||||
pub id: SStr,
|
pub id: SStr,
|
||||||
pub args: HashMap<DataKey, Data>,
|
pub args: HashMap<DataKey, Data>,
|
||||||
|
|
@ -39,17 +39,6 @@ impl TryFrom<CmdCow> for PluginOpt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for PluginOpt {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
f.debug_struct("PluginOpt")
|
|
||||||
.field("id", &self.id)
|
|
||||||
.field("args", &self.args)
|
|
||||||
.field("mode", &self.mode)
|
|
||||||
.field("callback", &self.callback.is_some())
|
|
||||||
.finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PluginOpt {
|
impl PluginOpt {
|
||||||
pub fn new_callback(id: impl Into<SStr>, f: impl PluginCallback) -> Self {
|
pub fn new_callback(id: impl Into<SStr>, f: impl PluginCallback) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -112,3 +101,9 @@ impl<T> PluginCallback for T where
|
||||||
impl Clone for Box<dyn PluginCallback> {
|
impl Clone for Box<dyn PluginCallback> {
|
||||||
fn clone(&self) -> Self { dyn_clone::clone_box(&**self) }
|
fn clone(&self) -> Self { dyn_clone::clone_box(&**self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for dyn PluginCallback {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("PluginCallback").finish_non_exhaustive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue