Function number_encoding::combinadics::decode_mut
source · [−]Expand description
Writes the combination of a value to a slice.
The written combination can be encoded with encode
to get back n
.
let mut xs = vec![0; k];
decode_mut(n, k, &mut xs);
assert_eq!(encode(&xs), n);
See decode
for a version that allocates a vector for the combination.
Panics
Panics in debug mode if n > 0 && k == 0
.