Compare commits

..

No commits in common. "f678bcc92919c95fb91765aaa791a92838ae5ed6" and "d63fe663de9dc11a86aa7629e147384357451ab8" have entirely different histories.

View file

@ -36,18 +36,13 @@ where
type Err = Box<dyn std::error::Error + Send + Sync>; type Err = Box<dyn std::error::Error + Send + Sync>;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self( Ok(Self(s.split("|").map(T::from_str).try_fold(
s.split("|") HashSet::new(),
.filter(|v| !v.is_empty()) |mut a, b| -> Result<HashSet<T>, Self::Err> {
.map(T::from_str) a.insert(b.map_err(Box::new)?);
.try_fold( Ok(a)
HashSet::new(), },
|mut a, b| -> Result<HashSet<T>, Self::Err> { )?))
a.insert(b.map_err(Box::new)?);
Ok(a)
},
)?,
))
} }
} }
@ -87,9 +82,5 @@ mod test {
panic!("sets arent equivalent"); panic!("sets arent equivalent");
} }
} }
let _: StringSet<u32> = StringSet::from_str("").unwrap();
let _: StringSet<u32> = StringSet::from_str("10").unwrap();
} }
} }