Skip to content

Commit a01e4df

Browse files
authored
Rollup merge of rust-lang#98061 - WaffleLapkin:own_the_option, r=joshtriplett
Add `Option::owned` This PR adds the following public library APIs: ```rust impl<T: ?Sized> Option<&T> { pub const fn owned(self) -> Option<T::Owned> where T: ~const ToOwned; } impl<T: ?Sized> Option<&mut T> { pub fn owned(self) -> Option<T::Owned> where T: ~const ToOwned; } ``` `Option::owned` is similar to `Option::cloned` and `Option::copied`, but uses the `ToOwned` trait. --- I thought that would be easier, but since `ToOwned` is defined in the alloc crate this becomes incoherent :')
2 parents 33d3519 + 2a6f61c commit a01e4df

File tree

6 files changed

+1155
-4
lines changed

6 files changed

+1155
-4
lines changed

library/alloc/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ pub mod collections;
230230
#[cfg(all(not(no_rc), not(no_sync), not(no_global_oom_handling)))]
231231
pub mod ffi;
232232
pub mod fmt;
233+
pub mod option;
233234
#[cfg(not(no_rc))]
234235
pub mod rc;
236+
pub mod result;
235237
pub mod slice;
236238
pub mod str;
237239
pub mod string;

0 commit comments

Comments
 (0)