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
113
#![doc(
html_logo_url = "https://i.postimg.cc/3rGyjPqQ/logo.png",
html_favicon_url = "https://i.postimg.cc/3rGyjPqQ/logo.png"
)]
#![recursion_limit = "1024"]
macro_rules! define_cfg {
($($def: item)+) => {
$(
#[cfg(any(
all(feature="tokio-runtime", not(feature="async-std-runtime")),
all(feature="async-std-runtime", not(feature="tokio-runtime"))
))]
$def
)+
}
}
define_cfg! {
#[doc(inline)]
pub mod client;
#[doc(inline)]
pub mod models;
#[doc(inline)]
pub mod utils;
mod error;
mod gateway;
mod http;
mod runtime;
pub use error::PandaError;
pub use http::HttpClient;
pub use models::gateway::events;
pub type HandlerResult = Result<(), Box<dyn std::error::Error>>;
pub type Session<S> = std::sync::Arc<client::SessionData<S>>;
pub async fn new(token: impl Into<String>) -> error::Result<client::Client<()>> {
client::Client::<()>::new(token).await
}
pub async fn new_with_state<S: Sync + Send>(token: impl Into<String>, state: S) -> error::Result<client::Client<S>> {
client::Client::<S>::new_with_state(token, state).await
}
}
#[cfg(all(feature = "async-std-runtime", feature = "tokio-runtime"))]
compile_error!(
"`tokio-runtime` and `async-std-runtime` can't be enable at the same time \
please use just one of them, to use `async-std-runtime`, use default-features = false"
);
#[cfg(all(not(feature = "async-std-runtime"), not(feature = "tokio-runtime")))]
compile_error!(
"You don't have a selected runtime as feature, please select `tokio-runtime` or \
`async-std-runtime` in Cargo.toml"
);