Skip to content

Commit 66d16b0

Browse files
committed
---
yaml --- r: 34541 b: refs/heads/snap-stage3 c: a33966b h: refs/heads/master i: 34539: 4b94fcc v: v3
1 parent c6dd13b commit 66d16b0

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e4571446f99ddb45667c925d6e4d2c76e0ff1ee8
4+
refs/heads/snap-stage3: a33966b2f2a93b5108d0fd4464b18912da270e15
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/tutorial-macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ to transcribe into the macro expansion; its type need not be repeated.
115115
The right-hand side must be enclosed by delimiters, which are ignored by the
116116
transcriber (therefore `() => ((1,2,3))` is a macro that expands to a tuple
117117
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).
119119

120120
Except for permissibility of `$name` (and `$(...)*`, discussed below), the
121121
right-hand side of a macro definition is ordinary Rust syntax. In particular,

branches/snap-stage3/src/libcore/option.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,13 @@ impl<T> Option<T> {
264264
#[inline(always)]
265265
pure fn map<U>(&self, f: fn(x: &T) -> U) -> Option<U> { map(self, f) }
266266

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+
267274
/// Applies a function to the contained value or returns a default
268275
#[inline(always)]
269276
pure fn map_default<U>(&self, def: U, f: fn(x: &T) -> U) -> U {
@@ -301,6 +308,17 @@ impl<T> Option<T> {
301308
#[inline(always)]
302309
pure fn unwrap(self) -> T { unwrap(self) }
303310

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+
304322
/**
305323
* Gets the value out of an option, printing a specified message on
306324
* failure

0 commit comments

Comments
 (0)