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
50
51
52
53
54
55
56
57
58
59
60
61
62
/// Wraps an expression in a `Box::new()`.
/// Moves the value from the stack to the heap.
/// Wraps an expression in a `Box::pin()`.
/// Pins the value on the heap, required for self-referential structs and some futures.
/// Wraps an expression in an `Arc::new()`.
/// Provides thread-safe shared ownership via Atomic Reference Counting.
/// Wraps an expression in a `tokio::sync::Mutex::new()`.
/// Async-aware mutex that doesn't block the entire thread.
/// Wraps an expression in an `Arc<tokio::sync::Mutex<T>>`.
/// The go-to pattern for shared mutable state in async Axum/Tokio apps.
/// Wraps an expression in a `std::sync::Mutex::new()`.
/// Standard blocking mutex for non-async logic or very short critical sections.
/// Wraps an expression in an `Arc<std::sync::Mutex<T>>`.
/// Thread-safe shared state using standard blocking primitives.