3 ms·
Probably because you'd want to access the value in either case, depending on your application.
by jcparkyn 4y ago
Probably because you'd want to access the value in either case, depending on your application.
- howinteresting 4y agoCould be a `Result<T, T>` which would seem to express the intent better.
- 3836293648 4y agoSometimes, sure. But an overflow doesn't have to be an error, it can be what you're after and you just want to know when it happens.
- howinteresting 4y agoBinary search is similar and the return type there is already Result<usize, usize>: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.binary_search https://doc.rust-lang.org/std/vec/struct.Vec.html#method.bin...