File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
branches/snap-stage3/src/libstd Expand file tree Collapse file tree 2 files changed +9
-3
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: e07ae9e6f9196096697935b96667ec272b039ad9
4
+ refs/heads/snap-stage3: 96ae000812079b284011571dc18fed0d1fb433d8
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 @@ -161,7 +161,7 @@ impl<T> Option<T> {
161
161
162
162
/// Filters an optional value using given function.
163
163
#[ 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 > {
165
165
match self {
166
166
Some ( x) => if ( f ( & x) ) { Some ( x) } else { None } ,
167
167
None => None
@@ -170,10 +170,16 @@ impl<T> Option<T> {
170
170
171
171
/// Maps a `some` value from one type to another by reference
172
172
#[ 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 > {
174
174
match * self { Some ( ref x) => Some ( f ( x) ) , None => None }
175
175
}
176
176
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
+
177
183
/// As `map`, but consumes the option and gives `f` ownership to avoid
178
184
/// copying.
179
185
#[ inline]
You can’t perform that action at this time.
0 commit comments