microtype_macro::microtype! { #[secret(serialize)] String { Token } #[secret] String { Password } } fn main() { use microtype::SecretMicrotype; let token = Token::new("asdf".into()); assert_serialize(token.clone()); assert_deserialize(token); let password = Password::new("asdf".into()); assert_deserialize(password); } fn assert_serialize(_t: T) {} fn assert_deserialize<'a, T: serde::Deserialize<'a>>(_t: T) {}