File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
branches/snap-stage3/src/libstd Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 96c1082f0fdbbe5258cfc1dc37f83052feff8421
4
+ refs/heads/snap-stage3: 5a9b33a76d76a77d2ced1c2430a25faa0f284071
5
5
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -200,6 +200,20 @@ impl<T> Option<T> {
200
200
match self { None => def, Some ( v) => f ( v) }
201
201
}
202
202
203
+ /// As `map_consume`, but swaps a None into the original option rather
204
+ /// than consuming it by-value.
205
+ #[ inline]
206
+ pub fn take_map < U > ( & mut self , blk : & fn ( T ) -> U ) -> Option < U > {
207
+ util:: replace ( self , None ) . map_consume ( blk)
208
+ }
209
+
210
+ /// As `map_consume_default`, but swaps a None into the original option
211
+ /// rather than consuming it by-value.
212
+ #[ inline]
213
+ pub fn take_map_default < U > ( & mut self , def : U , blk : & fn ( T ) -> U ) -> U {
214
+ util:: replace ( self , None ) . map_consume_default ( def, blk)
215
+ }
216
+
203
217
/// Apply a function to the contained value or do nothing
204
218
pub fn mutate ( & mut self , f : & fn ( T ) -> T ) {
205
219
if self . is_some ( ) {
You can’t perform that action at this time.
0 commit comments