feat: impl ToXml for Box<T>

This commit is contained in:
gibbz00 2024-10-18 18:47:23 +02:00 committed by Dirkjan Ochtman
parent 0f641fdc1a
commit f17e2e0350
1 changed files with 10 additions and 0 deletions

View File

@ -488,6 +488,16 @@ impl<T: ToXml> ToXml for Option<T> {
} }
} }
impl<T: ToXml + ?Sized> ToXml for Box<T> {
fn serialize<W: fmt::Write + ?Sized>(
&self,
field: Option<Id<'_>>,
serializer: &mut Serializer<W>,
) -> Result<(), Error> {
self.as_ref().serialize(field, serializer)
}
}
fn encode(input: &str) -> Result<Cow<'_, str>, Error> { fn encode(input: &str) -> Result<Cow<'_, str>, Error> {
let mut result = String::with_capacity(input.len()); let mut result = String::with_capacity(input.len());
let mut last_end = 0; let mut last_end = 0;