Skip to content

Commit 6d049f1

Browse files
committed
---
yaml --- r: 64086 b: refs/heads/snap-stage3 c: 96ae000 h: refs/heads/master v: v3
1 parent 1a418c0 commit 6d049f1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e07ae9e6f9196096697935b96667ec272b039ad9
4+
refs/heads/snap-stage3: 96ae000812079b284011571dc18fed0d1fb433d8
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<T> Option<T> {
161161

162162
/// Filters an optional value using given function.
163163
#[inline(always)]
164-
pub fn filtered<'a>(self, f: &fn(t: &'a T) -> bool) -> Option<T> {
164+
pub fn filtered(self, f: &fn(t: &T) -> bool) -> Option<T> {
165165
match self {
166166
Some(x) => if(f(&x)) {Some(x)} else {None},
167167
None => None
@@ -170,10 +170,16 @@ impl<T> Option<T> {
170170

171171
/// Maps a `some` value from one type to another by reference
172172
#[inline]
173-
pub fn map<'a, U>(&self, f: &fn(&'a T) -> U) -> Option<U> {
173+
pub fn map<'a, U>(&'a self, f: &fn(&'a T) -> U) -> Option<U> {
174174
match *self { Some(ref x) => Some(f(x)), None => None }
175175
}
176176

177+
/// Maps a `some` value from one type to another by a mutable reference
178+
#[inline]
179+
pub fn map_mut<'a, U>(&'a mut self, f: &fn(&'a mut T) -> U) -> Option<U> {
180+
match *self { Some(ref mut x) => Some(f(x)), None => None }
181+
}
182+
177183
/// As `map`, but consumes the option and gives `f` ownership to avoid
178184
/// copying.
179185
#[inline]

0 commit comments

Comments
 (0)