mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Update option.rs
This commit is contained in:
parent
8e9c93df46
commit
4411d5fcc7
@ -842,6 +842,7 @@ impl<T> Option<T> {
|
||||
/// ```
|
||||
/// let good_year_from_input = "1909";
|
||||
/// let bad_year_from_input = "190blarg";
|
||||
/// // Result::ok() converts a Result<T> to an Option<T>
|
||||
/// let good_year = good_year_from_input.parse().ok().unwrap_or_default();
|
||||
/// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user