Skip to content

cms builders: infallible methods with Result<_> return type #1989

@RickyDaMa

Description

@RickyDaMa

I'm only working with SignedData & SignerInfo, I haven't checked the other builders, but these methods are all infallible, why do they return Result<_>?

  • SignedDataBuilder::add_digest_algorithm
  • SignedDataBuilder::add_certificate
  • SignedDataBuilder::add_crl
  • SignerInfoBuilder::new
  • SignerInfoBuilder::add_signed_attribute
  • SignerInfoBuilder::add_unsigned_attribute

Would you be open to returning the unwrapped types? The current approach strikes me as unnecessary, and creates a lot of boilerplate in my specific use case where I'm using anyhow to catch errors, which relies on the std/core Error trait for ? coercion (not implemented on v0.2, though I can see it in the v0.3 prereleases).

Despite opening a few issues on this repo in a relatively short timeframe, I'd like to emphasise that my experience across several of the RustCrypto crates has been overwhelmingly positive! Everything I've wanted to do has an API/trait, has felt ergonomic, and has worked once it's compiled ❤️

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