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>()
let cand = cand?; .enumerate()
cands.push(Chord { .map(|(i, cand)| {
on: Self::parse_keys(cand.raw_get("on")?)?, let cand = cand?;
run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())], Ok(Chord {
desc: cand.raw_get("desc").ok(), on: Self::parse_keys(cand.raw_get("on")?)?,
r#for: None, run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())],
}); desc: cand.raw_get("desc").ok(),
} 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() });