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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//---------------------------------------------------------------------------------------------------- Mem
/// Moves all inputs in a scope `{}` and immediately exits it.
///
/// This implicitly calls [`std::mem::drop()`] but on an infinite amount of arguments:
/// ```rust,compile_fail
/// # use benri::*;
/// let a = vec![0_u8];
/// let b = vec![0_u8];
/// let c = vec![0_u8];
///
/// drop!(a, b, c);
/// assert!(a == b); // Can't use `a, b, c` anymore.
/// ```
/// This is the same as:
/// ```rust,compile_fail
/// # use benri::*;
/// let a = vec![0_u8];
/// let b = vec![0_u8];
/// let c = vec![0_u8];
///
/// drop! {
/// a,
/// b,
/// c,
/// }
/// assert!(a == b); // Can't use `a, b, c` anymore.
/// ```
/// Which is the same as:
/// ```rust,compile_fail
/// # use benri::*;
/// let a = vec![0_u8];
/// let b = vec![0_u8];
/// let c = vec![0_u8];
///
/// {
/// a;
/// b;
/// c;
/// }
/// assert!(a == b); // Can't use `a, b, c` anymore.
/// ```
/// Which is the same as:
/// ```rust,compile_fail
/// # use benri::*;
/// let a = vec![0_u8];
/// let b = vec![0_u8];
/// let c = vec![0_u8];
///
/// drop(a);
/// drop(b);
/// drop(c);
/// assert!(a == b); // Can't use `a, b, c` anymore.
/// ```
pub use drop;
/// Calls [`std::mem::size_of()`] on the type given
pub use size;
/// Calls [`std::mem::swap()`]. This automatically appends `&mut` to `dest`.
pub use replace;
/// Calls [`std::mem::swap()`]. This automatically appends `&mut` to both inputs.
pub use swap;
/// Calls [`std::mem::take()`]. This automatically appends `&mut` on the input.
pub use take;
/// Calls [`std::mem::forget()`]
pub use forget;