-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.
Description
Originally suggested in #1278, an unwrap_or_put
method on Option<T>
would be useful, a common use case is lazy initialization. To illustrate the behaviour:
fn unwrap_or_put(&mut self, foo : T) -> T {
if self.is_none() { self = Some(foo); }
self.unwrap()
}
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.