mirror of
https://github.com/ElnuDev/rust-jmdict.git
synced 2025-05-12 01:45:52 -07:00
kanji_info example: simplify using .inspect()
This commit is contained in:
parent
a709995cef
commit
e26e3b05cb
1 changed files with 17 additions and 21 deletions
|
@ -6,8 +6,8 @@
|
|||
fn main() {
|
||||
let input = "一日";
|
||||
let count = jmdict::entries()
|
||||
.filter(|e| {
|
||||
if e.kanji_elements().any(|k| k.text == input) {
|
||||
.filter(|e| e.kanji_elements().any(|k| k.text == input))
|
||||
.inspect(|e| {
|
||||
// note two entries have identical Kanji
|
||||
// yet differ in reading
|
||||
println!("--- entry #{} ---", e.number);
|
||||
|
@ -24,10 +24,6 @@ fn main() {
|
|||
println!("info: {:?}", info);
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
false
|
||||
})
|
||||
.count();
|
||||
println!("{} entries for {}", count, input);
|
||||
|
|
Loading…
Add table
Reference in a new issue