File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: e4571446f99ddb45667c925d6e4d2c76e0ff1ee8
4
+ refs/heads/snap-stage3: a33966b2f2a93b5108d0fd4464b18912da270e15
5
5
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ to transcribe into the macro expansion; its type need not be repeated.
115
115
The right-hand side must be enclosed by delimiters, which are ignored by the
116
116
transcriber (therefore ` () => ((1,2,3)) ` is a macro that expands to a tuple
117
117
expression, ` () => (let $x=$val) ` is a macro that expands to a statement, and
118
- ` () => (1,2,3) ` is a macro that expands to a syntax error ).
118
+ ` () => (1,2,3) ` is a macro that expands to a syntax errror ).
119
119
120
120
Except for permissibility of ` $name ` (and ` $(...)* ` , discussed below), the
121
121
right-hand side of a macro definition is ordinary Rust syntax. In particular,
Original file line number Diff line number Diff line change @@ -264,6 +264,13 @@ impl<T> Option<T> {
264
264
#[ inline( always) ]
265
265
pure fn map < U > ( & self , f : fn ( x : & T ) -> U ) -> Option < U > { map ( self , f) }
266
266
267
+ /// As `map`, but consumes the option and gives `f` ownership to avoid
268
+ /// copying.
269
+ #[ inline( always) ]
270
+ pure fn map_consume < U > ( self , f : fn ( v : T ) -> U ) -> Option < U > {
271
+ map_consume ( self , f)
272
+ }
273
+
267
274
/// Applies a function to the contained value or returns a default
268
275
#[ inline( always) ]
269
276
pure fn map_default < U > ( & self , def : U , f : fn ( x : & T ) -> U ) -> U {
@@ -301,6 +308,17 @@ impl<T> Option<T> {
301
308
#[ inline( always) ]
302
309
pure fn unwrap ( self ) -> T { unwrap ( self ) }
303
310
311
+ /**
312
+ * The option dance. Moves a value out of an option type and returns it,
313
+ * replacing the original with `None`.
314
+ *
315
+ * # Failure
316
+ *
317
+ * Fails if the value equals `None`.
318
+ */
319
+ #[ inline( always) ]
320
+ fn swap_unwrap ( & mut self ) -> T { swap_unwrap ( self ) }
321
+
304
322
/**
305
323
* Gets the value out of an option, printing a specified message on
306
324
* failure
You can’t perform that action at this time.
0 commit comments