Add blanket ToXml implementation for &impl ToXml

This commit is contained in:
Dirkjan Ochtman 2022-11-21 21:49:39 -08:00
parent d06d289103
commit 23abf75725
1 changed files with 11 additions and 0 deletions

View File

@ -22,6 +22,17 @@ pub trait ToXml {
const KIND: Kind;
}
impl<'a, T: ToXml + ?Sized> ToXml for &'a T {
fn serialize<W: fmt::Write + ?Sized>(
&self,
serializer: &mut Serializer<W>,
) -> Result<(), Error> {
(*self).serialize(serializer)
}
const KIND: Kind = T::KIND;
}
pub trait FromXml<'xml>: Sized {
fn deserialize<'cx>(deserializer: &'cx mut Deserializer<'cx, 'xml>) -> Result<Self, Error>;