What is the idiomatic way to achieve ranged integers in Rust?

Viewed 207

In the Ada programming language, one can use the range constraint to declare that the value of a signed integer has to be within a minimum and maximum. An exception is triggered if not, for example.

What is the idiomatic way to achieve this in Rust?

1 Answers
Related