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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Pointer and reference identity checks ([`Arc`], [`Weak`]).
use ;
/// Asserts that `a` and `b` refer to the same memory location ([`std::ptr::eq`]).
///
/// # Panics
///
/// Panics when the addresses differ.
///
/// # Examples
///
/// ```
/// use suitecase::assert::same_ref;
///
/// let v = 5_i32;
/// same_ref(&v, &v);
/// ```
Sized>
/// Asserts that `a` and `b` are distinct references ([`std::ptr::eq`] is false).
///
/// # Panics
///
/// Panics when the addresses are equal.
///
/// # Examples
///
/// ```
/// use suitecase::assert::not_same_ref;
///
/// let a = 1_i32;
/// let b = 1_i32;
/// not_same_ref(&a, &b);
/// ```
Sized>
/// Asserts that two [`Arc`] pointers reference the same allocation.
///
/// # Panics
///
/// Panics when [`Arc::ptr_eq`] is false.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use suitecase::assert::same_arc;
///
/// let a = Arc::new(1);
/// let b = Arc::clone(&a);
/// same_arc(&a, &b);
/// ```
Sized>
/// Asserts that two [`Weak`] pointers refer to the same allocation.
///
/// # Panics
///
/// Panics when [`Weak::ptr_eq`] is false.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use suitecase::assert::same_weak;
///
/// let a: Arc<i32> = Arc::new(7);
/// let w1 = Arc::downgrade(&a);
/// let w2 = Arc::downgrade(&a);
/// same_weak(&w1, &w2);
/// ```
Sized>