I like in Ada's type system in that I can do constraints such as "type Positive is Integer range 1 .. Integer'Last;" to give me a number that I know must always be in the positive range of an integer, and it's easily readable in plain text.
From what I have read, trying to do something like "type Element is Integer range 100 .. 1000;" in rust requires something along the lines of
struct BoundedU16<const MIN: u16, const MAX: u16>(u16);
impl<const MIN: u16, const MAX: u16> BoundedU16<MIN, MAX> {
pub const fn new(value: u16) -> Result<Self, BoundError> {
if value >= MIN && value <= MAX {
Ok(Self(value))
} else {
Err(BoundError(value, MIN, MAX))
}
}
}