diff --git a/Cargo.lock b/Cargo.lock index 1deed699..004b84ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "avif-serialize" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375082f007bd67184fb9c0374614b29f9aaa604ec301635f72338bb65386a53d" +checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38" dependencies = [ "arrayvec", ] @@ -589,9 +589,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.61" +version = "1.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" dependencies = [ "find-msvc-tools", "jobserver", @@ -2156,9 +2156,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.97" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" dependencies = [ "cfg-if", "futures-util", @@ -2564,9 +2564,9 @@ dependencies = [ [[package]] name = "no_std_io2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51ed7824b6e07d354605f4abb3d9d300350701299da96642ee084f5ce631550" +checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003" dependencies = [ "memchr", ] @@ -3379,9 +3379,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quick-xml" -version = "0.39.3" +version = "0.39.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721da970c312655cde9b4ffe0547f20a8494866a4af5ff51f18b7c633d0c870b" +checksum = "cdcc8dd4e2f670d309a5f0e83fe36dfdc05af317008fea29144da1a2ac858e5e" dependencies = [ "memchr", ] @@ -3732,9 +3732,9 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rfc6979" -version = "0.5.0-rc.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a3127ee32baec36af75b4107082d9bd823501ec14a4e016be4b6b37faa74ae" +checksum = "5236ce872cac07e0fb3969b0cbf468c7d2f37d432f1b627dcb7b8d34563fb0c3" dependencies = [ "hmac 0.13.0", "subtle", @@ -4696,9 +4696,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.52.2" +version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110a78583f19d5cdb2c5ccf321d1290344e71313c6c37d43520d386027d18386" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ "bytes", "libc", @@ -5113,9 +5113,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" dependencies = [ "cfg-if", "once_cell", @@ -5126,9 +5126,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.70" +version = "0.4.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084" +checksum = "96492d0d3ffba25305a7dc88720d250b1401d7edca02cc3bcd50633b424673b8" dependencies = [ "js-sys", "wasm-bindgen", @@ -5136,9 +5136,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5146,9 +5146,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" dependencies = [ "bumpalo", "proc-macro2", @@ -5159,9 +5159,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" dependencies = [ "unicode-ident", ] diff --git a/Cargo.toml b/Cargo.toml index 12a1d64d..3054f8fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,7 +71,7 @@ serde_with = "3.19.0" strum = { version = "0.28.0", features = [ "derive" ] } syntect = { version = "5.3.0", default-features = false, features = [ "parsing", "plist-load", "regex-onig" ] } thiserror = "2.0.18" -tokio = { version = "1.52.2", features = [ "full" ] } +tokio = { version = "1.52.3", features = [ "full" ] } tokio-stream = "0.1.18" tokio-util = "0.7.18" toml = { version = "1.1.2" } diff --git a/yazi-actor/src/mgr/bulk_rename.rs b/yazi-actor/src/mgr/bulk_rename.rs index c581140b..0e46be3d 100644 --- a/yazi-actor/src/mgr/bulk_rename.rs +++ b/yazi-actor/src/mgr/bulk_rename.rs @@ -65,7 +65,7 @@ impl Actor for BulkRename { batcher.prime(&tmp); TasksProxy::process_exec( - cwd.into(), + cwd, Splatter::new(&[UrlCow::default(), tmp.as_url().into()]).splat(&opener.run), vec![UrlCow::default(), UrlBuf::from(&tmp).into()], opener.block, diff --git a/yazi-actor/src/mgr/cd.rs b/yazi-actor/src/mgr/cd.rs index 78cc959a..7192af9b 100644 --- a/yazi-actor/src/mgr/cd.rs +++ b/yazi-actor/src/mgr/cd.rs @@ -7,9 +7,9 @@ use yazi_config::popup::InputCfg; use yazi_core::mgr::CdSource; use yazi_dds::Pubsub; use yazi_fs::{File, FilesOp, path::{clean_url, expand_url}}; -use yazi_macro::{act, err, render, succ}; +use yazi_macro::{act, err, input, render, succ}; use yazi_parser::mgr::CdForm; -use yazi_proxy::{CmpProxy, InputProxy, MgrProxy}; +use yazi_proxy::{CmpProxy, MgrProxy}; use yazi_shared::{Debounce, data::Data, url::{AsUrl, UrlBuf, UrlLike}}; use yazi_vfs::{VfsFile, provider}; use yazi_widgets::input::InputEvent; @@ -62,8 +62,8 @@ impl Actor for Cd { } impl Cd { - fn cd_interactive(cx: &Ctx) -> Result { - let input = InputProxy::show(InputCfg::cd(cx.cwd().as_url())); + fn cd_interactive(cx: &mut Ctx) -> Result { + let input = input!(cx, InputCfg::cd(cx.cwd().as_url()))?; tokio::spawn(async move { let rx = Debounce::new(UnboundedReceiverStream::new(input), Duration::from_millis(50)); diff --git a/yazi-actor/src/mgr/create.rs b/yazi-actor/src/mgr/create.rs index ce76d537..f1c7d2f1 100644 --- a/yazi-actor/src/mgr/create.rs +++ b/yazi-actor/src/mgr/create.rs @@ -1,9 +1,9 @@ use anyhow::{Result, bail}; use yazi_config::popup::{ConfirmCfg, InputCfg}; use yazi_fs::{File, FilesOp}; -use yazi_macro::{ok_or_not_found, succ}; +use yazi_macro::{input, ok_or_not_found, succ}; use yazi_parser::mgr::CreateForm; -use yazi_proxy::{ConfirmProxy, InputProxy, MgrProxy}; +use yazi_proxy::{ConfirmProxy, MgrProxy}; use yazi_shared::{data::Data, url::{UrlBuf, UrlLike}}; use yazi_vfs::{VfsFile, maybe_exists, provider}; use yazi_watcher::WATCHER; @@ -20,7 +20,7 @@ impl Actor for Create { fn act(cx: &mut Ctx, form: Self::Form) -> Result { let cwd = cx.cwd().to_owned(); - let mut input = InputProxy::show(InputCfg::create(form.dir)); + let mut input = input!(cx, InputCfg::create(form.dir))?; tokio::spawn(async move { let Some(InputEvent::Submit(name)) = input.recv().await else { return }; diff --git a/yazi-actor/src/mgr/filter.rs b/yazi-actor/src/mgr/filter.rs index a0c52696..dd070369 100644 --- a/yazi-actor/src/mgr/filter.rs +++ b/yazi-actor/src/mgr/filter.rs @@ -5,9 +5,9 @@ use tokio::pin; use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_core::mgr::FilterOpt; -use yazi_macro::succ; +use yazi_macro::{input, succ}; use yazi_parser::mgr::FilterForm; -use yazi_proxy::{InputProxy, MgrProxy}; +use yazi_proxy::MgrProxy; use yazi_shared::{Debounce, data::Data}; use yazi_widgets::input::InputEvent; @@ -20,8 +20,8 @@ impl Actor for Filter { const NAME: &str = "filter"; - fn act(_: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { - let input = InputProxy::show(InputCfg::filter()); + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { + let input = input!(cx, InputCfg::filter())?; tokio::spawn(async move { let rx = Debounce::new(UnboundedReceiverStream::new(input), Duration::from_millis(50)); diff --git a/yazi-actor/src/mgr/find.rs b/yazi-actor/src/mgr/find.rs index e211a4d1..8d1bcaf9 100644 --- a/yazi-actor/src/mgr/find.rs +++ b/yazi-actor/src/mgr/find.rs @@ -5,9 +5,9 @@ use tokio::pin; use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_core::mgr::FindDoOpt; -use yazi_macro::succ; +use yazi_macro::{input, succ}; use yazi_parser::mgr::FindForm; -use yazi_proxy::{InputProxy, MgrProxy}; +use yazi_proxy::MgrProxy; use yazi_shared::{Debounce, data::Data}; use yazi_widgets::input::InputEvent; @@ -20,8 +20,8 @@ impl Actor for Find { const NAME: &str = "find"; - fn act(_: &mut Ctx, form: Self::Form) -> Result { - let input = InputProxy::show(InputCfg::find(form.prev)); + fn act(cx: &mut Ctx, form: Self::Form) -> Result { + let input = input!(cx, InputCfg::find(form.prev))?; tokio::spawn(async move { let rx = Debounce::new(UnboundedReceiverStream::new(input), Duration::from_millis(50)); diff --git a/yazi-actor/src/mgr/remove.rs b/yazi-actor/src/mgr/remove.rs index 5d771591..077f072f 100644 --- a/yazi-actor/src/mgr/remove.rs +++ b/yazi-actor/src/mgr/remove.rs @@ -1,8 +1,8 @@ use anyhow::Result; use yazi_config::popup::ConfirmCfg; -use yazi_macro::{act, succ}; +use yazi_macro::{act, confirm, succ}; use yazi_parser::mgr::RemoveForm; -use yazi_proxy::{ConfirmProxy, MgrProxy}; +use yazi_proxy::MgrProxy; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -29,14 +29,17 @@ impl Actor for Remove { return act!(mgr:remove_do, cx, form); } - let confirm = ConfirmProxy::show(if form.permanently { - ConfirmCfg::delete(&form.targets) - } else { - ConfirmCfg::trash(&form.targets) - }); + let confirm = confirm!( + cx, + if form.permanently { + ConfirmCfg::delete(&form.targets) + } else { + ConfirmCfg::trash(&form.targets) + } + )?; tokio::spawn(async move { - if confirm.await { + if confirm.future().await { MgrProxy::remove_do(form.targets, form.permanently); } }); diff --git a/yazi-actor/src/mgr/rename.rs b/yazi-actor/src/mgr/rename.rs index 53c612c6..1d956406 100644 --- a/yazi-actor/src/mgr/rename.rs +++ b/yazi-actor/src/mgr/rename.rs @@ -2,9 +2,9 @@ use anyhow::Result; use yazi_config::popup::{ConfirmCfg, InputCfg}; use yazi_dds::Pubsub; use yazi_fs::{File, FilesOp}; -use yazi_macro::{act, err, ok_or_not_found, succ}; +use yazi_macro::{act, err, input, ok_or_not_found, succ}; use yazi_parser::mgr::RenameForm; -use yazi_proxy::{ConfirmProxy, InputProxy, MgrProxy}; +use yazi_proxy::{ConfirmProxy, MgrProxy}; use yazi_shared::{Id, data::Data, url::{UrlBuf, UrlLike}}; use yazi_vfs::{VfsFile, maybe_exists, provider}; use yazi_watcher::WATCHER; @@ -42,7 +42,7 @@ impl Actor for Rename { }; let (tab, old) = (cx.tab().id, hovered.url_owned()); - let mut input = InputProxy::show(InputCfg::rename().with_value(name).with_cursor(cursor)); + let mut input = input!(cx, InputCfg::rename().with_value(name).with_cursor(cursor))?; tokio::spawn(async move { let Some(InputEvent::Submit(name)) = input.recv().await else { return }; diff --git a/yazi-actor/src/mgr/search.rs b/yazi-actor/src/mgr/search.rs index 1e5106d7..9602490b 100644 --- a/yazi-actor/src/mgr/search.rs +++ b/yazi-actor/src/mgr/search.rs @@ -6,10 +6,10 @@ use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_core::mgr::{CdSource, SearchVia}; use yazi_fs::{FilesOp, cha::Cha}; -use yazi_macro::{act, succ}; +use yazi_macro::{act, input, succ}; use yazi_parser::{VoidForm, mgr::SearchForm}; use yazi_plugin::external; -use yazi_proxy::{InputProxy, MgrProxy}; +use yazi_proxy::MgrProxy; use yazi_scheduler::NotifyProxy; use yazi_shared::{data::Data, url::{AsUrl, UrlLike}}; use yazi_widgets::input::InputEvent; @@ -28,7 +28,7 @@ impl Actor for Search { handle.abort(); } - let mut input = InputProxy::show(InputCfg::search(opt.via.into()).with_value(&*opt.subject)); + let mut input = input!(cx, InputCfg::search(opt.via.into()).with_value(&*opt.subject))?; tokio::spawn(async move { if let Some(InputEvent::Submit(subject)) = input.recv().await { diff --git a/yazi-actor/src/mgr/shell.rs b/yazi-actor/src/mgr/shell.rs index d8877bac..f935b359 100644 --- a/yazi-actor/src/mgr/shell.rs +++ b/yazi-actor/src/mgr/shell.rs @@ -2,9 +2,9 @@ use std::borrow::Cow; use anyhow::Result; use yazi_config::popup::InputCfg; -use yazi_macro::{act, succ}; +use yazi_macro::{act, input, succ}; use yazi_parser::mgr::ShellForm; -use yazi_proxy::{InputProxy, TasksProxy}; +use yazi_proxy::TasksProxy; use yazi_scheduler::process::ProcessOpt; use yazi_shared::data::Data; use yazi_widgets::input::InputEvent; @@ -24,9 +24,11 @@ impl Actor for Shell { let cwd = form.cwd.take().unwrap_or_else(|| cx.cwd().clone()); let selected: Vec<_> = cx.tab().hovered_and_selected().cloned().map(Into::into).collect(); - let input = form.interactive.then(|| { - InputProxy::show(InputCfg::shell(form.block).with_value(&*form.run).with_cursor(form.cursor)) - }); + let input = if form.interactive { + Some(input!(cx, InputCfg::shell(form.block).with_value(&*form.run).with_cursor(form.cursor))?) + } else { + None + }; tokio::spawn(async move { if let Some(mut rx) = input { diff --git a/yazi-actor/src/mgr/tab_rename.rs b/yazi-actor/src/mgr/tab_rename.rs index 38540915..238c5067 100644 --- a/yazi-actor/src/mgr/tab_rename.rs +++ b/yazi-actor/src/mgr/tab_rename.rs @@ -2,9 +2,9 @@ use std::borrow::Cow; use anyhow::Result; use yazi_config::popup::InputCfg; -use yazi_macro::{act, render, succ}; +use yazi_macro::{act, input, render, succ}; use yazi_parser::mgr::TabRenameForm; -use yazi_proxy::{InputProxy, MgrProxy}; +use yazi_proxy::MgrProxy; use yazi_shared::data::Data; use yazi_widgets::input::InputEvent; @@ -27,9 +27,11 @@ impl Actor for TabRename { succ!(render!()); } - let mut input = InputProxy::show( - InputCfg::tab_rename().with_value(form.name.unwrap_or(Cow::Borrowed(&pref.name))), - ); + let mut input = input!( + cx, + InputCfg::tab_rename().with_value(form.name.unwrap_or(Cow::Borrowed(&pref.name))) + )?; + tokio::spawn(async move { if let Some(InputEvent::Submit(name)) = input.recv().await { MgrProxy::tab_rename(tab, name); diff --git a/yazi-binding/src/config/fetcher.rs b/yazi-binding/src/config/fetcher.rs index c87edba2..00ab805e 100644 --- a/yazi-binding/src/config/fetcher.rs +++ b/yazi-binding/src/config/fetcher.rs @@ -63,13 +63,13 @@ impl FromLua for FetcherMatcher { fn from_lua(value: Value, _: &Lua) -> mlua::Result { match value { Value::Table(t) => t.try_into(), - _ => return Err("expected a table of FetcherMatcher".into_lua_err()), + _ => Err("expected a table of FetcherMatcher".into_lua_err()), } } } impl IntoLua for FetcherMatcher { fn into_lua(self, lua: &Lua) -> mlua::Result { - Iter::new(self.0.into_iter().map(Fetcher::new), None).into_lua(lua) + Iter::new(self.0.map(Fetcher::new), None).into_lua(lua) } } diff --git a/yazi-binding/src/config/open_rule.rs b/yazi-binding/src/config/open_rule.rs index 9fb902fb..73acfaf7 100644 --- a/yazi-binding/src/config/open_rule.rs +++ b/yazi-binding/src/config/open_rule.rs @@ -73,13 +73,13 @@ impl FromLua for OpenRuleMatcher { fn from_lua(value: Value, _: &Lua) -> mlua::Result { match value { Value::Table(t) => t.try_into(), - _ => return Err("expected a table of OpenRuleMatcher".into_lua_err()), + _ => Err("expected a table of OpenRuleMatcher".into_lua_err()), } } } impl IntoLua for OpenRuleMatcher { fn into_lua(self, lua: &Lua) -> mlua::Result { - Iter::new(self.0.into_iter().map(OpenRule::new), None).into_lua(lua) + Iter::new(self.0.map(OpenRule::new), None).into_lua(lua) } } diff --git a/yazi-binding/src/config/open_rules.rs b/yazi-binding/src/config/open_rules.rs index d164b7b8..1f1f7689 100644 --- a/yazi-binding/src/config/open_rules.rs +++ b/yazi-binding/src/config/open_rules.rs @@ -20,7 +20,7 @@ impl UserData for OpenRules { _ => index, }; - YAZI.open.insert(index, rule.clone().into()).into_lua_err()?; + YAZI.open.insert(index, rule.clone()).into_lua_err()?; Ok(rule) }); diff --git a/yazi-binding/src/config/opener_rule.rs b/yazi-binding/src/config/opener_rule.rs index c5ef38b1..0ce390f3 100644 --- a/yazi-binding/src/config/opener_rule.rs +++ b/yazi-binding/src/config/opener_rule.rs @@ -76,6 +76,6 @@ impl FromLua for OpenerRuleMatcher { impl IntoLua for OpenerRuleMatcher { fn into_lua(self, lua: &Lua) -> mlua::Result { - Iter::new(self.0.into_iter().map(OpenerRule::new), None).into_lua(lua) + Iter::new(self.0.map(OpenerRule::new), None).into_lua(lua) } } diff --git a/yazi-binding/src/config/opener_rules.rs b/yazi-binding/src/config/opener_rules.rs index 39a0631c..d694bdec 100644 --- a/yazi-binding/src/config/opener_rules.rs +++ b/yazi-binding/src/config/opener_rules.rs @@ -43,7 +43,7 @@ impl UserData for OpenerRules { _ => index, }; - me.inner.insert(index, rule.clone().into()).into_lua_err()?; + me.inner.insert(index, rule.clone()).into_lua_err()?; Ok(rule) }); diff --git a/yazi-binding/src/config/preloader.rs b/yazi-binding/src/config/preloader.rs index 6564158a..1d81e0eb 100644 --- a/yazi-binding/src/config/preloader.rs +++ b/yazi-binding/src/config/preloader.rs @@ -63,13 +63,13 @@ impl FromLua for PreloaderMatcher { fn from_lua(value: Value, _: &Lua) -> mlua::Result { match value { Value::Table(t) => t.try_into(), - _ => return Err("expected a table of PreloaderMatcher".into_lua_err()), + _ => Err("expected a table of PreloaderMatcher".into_lua_err()), } } } impl IntoLua for PreloaderMatcher { fn into_lua(self, lua: &Lua) -> mlua::Result { - Iter::new(self.0.into_iter().map(Preloader::new), None).into_lua(lua) + Iter::new(self.0.map(Preloader::new), None).into_lua(lua) } } diff --git a/yazi-binding/src/config/previewer.rs b/yazi-binding/src/config/previewer.rs index 2aa4f463..4863a972 100644 --- a/yazi-binding/src/config/previewer.rs +++ b/yazi-binding/src/config/previewer.rs @@ -73,13 +73,13 @@ impl FromLua for PreviewerMatcher { fn from_lua(value: Value, _: &Lua) -> mlua::Result { match value { Value::Table(t) => t.try_into(), - _ => return Err("expected a table of PreviewerMatcher".into_lua_err()), + _ => Err("expected a table of PreviewerMatcher".into_lua_err()), } } } impl IntoLua for PreviewerMatcher { fn into_lua(self, lua: &Lua) -> mlua::Result { - Iter::new(self.0.into_iter().map(Previewer::new), None).into_lua(lua) + Iter::new(self.0.map(Previewer::new), None).into_lua(lua) } } diff --git a/yazi-binding/src/config/spotter.rs b/yazi-binding/src/config/spotter.rs index 9a425496..719331ff 100644 --- a/yazi-binding/src/config/spotter.rs +++ b/yazi-binding/src/config/spotter.rs @@ -63,13 +63,13 @@ impl FromLua for SpotterMatcher { fn from_lua(value: Value, _: &Lua) -> mlua::Result { match value { Value::Table(t) => t.try_into(), - _ => return Err("expected a table of SpotterMatcher".into_lua_err()), + _ => Err("expected a table of SpotterMatcher".into_lua_err()), } } } impl IntoLua for SpotterMatcher { fn into_lua(self, lua: &Lua) -> mlua::Result { - Iter::new(self.0.into_iter().map(Spotter::new), None).into_lua(lua) + Iter::new(self.0.map(Spotter::new), None).into_lua(lua) } } diff --git a/yazi-binding/src/elements/color.rs b/yazi-binding/src/elements/color.rs index 8594443c..503f6d5d 100644 --- a/yazi-binding/src/elements/color.rs +++ b/yazi-binding/src/elements/color.rs @@ -7,7 +7,7 @@ pub struct Color(pub ratatui::style::Color); impl Color { pub fn compose(lua: &Lua) -> mlua::Result { - let new = lua.create_function(|_, (_, color): (Table, Color)| Ok(color))?; + let new = lua.create_function(|_, (_, color): (Table, Self)| Ok(color))?; let color = lua.create_table()?; color.set_metatable(Some(lua.create_table_from([(MetaMethod::Call.name(), new)])?))?; diff --git a/yazi-binding/src/style.rs b/yazi-binding/src/style.rs index 0bbd0d97..45592ef2 100644 --- a/yazi-binding/src/style.rs +++ b/yazi-binding/src/style.rs @@ -20,7 +20,7 @@ impl From for Style { } impl From