oxidecomputer / oxidecomputer/omicron
Want types for representing non-empty collections
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
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:
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with sled-agent/types/versions/src/multiple_zone_external_ips/inventory.rs, especially the referenced type, and review the constructors and deserializers that currently verify non-emptiness. Determine the scope and design for representing non-empty collections at the type level; done means relevant callers no longer need repeated unwrap checks for an invariant already guaranteed by the type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100