Skip to content

Evaluate fixed-array serde helper ergonomics and stream reset #15

Open

Description

@tisonkun

Context

With feature = "serde", Vec<u8> fields use a single #[serde(with = "bases::Base64")] attribute, whereas [u8; N] fields in bases/src/serde.rs currently require specifying both serialize_with = "...::serialize" and deserialize_with = "...::deserialize_array", and Option fields require custom glue. Separately, Encoder<C> and Decoder<C> in bases/src/stream.rs can be reset by reassignment (*enc = C::encoder()), but do not expose an explicit reset(&mut self) method.

Considerations

  • Evaluate adding a zero-sized bases::serde::Array<C, const N: usize> adapter so fixed-size digests and keys can use #[serde(with = "...")] in one line (including in no_std without alloc), and check whether Option adapters are warranted.
  • Decide whether Encoder::reset(&mut self) and Decoder::reset(&mut self) improve clarity for reusable stream wrappers or are redundant with C::encoder() / Default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions