use similar_asserts::assert_eq; use instant_xml::{from_str, to_string, FromXml, ToXml}; #[derive(Debug, Eq, FromXml, ToXml, PartialEq)] struct Foo { inner: T, } #[derive(Debug, Eq, FromXml, ToXml, PartialEq)] struct Bar { bar: String, } #[allow(clippy::disallowed_names)] // `foo` is not allowed #[test] fn serialize_generics() { let foo = Foo { inner: Bar { bar: "Bar".to_owned(), }, }; let xml = "Bar"; assert_eq!(to_string(&foo).unwrap(), xml); assert_eq!(from_str::>(xml).unwrap(), foo); }