From f53ced6281d33673909244ed08c8d87f8c1f42f6 Mon Sep 17 00:00:00 2001 From: Luna Yao <40349250+ZnqbuZ@users.noreply.github.com> Date: Fri, 20 Feb 2026 22:27:55 +0100 Subject: [PATCH] utils: update MapTryInto to match behaviour of itertools --- easytier/src/utils.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/easytier/src/utils.rs b/easytier/src/utils.rs index bc964cd9..d2933ef2 100644 --- a/easytier/src/utils.rs +++ b/easytier/src/utils.rs @@ -162,15 +162,13 @@ pub trait DeterministicDigest: Serialize { impl DeterministicDigest for S {} -pub trait MapTryInto { - fn map_try_into>(self) -> impl Iterator>; -} - -impl MapTryInto for I -where - I: IntoIterator, -{ - fn map_try_into>(self) -> impl Iterator> { - self.into_iter().map(T::try_from) +pub trait MapTryInto: Iterator + Sized { + fn map_try_into(self) -> impl Iterator>::Error>> + where + Self::Item: TryInto, + { + self.into_iter().map(Self::Item::try_into) } } + +impl MapTryInto for T where T: Iterator + Sized {}