Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
jcparkyn
on Jan 17, 2023
|
parent
|
context
|
favorite
| on:
Git security vulnerabilities announced
Probably because you'd want to access the value in either case, depending on your application.
howinteresting
on Jan 17, 2023
[–]
Could be a `Result<T, T>` which would seem to express the intent better.
3836293648
on Jan 17, 2023
|
parent
[–]
Sometimes, 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
on Jan 17, 2023
|
root
|
parent
[–]
Binary search is similar and the return type there is already Result<usize, usize>:
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.bin...
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: