this post was submitted on 19 Jun 2023
4 points (100.0% liked)
Rust Programming
8191 readers
3 users here now
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
You might be able to make num a newtype and make a custom implementation of the Add trait for it that checks that it is in bounds