4 ms·
Yes that was a mistake. unwrap() is the error. unwrap_or() is the fallback.
by paulddraper 11mo ago
Yes that was a mistake.
unwrap() is the error.
unwrap_or() is the fallback.
- QuantumNomad_ 11mo agoAlso unwrap_or_default() which is useful in many cases. For example the default for a string is empty string, default for integers is 0 and default for bool is false. For your own types you can implement the Default trait to tell Rust what the default value is for that type.