-
Notifications
You must be signed in to change notification settings - Fork 144
der: add IsConstructed
trait, impl'ed on any FixedTag
#1744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
der: add IsConstructed
trait, impl'ed on any FixedTag
#1744
Conversation
This doesn't seem to do a whole lot as-is. What else are you planning on impl'ing |
On trait |
If I remember correctly, the edge case is here: So it's a CHOICE with |
You should try to add it there, as I think for what you’re proposing the blanket impls(?) would conflict |
It will take me some time to recreate the |
I give up. It's pretty much impossible to implement this case in current #[derive(Choice)]
pub enum ObjectValue<T>
where
for<'a> T: /* what to put here ? */,
{
Indirect(Path),
#[asn1(context_specific = "0", tag_mode = "IMPLICIT")]
Direct(T),
} [Spoiler] error[E0277]
So
|
Btw /// ```asn1
/// ReferencedValue {Type} ::= CHOICE {
/// path Path,
/// url URL
/// }
/// URL ::= CHOICE {
/// url CHOICE {
/// printable PrintableString,
/// ia5 IA5String
/// },
/// urlWithDigest [3] SEQUENCE {
/// url IA5String,
/// digest DigestInfoWithDefault
/// }
/// }
/// ```
#[derive(Choice, Clone, Debug, Eq, PartialEq)]
#[tag_mode = "IMPLICIT"]
pub enum ReferencedValue {
Path(Path),
PrintableStringUrl(PrintableString),
Ia5StringUrl(Ia5String),
#[asn1(context_specific = "3")]
UrlWithDigest(()),
} |
dda1215
to
5ee5ef6
Compare
5ee5ef6
to
be4197a
Compare
Nice. NegHints ::= SEQUENCE {
hintName[0] GeneralString OPTIONAL,
|
3a595d8
to
26d6959
Compare
der_derive: impl IsConstructed on derive(Choice) der: draft of test for IsConstructed vs Tagged edge case der: test: generic CHOICE inside [0] IMPLICIT CHOICE Revert "der: test: generic CHOICE inside [0] IMPLICIT CHOICE" This reverts commit dda1215. Revert "der: draft of test for IsConstructed vs Tagged edge case" This reverts commit 5daa9ba. der: add IsConstructed test docs der: format tests simplify IsConstructed test
26d6959
to
5115c1a
Compare
Closes #1741
Depends on:
NegHints::hint_name
to GeneralStringRef type #1779This PR drops the need to implement
Tagged
on all structs that are IMPLICIT.Such change simplifies trait bounds for generic
IMPLICIT
fields and enforces strictconst
constructed bit check.