#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(clippy::multiple_crate_versions)]
#[cfg(feature = "async")]
pub mod unsync {
pub use switchy_async::*;
#[cfg(feature = "async-macros")]
#[macro_export]
macro_rules! select {
($($tokens:tt)*) => {
switchy::unsync_macros::select_internal! {
@path = switchy::unsync;
$($tokens)*
}
};
}
#[cfg(feature = "async-macros")]
pub use select;
#[cfg(feature = "async-macros")]
#[macro_export]
macro_rules! join {
($($tokens:tt)*) => {
switchy::unsync_macros::join_internal! {
@path = switchy::unsync;
$($tokens)*
}
};
}
#[cfg(feature = "async-macros")]
pub use join;
#[cfg(feature = "async-macros")]
#[macro_export]
macro_rules! try_join {
($($tokens:tt)*) => {
switchy::unsync_macros::try_join_internal! {
@path = switchy::unsync;
$($tokens)*
}
};
}
#[cfg(feature = "async-macros")]
pub use try_join;
#[cfg(feature = "async-macros")]
pub use crate::unsync_macros::unsync_main as main;
#[cfg(all(test, feature = "async-macros"))]
pub use crate::unsync_macros::unsync_test as test;
}
#[cfg(feature = "async-macros")]
pub mod unsync_macros {
pub use switchy_async_macros::*;
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
#[macro_export]
macro_rules! select_internal {
(@path = $path:path; $($tokens:tt)*) => {
::switchy::unsync::tokio::select! { $($tokens)* }
};
($($tokens:tt)*) => {
::switchy::unsync::tokio::select! { $($tokens)* }
};
}
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
pub use select_internal;
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
#[macro_export]
macro_rules! join_internal {
(@path = $path:path; $($tokens:tt)*) => {
::switchy::unsync::tokio::join! { $($tokens)* }
};
($($tokens:tt)*) => {
::switchy::unsync::tokio::join! { $($tokens)* }
};
}
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
pub use join_internal;
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
#[macro_export]
macro_rules! try_join_internal {
(@path = $path:path; $($tokens:tt)*) => {
::switchy::unsync::tokio::try_join! { $($tokens)* }
};
($($tokens:tt)*) => {
::switchy::unsync::tokio::try_join! { $($tokens)* }
};
}
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
pub use try_join_internal;
#[cfg(feature = "simulator")]
pub use switchy_async_macros::select_internal;
#[cfg(feature = "simulator")]
pub use switchy_async_macros::{join_internal, try_join_internal};
#[cfg(all(
feature = "async-macros",
not(feature = "async-tokio"),
not(feature = "simulator")
))]
pub use switchy_async_macros::select_internal;
#[cfg(all(
feature = "async-macros",
not(feature = "async-tokio"),
not(feature = "simulator")
))]
pub use switchy_async_macros::{join_internal, try_join_internal};
#[cfg(all(test, feature = "async-tokio", not(feature = "simulator")))]
pub use crate::unsync::tokio::test as test_internal;
#[cfg(feature = "simulator")]
pub use switchy_async_macros::test_internal;
#[cfg(all(
feature = "async-macros",
not(feature = "async-tokio"),
not(feature = "simulator")
))]
pub use switchy_async_macros::test_internal;
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
#[macro_export]
macro_rules! main_internal {
(@path = $path:path; #[$($attr:tt)*] $($rest:tt)*) => {
#[::switchy::unsync::tokio::main]
#[$($attr)*]
$($rest)*
};
(@path = $path:path; $($rest:tt)*) => {
#[::switchy::unsync::tokio::main]
$($rest)*
};
($($tokens:tt)*) => {
#[::switchy::unsync::tokio::main]
$($tokens)*
};
}
#[cfg(all(feature = "async-tokio", not(feature = "simulator")))]
pub use main_internal;
#[cfg(feature = "simulator")]
pub use switchy_async_macros::main_internal;
#[cfg(all(
feature = "async-macros",
not(feature = "async-tokio"),
not(feature = "simulator")
))]
pub use switchy_async_macros::main_internal;
}
#[cfg(feature = "database")]
pub use switchy_database as database;
#[cfg(feature = "database-connection")]
pub use switchy_database_connection as database_connection;
#[cfg(feature = "fs")]
pub use switchy_fs as fs;
#[cfg(feature = "mdns")]
pub use switchy_mdns as mdns;
#[cfg(feature = "random")]
pub use switchy_random as random;
#[cfg(feature = "tcp")]
pub use switchy_tcp as tcp;
#[cfg(feature = "telemetry")]
pub use switchy_telemetry as telemetry;
#[cfg(feature = "time")]
pub use switchy_time as time;
#[cfg(feature = "upnp")]
pub use switchy_upnp as upnp;
#[cfg(feature = "uuid")]
pub use switchy_uuid as uuid;
#[cfg(feature = "web-server")]
pub use switchy_web_server as web_server;
#[cfg(feature = "web-server-core")]
pub use switchy_web_server_core as web_server_core;
#[cfg(any(feature = "http", feature = "http-models"))]
pub mod http {
#[cfg(feature = "http")]
pub use switchy_http::*;
#[cfg(feature = "http-models")]
pub use switchy_http_models as models;
}