diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-07-24 23:18:06 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-07-24 23:53:37 -0400 |
| commit | cae0d11fa25160b38a411d4edd8a0f3b5b06df8c (patch) | |
| tree | ec90a0b7fbb5ccc9fda1fb8f2a81672d2587f9fc /ui/app.css | |
| parent | aec3eaeebd37bce9ab4dad14e7e86ef0db8f0c2d (diff) | |
Define ID types as specializations, rather than newtypes.
This is based heavily on the work done for normalized strings, in `crate::normalize`. The key realization in that module is that the logic distinguishing one kind of thing (normalized strings in that case, IDs, in this case) can be packaged up as a type token, and that doing so may reduce the overall complexity. This implementation for ID also borrows heavily from the implementation for normalized strings.
It's less flexible: an ID implemented this way can't expose _less_ of `crate::id::ID`'s interface, whereas newtype wrappers can, for example. However, our code doesn't use that flexiblity on purpose anywhere and we're relatively unlikely to change that. In return, the individual ID types require substantially less code - they do not, for example, need to re-implement `Display` for themselves.
I very nearly made the trait `Prefix`:
```rust
pub trait Prefix {
const PREFIX: &str;
}
```
however, I think having an effectively-constant method is less surprising overall.
Diffstat (limited to 'ui/app.css')
0 files changed, 0 insertions, 0 deletions
