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
_variant
This should work:
#[derive(Display)] #[display("{_0}")] enum Enum<T> { #[display("A")] A(i32), #[display("B")] B(&'static str), #[display("C")] C(T), } fn main() { assert_eq!(Enum::<u8>::A(1).to_string(), "A"); assert_eq!(Enum::<u8>::B("abc").to_string(), "B"); assert_eq!(Enum::<u8>::C(9).to_string(), "C"); }
As well as:
#[derive(Display)] #[display("some content: {_0}")] enum Enum<T> { #[display("A")] A(i32), B(&'static str), C(T), } fn main() { assert_eq!(Enum::<u8>::A(1).to_string(), "A"); assert_eq!(Enum::<u8>::B("abc").to_string(), "some content: abc"); assert_eq!(Enum::<u8>::C(9).to_string(), "some content: 9"); }
Related to #395. Note that transparence checks should also work as expected.
The text was updated successfully, but these errors were encountered:
tyranron
No branches or pull requests
This should work:
As well as:
Related to #395. Note that transparence checks should also work as expected.
The text was updated successfully, but these errors were encountered: