@@ -45,24 +45,24 @@ pub struct TypedArena<T> {
45
45
end : Cell < * mut T > ,
46
46
47
47
/// A vector of arena chunks.
48
- chunks : RefCell < Vec < TypedArenaChunk < T > > > ,
48
+ chunks : RefCell < Vec < ArenaChunk < T > > > ,
49
49
50
50
/// Marker indicating that dropping the arena causes its owned
51
51
/// instances of `T` to be dropped.
52
52
_own : PhantomData < T > ,
53
53
}
54
54
55
- struct TypedArenaChunk < T > {
55
+ struct ArenaChunk < T = u8 > {
56
56
/// The raw storage for the arena chunk.
57
57
storage : Box < [ MaybeUninit < T > ] > ,
58
58
/// The number of valid entries in the chunk.
59
59
entries : usize ,
60
60
}
61
61
62
- impl < T > TypedArenaChunk < T > {
62
+ impl < T > ArenaChunk < T > {
63
63
#[ inline]
64
- unsafe fn new ( capacity : usize ) -> TypedArenaChunk < T > {
65
- TypedArenaChunk { storage : Box :: new_uninit_slice ( capacity) , entries : 0 }
64
+ unsafe fn new ( capacity : usize ) -> ArenaChunk < T > {
65
+ ArenaChunk { storage : Box :: new_uninit_slice ( capacity) , entries : 0 }
66
66
}
67
67
68
68
/// Destroys this arena chunk.
@@ -272,7 +272,7 @@ impl<T> TypedArena<T> {
272
272
// Also ensure that this chunk can fit `additional`.
273
273
new_cap = cmp:: max ( additional, new_cap) ;
274
274
275
- let mut chunk = TypedArenaChunk :: < T > :: new ( new_cap) ;
275
+ let mut chunk = ArenaChunk :: < T > :: new ( new_cap) ;
276
276
self . ptr . set ( chunk. start ( ) ) ;
277
277
self . end . set ( chunk. end ( ) ) ;
278
278
chunks. push ( chunk) ;
@@ -281,7 +281,7 @@ impl<T> TypedArena<T> {
281
281
282
282
// Drops the contents of the last chunk. The last chunk is partially empty, unlike all other
283
283
// chunks.
284
- fn clear_last_chunk ( & self , last_chunk : & mut TypedArenaChunk < T > ) {
284
+ fn clear_last_chunk ( & self , last_chunk : & mut ArenaChunk < T > ) {
285
285
// Determine how much was filled.
286
286
let start = last_chunk. start ( ) as usize ;
287
287
// We obtain the value of the pointer to the first uninitialized element.
@@ -340,7 +340,7 @@ pub struct DroplessArena {
340
340
end : Cell < * mut u8 > ,
341
341
342
342
/// A vector of arena chunks.
343
- chunks : RefCell < Vec < TypedArenaChunk < u8 > > > ,
343
+ chunks : RefCell < Vec < ArenaChunk > > ,
344
344
}
345
345
346
346
unsafe impl Send for DroplessArena { }
@@ -378,7 +378,7 @@ impl DroplessArena {
378
378
// Also ensure that this chunk can fit `additional`.
379
379
new_cap = cmp:: max ( additional, new_cap) ;
380
380
381
- let mut chunk = TypedArenaChunk :: < u8 > :: new ( new_cap) ;
381
+ let mut chunk = ArenaChunk :: new ( new_cap) ;
382
382
self . start . set ( chunk. start ( ) ) ;
383
383
self . end . set ( chunk. end ( ) ) ;
384
384
chunks. push ( chunk) ;
0 commit comments