2
2
3
3
use core:: borrow:: { Borrow , BorrowMut } ;
4
4
5
+ #[ cfg( any(
6
+ feature = "portable-atomic" ,
7
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
8
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
9
+ ) ) ]
10
+ use crate :: mpmc:: { MpMcQueueInner , MpMcQueueView } ;
11
+ #[ cfg( any(
12
+ feature = "portable-atomic" ,
13
+ target_has_atomic = "ptr" ,
14
+ has_atomic_load_store
15
+ ) ) ]
16
+ use crate :: spsc:: { QueueInner , QueueView } ;
5
17
use crate :: {
6
18
binary_heap:: { BinaryHeapInner , BinaryHeapView } ,
7
19
deque:: { DequeInner , DequeView } ,
8
20
histbuf:: { HistoryBufferInner , HistoryBufferView } ,
9
21
linear_map:: { LinearMapInner , LinearMapView } ,
10
- mpmc:: { MpMcQueueInner , MpMcQueueView } ,
11
22
sorted_linked_list:: { SortedLinkedListIndex , SortedLinkedListInner , SortedLinkedListView } ,
12
- spsc:: { QueueInner , QueueView } ,
13
23
string:: { StringInner , StringView } ,
14
24
vec:: VecInner ,
15
25
VecView ,
@@ -40,10 +50,20 @@ pub(crate) trait SealedStorage: Sized {
40
50
fn as_mut_histbuf_view < T > ( this : & mut HistoryBufferInner < T , Self > ) -> & mut HistoryBufferView < T >
41
51
where
42
52
Self : Storage ;
53
+ #[ cfg( any(
54
+ feature = "portable-atomic" ,
55
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
56
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
57
+ ) ) ]
43
58
/// Convert a `MpMcQueue` to a `MpMcQueueView`
44
59
fn as_mpmc_queue_view < T > ( this : & MpMcQueueInner < T , Self > ) -> & MpMcQueueView < T >
45
60
where
46
61
Self : Storage ;
62
+ #[ cfg( any(
63
+ feature = "portable-atomic" ,
64
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
65
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
66
+ ) ) ]
47
67
/// Convert a `MpMcQueue` to a `MpMcQueueView`
48
68
fn as_mut_mpmc_queue_view < T > ( this : & mut MpMcQueueInner < T , Self > ) -> & mut MpMcQueueView < T >
49
69
where
@@ -68,10 +88,20 @@ pub(crate) trait SealedStorage: Sized {
68
88
) -> & mut BinaryHeapView < T , K >
69
89
where
70
90
Self : Storage ;
91
+ #[ cfg( any(
92
+ feature = "portable-atomic" ,
93
+ target_has_atomic = "ptr" ,
94
+ has_atomic_load_store
95
+ ) ) ]
71
96
/// Convert a `Queue` to a `QueueView`
72
97
fn as_queue_view < T > ( this : & QueueInner < T , Self > ) -> & QueueView < T >
73
98
where
74
99
Self : Storage ;
100
+ #[ cfg( any(
101
+ feature = "portable-atomic" ,
102
+ target_has_atomic = "ptr" ,
103
+ has_atomic_load_store
104
+ ) ) ]
75
105
/// Convert a `Queue` to a `QueueView`
76
106
fn as_mut_queue_view < T > ( this : & mut QueueInner < T , Self > ) -> & mut QueueView < T >
77
107
where
@@ -159,10 +189,20 @@ impl<const N: usize> SealedStorage for OwnedStorage<N> {
159
189
) -> & mut SortedLinkedListView < T , Idx , K > {
160
190
this
161
191
}
192
+ #[ cfg( any(
193
+ feature = "portable-atomic" ,
194
+ target_has_atomic = "ptr" ,
195
+ has_atomic_load_store
196
+ ) ) ]
162
197
/// Convert a `Queue` to a `QueueView`
163
198
fn as_queue_view < T > ( this : & QueueInner < T , Self > ) -> & QueueView < T > {
164
199
this
165
200
}
201
+ #[ cfg( any(
202
+ feature = "portable-atomic" ,
203
+ target_has_atomic = "ptr" ,
204
+ has_atomic_load_store
205
+ ) ) ]
166
206
/// Convert a `Queue` to a `QueueView`
167
207
fn as_mut_queue_view < T > ( this : & mut QueueInner < T , Self > ) -> & mut QueueView < T > {
168
208
this
@@ -193,10 +233,20 @@ impl<const N: usize> SealedStorage for OwnedStorage<N> {
193
233
) -> & mut LinearMapView < K , V > {
194
234
this
195
235
}
236
+ #[ cfg( any(
237
+ feature = "portable-atomic" ,
238
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
239
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
240
+ ) ) ]
196
241
/// Convert a `MpMcQueue` to a `MpMcQueueView`
197
242
fn as_mpmc_queue_view < T > ( this : & MpMcQueueInner < T , Self > ) -> & MpMcQueueView < T > {
198
243
this
199
244
}
245
+ #[ cfg( any(
246
+ feature = "portable-atomic" ,
247
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
248
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
249
+ ) ) ]
200
250
/// Convert a `MpMcQueue` to a `MpMcQueueView`
201
251
fn as_mut_mpmc_queue_view < T > ( this : & mut MpMcQueueInner < T , Self > ) -> & mut MpMcQueueView < T > {
202
252
this
@@ -252,10 +302,20 @@ impl SealedStorage for ViewStorage {
252
302
) -> & mut SortedLinkedListView < T , Idx , K > {
253
303
this
254
304
}
305
+ #[ cfg( any(
306
+ feature = "portable-atomic" ,
307
+ target_has_atomic = "ptr" ,
308
+ has_atomic_load_store
309
+ ) ) ]
255
310
/// Convert a `Queue` to a `QueueView`
256
311
fn as_queue_view < T > ( this : & QueueInner < T , Self > ) -> & QueueView < T > {
257
312
this
258
313
}
314
+ #[ cfg( any(
315
+ feature = "portable-atomic" ,
316
+ target_has_atomic = "ptr" ,
317
+ has_atomic_load_store
318
+ ) ) ]
259
319
/// Convert a `Queue` to a `QueueView`
260
320
fn as_mut_queue_view < T > ( this : & mut QueueInner < T , Self > ) -> & mut QueueView < T > {
261
321
this
@@ -286,10 +346,20 @@ impl SealedStorage for ViewStorage {
286
346
) -> & mut LinearMapView < K , V > {
287
347
this
288
348
}
349
+ #[ cfg( any(
350
+ feature = "portable-atomic" ,
351
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
352
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
353
+ ) ) ]
289
354
/// Convert a `MpMcQueue` to a `MpMcQueueView`
290
355
fn as_mpmc_queue_view < T > ( this : & MpMcQueueInner < T , Self > ) -> & MpMcQueueView < T > {
291
356
this
292
357
}
358
+ #[ cfg( any(
359
+ feature = "portable-atomic" ,
360
+ all( feature = "mpmc_large" , target_has_atomic = "ptr" ) ,
361
+ all( not( feature = "mpmc_large" ) , target_has_atomic = "8" )
362
+ ) ) ]
293
363
/// Convert a `MpMcQueue` to a `MpMcQueueView`
294
364
fn as_mut_mpmc_queue_view < T > ( this : & mut MpMcQueueInner < T , Self > ) -> & mut MpMcQueueView < T > {
295
365
this
0 commit comments