This commit is contained in:
sxyazi 2025-12-19 00:19:32 +08:00
parent a262ff3496
commit 51214351a8
No known key found for this signature in database

View file

@ -21,17 +21,20 @@ impl Utils {
} }
let (tx, mut rx) = mpsc::channel::<usize>(1); let (tx, mut rx) = mpsc::channel::<usize>(1);
let mut cands = Vec::with_capacity(t.raw_len()); let cands: Vec<_> = t
.raw_get::<Table>("cands")?
for (i, cand) in t.raw_get::<Table>("cands")?.sequence_values::<Table>().enumerate() { .sequence_values::<Table>()
.enumerate()
.map(|(i, cand)| {
let cand = cand?; let cand = cand?;
cands.push(Chord { Ok(Chord {
on: Self::parse_keys(cand.raw_get("on")?)?, on: Self::parse_keys(cand.raw_get("on")?)?,
run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())], run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())],
desc: cand.raw_get("desc").ok(), desc: cand.raw_get("desc").ok(),
r#for: None, r#for: None,
}); })
} })
.collect::<mlua::Result<_>>()?;
drop(tx); drop(tx);
WhichProxy::show(ShowOpt { cands, silent: t.raw_get("silent").unwrap_or_default() }); WhichProxy::show(ShowOpt { cands, silent: t.raw_get("silent").unwrap_or_default() });