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
48
49
use NonNull;
/// A nullable pointer, using `NonNull<T>`
pub type Ptr<T> = ;
/// Trait for types that can represent pointer differences.
///
/// Generalizes pointer arithmetic to integer types like `i8`, `i16`, `i32`.
/// Used internally by `SelfRef` for offset-based pointer storage.
///
/// # Safety
///
/// Implementations must maintain these invariants:
/// - `sub(a, a) == ZERO` for all pointers `a`
/// - `add(sub(a, b), b) == a` when `sub(a, b)` succeeds
/// - `add(ZERO, a) == a` for all pointers `a`
pub unsafe
/// A `Delta` type that has a null/zero value.
///
/// # Safety
///
/// Must satisfy: `add(NULL, ptr) == ptr` for all pointers.