2 ms·
Actually the last two `.iter()` aren't needed at all because of IntoIter. All three can all be removed if you use Itertools' izip! let codes: Vec<_> =
by Veedrac 10y ago
Actually the last two `.iter()` aren't needed at all because of IntoIter. All three can all be removed if you use Itertools' izip!
let codes: Vec<_> =
izip!(&data_table, code_lengths, code_table)
.map(|(&value, length, code)| {
HuffmanCode {
length: length,
code: code,
value: value,
}
})
.collect();
(If HuffmanCode was a tuple type, this could even be
#![feature(fn_traits)]
let codes: Vec<_> =
izip!(data_table.iter().cloned(), code_lengths, code_table)
.map(|args| (&HuffmanCode).call(args))
.collect();
but now I'm just playing around.)