We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that syntax matters for declaring generics and trait declarations.
I have the following struct:
#[derive(AsnType, Encode, Decode, Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] #[rasn(choice, automatic_tags)] pub enum RPermissions<T: CertExtType> { Content(T::Req), All(()), }
It does not compile, and if I expand Encode macro for example, CertExtType condition is not carried.
Encode
CertExtType
However, if I change syntax to following
#[derive(AsnType, Encode, Decode, Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] #[rasn(choice, automatic_tags)] pub enum RPermissions<T> where T: CertExtType, { Content(T::Req), All(()), }
Correct macro code is generated. I almost ended up writing custom functions, but noticed by accident. If someone else fights the same problem 😁 .
The text was updated successfully, but these errors were encountered:
Huh, the first code should work.
Sorry, something went wrong.
It seems to work when newtype style is used, for example
#[derive(AsnType, Debug, Decode, Encode, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] #[rasn(automatic_tags)] pub struct ContributedExtensionBlocks<T: ContributedExtension>( SequenceOf<ContributedExtensionBlock<T>>, );
Edit, nevermind, it won't. The compiler error was just hidden by other errors.
No branches or pull requests
It seems that syntax matters for declaring generics and trait declarations.
I have the following struct:
It does not compile, and if I expand
Encode
macro for example,CertExtType
condition is not carried.However, if I change syntax to following
Correct macro code is generated. I almost ended up writing custom functions, but noticed by accident. If someone else fights the same problem 😁 .
The text was updated successfully, but these errors were encountered: