From e8f5ff3c24652425976a3ebc6a4e080e2e2d41e4 Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 5 May 2026 18:03:00 +0200 Subject: [PATCH] fix stringset --- rnex-core/src/rmc/structures/string_set.rs | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/rnex-core/src/rmc/structures/string_set.rs b/rnex-core/src/rmc/structures/string_set.rs index 9526a4e..f1b4884 100644 --- a/rnex-core/src/rmc/structures/string_set.rs +++ b/rnex-core/src/rmc/structures/string_set.rs @@ -36,13 +36,18 @@ where type Err = Box; fn from_str(s: &str) -> Result { - Ok(Self(s.split("|").map(T::from_str).try_fold( - HashSet::new(), - |mut a, b| -> Result, Self::Err> { - a.insert(b.map_err(Box::new)?); - Ok(a) - }, - )?)) + Ok(Self( + s.split("|") + .filter(|v| !v.is_empty()) + .map(T::from_str) + .try_fold( + HashSet::new(), + |mut a, b| -> Result, Self::Err> { + a.insert(b.map_err(Box::new)?); + Ok(a) + }, + )?, + )) } } @@ -82,5 +87,9 @@ mod test { panic!("sets arent equivalent"); } } + + let _: StringSet = StringSet::from_str("").unwrap(); + + let _: StringSet = StringSet::from_str("10").unwrap(); } }