Hi, what would you find to be the most elegant way to check if a value is in a range?
match yearday {
0...366 => {
// do stuff here
},
_ => panic!
}
or
if let 0...366 = yearday {
// do stuff here
}
I see that the if let scenario is shorter, I just feel like it's a misuse of the binding keyword let since there is no actual destructuring taking place.
Thanks
For dates the range should probably be inclusive at both ends, but for completeness you probably want four range objects for each kind of range (] [) (). It should probably be four range types and a single contains trait function as the inclusive/exclusiveness is a property of the range.