#![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")), /*, not(feature = "async-std-native-tls")) */
all(feature="async-std-runtime", not(feature="tokio-runtime")) /*, not(feature = "async-std-native-tls")) */
// all(feature="async-std-native-tls", not(feature="tokio-runtime"), not(feature = "async-std-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"
);