There are a lot of places where we use containers of various kinds, but where we also know the containers can't be empty. This came up on #11236 in this comment. That refers to types like this one:
|
pub struct NexusExternalIps( |
|
#[schemars(length(min = 1, max = "MAX_ZONE_EXTERNAL_IPS"))] |
|
pub(crate) BTreeSet<IpAddr>, |
|
); |
We're checking in the various constructors and deserializers that the type can't be empty, something we'd like to continue to represent at the type level. That prevents needing to do things like container.iter().next().unwrap("this can't be empty") all over the place.
There are a lot of places where we use containers of various kinds, but where we also know the containers can't be empty. This came up on #11236 in this comment. That refers to types like this one:
omicron/sled-agent/types/versions/src/multiple_zone_external_ips/inventory.rs
Lines 76 to 79 in 9d95e0c
We're checking in the various constructors and deserializers that the type can't be empty, something we'd like to continue to represent at the type level. That prevents needing to do things like
container.iter().next().unwrap("this can't be empty")all over the place.