Skip to content

high-level API: simplify encoding a whole number of bytes #1

Open
@dkg

Description

@dkg

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions