#![cfg(feature = "testing")] use askama_enum::EnumTemplate; #[derive(EnumTemplate)] #[template(ext = "txt", source = "DEFAULT")] enum MyEnum<'a, T> where T: std::fmt::Display, { A, #[template(ext = "html", source = "x{{self.0}}y")] B(&'a T), #[template(ext = "txt", source = "{{some}}|{{more}}|{{fields}}")] C { some: T, more: u32, fields: &'a str, }, } #[test] fn test() { assert_eq!(MyEnum::A::.to_string(), "DEFAULT"); assert_eq!(MyEnum::B(&"").to_string(), "x<hello>y"); assert_eq!( MyEnum::C { some: "", more: 123, fields: "bye", } .to_string(), "|123|bye" ); }