The high-level encode function is still slightly unergonomic for the common use case of encoding a whole number of bytes.
As far as i can tell, the only errors possible for encode are:
bits doesn't match length of input
- total encoded value will exceed the ability to allocate RAM
For the common use case it would be nice to have something like:
pub fn encode_full_bytes(input: &[u8]) -> Result(String, ZBase32Error)
or even (treating memory allocation failures as unrecoverable errors):
pub fn encode_full_bytes(input: &[u8]) -> String
(this latter interface is offered by the popular zbase32 crate, so implementing it would make it easier for people to move from zbase32 to this implementation)
The high-level
encodefunction is still slightly unergonomic for the common use case of encoding a whole number of bytes.As far as i can tell, the only errors possible for
encodeare:bitsdoesn't match length ofinputFor the common use case it would be nice to have something like:
or even (treating memory allocation failures as unrecoverable errors):
(this latter interface is offered by the popular
zbase32crate, so implementing it would make it easier for people to move fromzbase32to this implementation)