Hacker News new | ask | show | jobs
by QuantumNomad_ 200 days ago
Also 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.