Instead of taking/returning slice/Vec<...> the functions could take impl Iterator<Item=[u8; 2]>/return impl Iterator<Item=...> so that callers that don't need Vec do not need to allocate at all. (E.g. this is the case if the user wants to just write out the passphrase.) Requiring Item=[u8; 2] also side steps the evenness check completely.
I think with these adjustments it should be possible to make whole crate allocation-free. The current methods can be kept for backwards compatibility or as helpers for people who don't want to mess with iterators
Instead of taking/returning slice/
Vec<...>the functions could takeimpl Iterator<Item=[u8; 2]>/returnimpl Iterator<Item=...>so that callers that don't needVecdo not need to allocate at all. (E.g. this is the case if the user wants to just write out the passphrase.) RequiringItem=[u8; 2]also side steps the evenness check completely.I think with these adjustments it should be possible to make whole crate allocation-free. The current methods can be kept for backwards compatibility or as helpers for people who don't want to mess with iterators