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
45
46
47
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! Owner-thread-confined `UnsafeCell`.
//!
//! The cell is `Sync`, but every access goes through `unsafe fn with`; callers
//! assert owner-thread, exclusive access. Used by
//! [`ChunkProvider`](super::chunk_provider::ChunkProvider)'s local cache state.
use UnsafeCell;
/// `UnsafeCell<T>` with a manually-asserted owner-thread invariant.
pub
// SAFETY: All access is through `with`, whose `unsafe` contract requires the
// caller to be on the cell's owner thread. We make no claim about concurrent
// access — that obligation is fully delegated to the caller.
unsafe