@@ -6,41 +6,16 @@ mod standard;
66use standard:: StandardAllocatorPool ;
77
88// Fixed size allocators are only supported on 64-bit little-endian platforms at present.
9- // They are only enabled if `fixed_size` feature enabled, and `disable_fixed_size` feature is not enabled.
9+ // They are only enabled if `fixed_size` Cargo feature is enabled.
1010//
1111// Note: Importing the `fixed_size` module would cause a compilation error on 32-bit systems.
12- #[ cfg( all(
13- feature = "fixed_size" ,
14- not( feature = "disable_fixed_size" ) ,
15- target_pointer_width = "64" ,
16- target_endian = "little"
17- ) ) ]
12+ #[ cfg( all( feature = "fixed_size" , target_pointer_width = "64" , target_endian = "little" ) ) ]
1813mod fixed_size;
19- #[ cfg( all(
20- feature = "fixed_size" ,
21- not( feature = "disable_fixed_size" ) ,
22- target_pointer_width = "64" ,
23- target_endian = "little"
24- ) ) ]
14+ #[ cfg( all( feature = "fixed_size" , target_pointer_width = "64" , target_endian = "little" ) ) ]
2515use fixed_size:: FixedSizeAllocatorPool ;
26- #[ cfg( all(
27- feature = "fixed_size" ,
28- not( feature = "disable_fixed_size" ) ,
29- target_pointer_width = "64" ,
30- target_endian = "little"
31- ) ) ]
16+ #[ cfg( all( feature = "fixed_size" , target_pointer_width = "64" , target_endian = "little" ) ) ]
3217pub use fixed_size:: { FixedSizeAllocatorMetadata , free_fixed_size_allocator} ;
3318
34- // Dummy implementations of interfaces from `fixed_size`, just to stop clippy complaining.
35- // Seems to be necessary due to feature unification.
36- #[ cfg( not( all(
37- feature = "fixed_size" ,
38- not( feature = "disable_fixed_size" ) ,
39- target_pointer_width = "64" ,
40- target_endian = "little"
41- ) ) ) ]
42- pub use standard:: { FixedSizeAllocatorMetadata , free_fixed_size_allocator} ;
43-
4419/// A thread-safe pool for reusing [`Allocator`] instances to reduce allocation overhead.
4520///
4621/// Uses either:
@@ -51,20 +26,14 @@ pub use standard::{FixedSizeAllocatorMetadata, free_fixed_size_allocator};
5126/// Fixed-size allocator pool is created by [`AllocatorPool::new_fixed_size`].
5227///
5328/// Fixed-size allocators are only supported on 64-bit little-endian platforms at present,
54- /// and require the `fixed_size` Cargo feature to be enabled, and `disable_fixed_size` Cargo feature
55- /// to not be enabled.
29+ /// and require the `fixed_size` Cargo feature to be enabled.
5630#[ repr( transparent) ]
5731pub struct AllocatorPool ( AllocatorPoolInner ) ;
5832
5933/// Inner type of [`AllocatorPool`], holding either a standard or fixed-size allocator pool.
6034enum AllocatorPoolInner {
6135 Standard ( StandardAllocatorPool ) ,
62- #[ cfg( all(
63- feature = "fixed_size" ,
64- not( feature = "disable_fixed_size" ) ,
65- target_pointer_width = "64" ,
66- target_endian = "little"
67- ) ) ]
36+ #[ cfg( all( feature = "fixed_size" , target_pointer_width = "64" , target_endian = "little" ) ) ]
6837 FixedSize ( FixedSizeAllocatorPool ) ,
6938}
7039
@@ -77,7 +46,7 @@ impl AllocatorPool {
7746
7847 /// Create a new [`AllocatorPool`] for use across the specified number of threads,
7948 /// which uses fixed-size allocators (suitable for raw transfer).
80- #[ cfg( all ( feature = "fixed_size" , not ( feature = "disable_fixed_size" ) ) ) ]
49+ #[ cfg( feature = "fixed_size" ) ]
8150 pub fn new_fixed_size ( thread_count : usize ) -> AllocatorPool {
8251 #[ cfg( all( target_pointer_width = "64" , target_endian = "little" ) ) ]
8352 {
@@ -102,7 +71,6 @@ impl AllocatorPool {
10271 AllocatorPoolInner :: Standard ( pool) => pool. get ( ) ,
10372 #[ cfg( all(
10473 feature = "fixed_size" ,
105- not( feature = "disable_fixed_size" ) ,
10674 target_pointer_width = "64" ,
10775 target_endian = "little"
10876 ) ) ]
@@ -128,7 +96,6 @@ impl AllocatorPool {
12896 AllocatorPoolInner :: Standard ( pool) => pool. add ( allocator) ,
12997 #[ cfg( all(
13098 feature = "fixed_size" ,
131- not( feature = "disable_fixed_size" ) ,
13299 target_pointer_width = "64" ,
133100 target_endian = "little"
134101 ) ) ]
0 commit comments