EnergySystemsModellingLab / MUSE_2.0

Welcome to the MUSE 2.0 repository
GNU General Public License v3.0
1 stars 0 forks source link

Consider using `nonempty` crate #96

Open alexdewar opened 2 weeks ago

alexdewar commented 2 weeks ago

I've come across this crate and it seems like it could be useful: https://crates.io/crates/nonempty

It provides a NonEmpty<T> type, which behaves (mostly) like a Vec, but guarantees that there is at least one element. Specifically for the input layer, there are a bunch of places where we want to ensure that Vecs are non-empty and this could be a nice way of expressing it...

What do you think @dalonsoa?

alexdewar commented 2 weeks ago

Alternatively, there's this: https://crates.io/crates/nonempty-collections

dalonsoa commented 2 weeks ago

The second one seems more flexible, but either look ok.

alexdewar commented 2 weeks ago

Not actually closed in #97