Post #2227731
2025-11-19 08:16 UTC
@Mara@hachyderm.io
But wouldn't that make the API inconsistent? Since the other or*() methods don't change the type.
I guess there are quite a few Rust methods with innocent sounding names that can panic. clamp() is one I'm always wary of. There's also the ones that allocate memory, like for Vec and String.
#RustLang
Replies (1)
-
@tdelmas@mamot.fr 2025-11-19 09:07
@ygor@floss.social @Mara@hachyderm.io On an `Option`, the output type of `unwrap_or_default` is `T`. The output type of `unwrap_or_panic` would also be `T`. Or am I missing something?