From a7d556ce6f74ede8b3010a793489c16419407c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sun, 27 Apr 2025 12:31:37 +0200 Subject: [PATCH] xso: add useful note I tried to remove it, fell into that trap. Let's save the next person some work. --- xso/src/minidom_compat.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xso/src/minidom_compat.rs b/xso/src/minidom_compat.rs index 70428ce96dbb60fc4b92f0a25a1afb94372ed1b0..42f4ab0bdf896ecd3ac0a10a4fcee3df02e02bdd 100644 --- a/xso/src/minidom_compat.rs +++ b/xso/src/minidom_compat.rs @@ -454,6 +454,11 @@ where /// Helper struct to stream a struct which implements conversion /// to [`minidom::Element`]. +// NOTE to developers: The 'x lifetime looks unnecessary, but in fact we need +// it because of the `AsXml` signature. It requires the iterator type to have +// a lifetime parameter which matches the Item's lifetimes. Even though it +// would strictly be valid to return something with 'static lifetime when any +// other lifetime 'a is required, rustc doesn't let us do that. pub struct AsItemsViaElement<'x> { iter: EventToItem, lifetime_binding: PhantomData>,