Open lilyball opened 3 years ago
After looking into proc macros some more, I'm pretty sure this isn't possible.
What should be possible though is writing an oid_tree!()
macro that lets you define a whole set of OIDs, where base OIDs can have children that are prefixed by the base. I'm currently working on such a macro for my own project, but I'd love to see this crate offer it directly.
@lilyball We can probably achieve this with changes like https://github.com/rusticata/der-parser/pull/45
I would love to see that at build time, but I don't think there is a way to resolve a symbol value in a proc-macro (or macro). Maybe #45 is a solution (see the PR for discussion).
I would really like to be able to concatenate relative OIDs onto base OIDs at compile-time. I'm not sure if this is actually possible, but I want to be able to write something like
Or some alternative syntax that achieves the same thing. I don't know if there's any way to achieve this without heap allocation. I really wish Rust had built-in syntax for "please flatten this array into the enclosing array literal".
The goal here is of course to be able to represent a tree of OIDs using a similar structure to how they're declared in ASN.1, instead of having to repeat the OID base everywhere.