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
110
111
112
#[macro_use]
extern crate lazy_static;
use safety_breaker::ForceMut;
use tokio::io::AsyncWriteExt;
lazy_static! {
static ref STDOUT: tokio::io::Stdout = tokio::io::stdout();
static ref STDERR: tokio::io::Stderr = tokio::io::stderr();
}
#[macro_export]
macro_rules! aprintln {
() => (tokio_print::aprint1("\n").await);
($fmt:expr) => (tokio_print::aprint1(concat!($fmt, "\n")).await);
($fmt:expr, $($arg:tt)*) => (tokio_print::aprint1(&(format!($fmt, $($arg)*)+"\n")).await);
}
#[macro_export]
macro_rules! aeprintln {
() => (tokio_print::aeprint1("\n").await);
($fmt:expr) => (tokio_print::aeprint1(concat!($fmt, "\n")).await);
($fmt:expr, $($arg:tt)*) => (tokio_print::aeprint1(&(format!($fmt, $($arg)*)+"\n")).await);
}
#[macro_export]
macro_rules! aprint {
() => (());
($fmt:expr) => (tokio_print::aprint1($fmt).await);
($fmt:expr, $($arg:tt)*) => (tokio_print::aprint1(&format!($fmt, $($arg)*)).await);
}
#[macro_export]
macro_rules! aeprint {
() => (());
($fmt:expr) => (tokio_print::aeprint1($fmt).await);
($fmt:expr, $($arg:tt)*) => (tokio_print::aeprint1(&format!($fmt, $($arg)*)).await);
}
#[inline(always)]
pub async fn aprint1(content: &str) {
unsafe {
(*STDOUT)
.forcemut()
.write_all(content.as_bytes())
.await
.unwrap();
}
}
#[inline(always)]
pub async fn aeprint1(content: &str) {
unsafe {
(*STDERR)
.forcemut()
.write_all(content.as_bytes())
.await
.unwrap();
}
}