1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! Shared behavior of arena chunks.
/// A contiguous block of memory that an arena carves bump allocations out of.
///
/// Both [`LocalChunk`](super::LocalChunk) and [`SharedChunk`](super::SharedChunk)
/// implement this trait. They differ in how the chunk and its allocations are
/// owned and shared:
///
/// - `LocalChunk` is used for allocations whose lifetime is tied to the arena
/// itself and never crosses thread boundaries; no synchronization is needed.
/// - `SharedChunk` is used for allocations whose lifetime can outlive the
/// arena (reference-counted handles), and uses atomics for cross-thread
/// refcounting.
///
/// Implementors are dynamically-sized types: the struct ends with a `[u8]`
/// payload that holds the actual bump-allocation buffer.
pub