File tree Expand file tree Collapse file tree 1 file changed +0
-19
lines changed
Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Original file line number Diff line number Diff line change @@ -23,25 +23,6 @@ pub fn id<T>(x: T) -> T { x }
2323#[ inline]
2424pub fn ignore < T > ( _x : T ) { }
2525
26- /// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the
27- /// original value of `*ptr`.
28- ///
29- /// NB: This function accepts `@mut T` and not `&mut T` to avoid
30- /// an obvious borrowck hazard. Typically passing in `&mut T` will
31- /// cause borrow check errors because it freezes whatever location
32- /// that `&mut T` is stored in (either statically or dynamically).
33- #[ inline]
34- pub fn with < T , R > (
35- ptr : @mut T ,
36- value : T ,
37- op : & fn ( ) -> R ) -> R
38- {
39- let prev = replace ( ptr, value) ;
40- let result = op ( ) ;
41- * ptr = prev;
42- return result;
43- }
44-
4526/**
4627 * Swap the values at two mutable locations of the same type, without
4728 * deinitialising or copying either one.
You can’t perform that action at this time.
0 commit comments