#![cfg_attr(
feature = "cargo-clippy",
allow(
clippy::unreadable_literal,
clippy::cognitive_complexity,
clippy::float_cmp
)
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
macro_rules! define_if_single_runtime_enabled {
( $( $def:item )+ ) => {
$(
#[cfg(any(
all(feature = "tokio-runtime", not(feature = "async-std-runtime")),
all(not(feature = "tokio-runtime"), feature = "async-std-runtime")
))]
$def
)+
}
}
define_if_single_runtime_enabled! {
#[macro_use]
pub mod options;
pub use ::bson;
mod bson_util;
mod client;
mod cmap;
mod coll;
mod collation;
mod concern;
mod cursor;
mod db;
pub mod error;
pub mod event;
mod is_master;
mod operation;
pub mod results;
pub(crate) mod runtime;
mod sdam;
mod selection_criteria;
mod srv;
#[cfg(any(feature = "sync", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "sync")))]
pub mod sync;
#[cfg(test)]
mod test;
#[cfg(test)]
#[macro_use]
extern crate derive_more;
#[cfg(not(feature = "sync"))]
pub use crate::{
client::Client,
coll::Collection,
cursor::Cursor,
db::Database,
};
#[cfg(feature = "sync")]
pub(crate) use crate::{
client::Client,
coll::Collection,
cursor::Cursor,
db::Database,
};
pub use coll::Namespace;
}
#[cfg(all(
feature = "tokio-runtime",
feature = "async-std-runtime",
not(feature = "sync")
))]
compile_error!(
"`tokio-runtime` and `async-std-runtime` can't both be enabled; either disable \
`async-std-runtime` or set `default-features = false` in your Cargo.toml"
);
#[cfg(all(feature = "tokio-runtime", feature = "sync"))]
compile_error!(
"`tokio-runtime` and `sync` can't both be enabled; either disable `sync` or set \
`default-features = false` in your Cargo.toml"
);
#[cfg(all(not(feature = "tokio-runtime"), not(feature = "async-std-runtime")))]
compile_error!(
"one of `tokio-runtime`, `async-std-runtime`, or `sync` must be enabled; either enable \
`default-features`, or enable one of those features specifically in your Cargo.toml"
);
#[cfg(all(feature = "tokio-runtime", not(feature = "async-std-runtime")))]
pub(crate) static RUNTIME: runtime::AsyncRuntime = runtime::AsyncRuntime::Tokio;
#[cfg(all(not(feature = "tokio-runtime"), feature = "async-std-runtime"))]
pub(crate) static RUNTIME: runtime::AsyncRuntime = runtime::AsyncRuntime::AsyncStd;