Compare commits

...

2 commits

Author SHA1 Message Date
f678bcc929 Merge branch 'v0' of ssh://ssh.spbr.net:51122/spacebar/rust-nex into v0
All checks were successful
Build and Test / fast-racing-neo (push) Successful in 2m13s
Build and Test / splatoon (push) Successful in 2m38s
Build and Test / wii-u-chat (push) Successful in 2m59s
Build and Test / wii-sports-club (push) Successful in 3m17s
Build and Test / mario-tennis (push) Successful in 3m36s
Build and Test / friends (push) Successful in 3m52s
Build and Test / splatoon-testfire (push) Successful in 4m16s
Build and Test / super-mario-maker (push) Successful in 5m42s
Build and Test / puyopuyo (push) Successful in 6m7s
Build and Test / minecraft-wiiu (push) Successful in 6m26s
2026-05-05 18:03:20 +02:00
e8f5ff3c24 fix stringset 2026-05-05 18:03:00 +02:00

View file

@ -36,13 +36,18 @@ 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(s.split("|").map(T::from_str).try_fold( Ok(Self(
HashSet::new(), s.split("|")
|mut a, b| -> Result<HashSet<T>, Self::Err> { .filter(|v| !v.is_empty())
a.insert(b.map_err(Box::new)?); .map(T::from_str)
Ok(a) .try_fold(
}, HashSet::new(),
)?)) |mut a, b| -> Result<HashSet<T>, Self::Err> {
a.insert(b.map_err(Box::new)?);
Ok(a)
},
)?,
))
} }
} }
@ -82,5 +87,9 @@ 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();
} }
} }