@@ -43,46 +43,6 @@ cfg_if! {
43
43
use std:: ops:: Add ;
44
44
use std:: panic:: { resume_unwind, catch_unwind, AssertUnwindSafe } ;
45
45
46
- /// This is a single threaded variant of AtomicCell provided by crossbeam.
47
- /// Unlike `Atomic` this is intended for all `Copy` types,
48
- /// but it lacks the explicit ordering arguments.
49
- #[ derive( Debug ) ]
50
- pub struct AtomicCell <T : Copy >( Cell <T >) ;
51
-
52
- impl <T : Copy > AtomicCell <T > {
53
- #[ inline]
54
- pub fn new( v: T ) -> Self {
55
- AtomicCell ( Cell :: new( v) )
56
- }
57
-
58
- #[ inline]
59
- pub fn get_mut( & mut self ) -> & mut T {
60
- self . 0 . get_mut( )
61
- }
62
- }
63
-
64
- impl <T : Copy > AtomicCell <T > {
65
- #[ inline]
66
- pub fn into_inner( self ) -> T {
67
- self . 0 . into_inner( )
68
- }
69
-
70
- #[ inline]
71
- pub fn load( & self ) -> T {
72
- self . 0 . get( )
73
- }
74
-
75
- #[ inline]
76
- pub fn store( & self , val: T ) {
77
- self . 0 . set( val)
78
- }
79
-
80
- #[ inline]
81
- pub fn swap( & self , val: T ) -> T {
82
- self . 0 . replace( val)
83
- }
84
- }
85
-
86
46
/// This is a single threaded variant of `AtomicU64`, `AtomicUsize`, etc.
87
47
/// It differs from `AtomicCell` in that it has explicit ordering arguments
88
48
/// and is only intended for use with the native atomic types.
@@ -99,11 +59,6 @@ cfg_if! {
99
59
}
100
60
101
61
impl <T : Copy > Atomic <T > {
102
- #[ inline]
103
- pub fn into_inner( self ) -> T {
104
- self . 0 . into_inner( )
105
- }
106
-
107
62
#[ inline]
108
63
pub fn load( & self , _: Ordering ) -> T {
109
64
self . 0 . get( )
@@ -113,11 +68,6 @@ cfg_if! {
113
68
pub fn store( & self , val: T , _: Ordering ) {
114
69
self . 0 . set( val)
115
70
}
116
-
117
- #[ inline]
118
- pub fn swap( & self , val: T , _: Ordering ) -> T {
119
- self . 0 . replace( val)
120
- }
121
71
}
122
72
123
73
impl <T : Copy + PartialEq > Atomic <T > {
@@ -159,22 +109,6 @@ cfg_if! {
159
109
( oper_a( ) , oper_b( ) )
160
110
}
161
111
162
- pub struct SerialScope ;
163
-
164
- impl SerialScope {
165
- pub fn spawn<F >( & self , f: F )
166
- where F : FnOnce ( & SerialScope )
167
- {
168
- f( self )
169
- }
170
- }
171
-
172
- pub fn scope<F , R >( f: F ) -> R
173
- where F : FnOnce ( & SerialScope ) -> R
174
- {
175
- f( & SerialScope )
176
- }
177
-
178
112
#[ macro_export]
179
113
macro_rules! parallel {
180
114
( $( $blocks: tt) , * ) => {
@@ -246,12 +180,6 @@ cfg_if! {
246
180
pub fn new<F : FnMut ( usize ) -> T >( mut f: F ) -> WorkerLocal <T > {
247
181
WorkerLocal ( OneThread :: new( f( 0 ) ) )
248
182
}
249
-
250
- /// Returns the worker-local value for each thread
251
- #[ inline]
252
- pub fn into_inner( self ) -> Vec <T > {
253
- vec![ OneThread :: into_inner( self . 0 ) ]
254
- }
255
183
}
256
184
257
185
impl <T > Deref for WorkerLocal <T > {
@@ -279,16 +207,6 @@ cfg_if! {
279
207
self . 0
280
208
}
281
209
282
- #[ inline( always) ]
283
- pub fn get_mut( & mut self ) -> & mut T {
284
- & mut self . 0
285
- }
286
-
287
- #[ inline( always) ]
288
- pub fn lock( & self ) -> & T {
289
- & self . 0
290
- }
291
-
292
210
#[ inline( always) ]
293
211
pub fn lock_mut( & mut self ) -> & mut T {
294
212
& mut self . 0
@@ -318,8 +236,6 @@ cfg_if! {
318
236
319
237
pub use std:: sync:: atomic:: { AtomicBool , AtomicUsize , AtomicU32 , AtomicU64 } ;
320
238
321
- pub use crossbeam_utils:: atomic:: AtomicCell ;
322
-
323
239
pub use std:: sync:: Arc as Lrc ;
324
240
pub use std:: sync:: Weak as Weak ;
325
241
@@ -521,16 +437,6 @@ impl<T> RwLock<T> {
521
437
RwLock ( InnerRwLock :: new ( inner) )
522
438
}
523
439
524
- #[ inline( always) ]
525
- pub fn into_inner ( self ) -> T {
526
- self . 0 . into_inner ( )
527
- }
528
-
529
- #[ inline( always) ]
530
- pub fn get_mut ( & mut self ) -> & mut T {
531
- self . 0 . get_mut ( )
532
- }
533
-
534
440
#[ cfg( not( parallel_compiler) ) ]
535
441
#[ inline( always) ]
536
442
pub fn read ( & self ) -> ReadGuard < ' _ , T > {
@@ -547,11 +453,6 @@ impl<T> RwLock<T> {
547
453
}
548
454
}
549
455
550
- #[ inline( always) ]
551
- pub fn with_read_lock < F : FnOnce ( & T ) -> R , R > ( & self , f : F ) -> R {
552
- f ( & * self . read ( ) )
553
- }
554
-
555
456
#[ cfg( not( parallel_compiler) ) ]
556
457
#[ inline( always) ]
557
458
pub fn try_write ( & self ) -> Result < WriteGuard < ' _ , T > , ( ) > {
@@ -580,11 +481,6 @@ impl<T> RwLock<T> {
580
481
}
581
482
}
582
483
583
- #[ inline( always) ]
584
- pub fn with_write_lock < F : FnOnce ( & mut T ) -> R , R > ( & self , f : F ) -> R {
585
- f ( & mut * self . write ( ) )
586
- }
587
-
588
484
#[ inline( always) ]
589
485
pub fn borrow ( & self ) -> ReadGuard < ' _ , T > {
590
486
self . read ( )
@@ -633,12 +529,6 @@ impl<T> OneThread<T> {
633
529
inner,
634
530
}
635
531
}
636
-
637
- #[ inline( always) ]
638
- pub fn into_inner ( value : Self ) -> T {
639
- value. check ( ) ;
640
- value. inner
641
- }
642
532
}
643
533
644
534
impl < T > Deref for OneThread < T > {
0 commit comments