Skip to content

der: why don't more ASN.1 types support conversion to Any(Ref)? #1983

@RickyDaMa

Description

@RickyDaMa

Hi there! I'm new to the RustCrypto libraries, so if I'm holding them wrong and there's a smooth way to go from one to the other, please point it out 😅

I'm trying to build an x509_cert::attr::Attribute by hand using constants. What I'd like to do is something like this:

let attr = Attribute {
    oid: SPC_LINK,
    values: SetOfVec::from_iter(
        [BitString::from_bytes(&[0x00]).unwrap().into()] // .into() here converts BitString to Any
    ).unwrap(),
};

Is there a reason why we don't have implementations such as From<BitStringRef<'a>> for AnyRef<'a>? If it's just a case of "no one has needed it yet", would you accept a PR for such things?

And on a similar note, could the derive macros also potentially implement Any conversion also? I guess you might struggle to distinguish between owned and borrowed structs to know which to implement (or how)

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