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
use String;
use BitXorAssign;
/// Conveniently create String variable.
///
/// # Examples
///
/// ```
/// use ext::no_std::functions::fun::s;
///
/// let s: String = s("Rust");
/// ```
/// Swaps two variables' value.
///
/// # Warnings
///
/// * Do not swap variables with a same memory address, otherwise you will get `0`.
///
/// # Examples
/// ```
/// use ext::no_std::functions::fun::*;
///
/// // Normal:
/// let a = &mut 1024; let b = &mut 2048;
/// swap_xor(a, b);
/// assert_eq!((2048, 1024), (*a, *b));
///
/// // Warning:
/// let c = &mut 3072 as *mut i32;
/// let x = unsafe { &mut *c };
/// let y = unsafe { &mut *c };
/// swap_xor(x, y);
/// assert_eq!((0, 0), (*x, *y))
/// ```