embassy/embassy-executor/src/lib.rs

48 lines
1.7 KiB
Rust
Raw Normal View History

#![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)]
#![cfg_attr(all(feature = "nightly", feature = "arch-xtensa"), feature(asm_experimental_arch))]
2021-10-18 00:55:43 +02:00
#![allow(clippy::new_without_default)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
2020-09-22 18:03:43 +02:00
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
#[cfg(feature = "nightly")]
pub use embassy_macros::task;
2021-03-17 01:47:45 +01:00
macro_rules! check_at_most_one {
(@amo [$($feats:literal)*] [] [$($res:tt)*]) => {
#[cfg(any($($res)*))]
compile_error!(concat!("At most one of these features can be enabled at the same time:", $(" `", $feats, "`",)*));
};
(@amo $feats:tt [$curr:literal $($rest:literal)*] [$($res:tt)*]) => {
check_at_most_one!(@amo $feats [$($rest)*] [$($res)* $(all(feature=$curr, feature=$rest),)*]);
};
($($f:literal),*$(,)?) => {
check_at_most_one!(@amo [$($f)*] [$($f)*] []);
};
2021-03-17 01:47:45 +01:00
}
check_at_most_one!("arch-cortex-m", "arch-riscv32", "arch-xtensa", "arch-std", "arch-wasm",);
#[cfg(feature = "_arch")]
#[cfg_attr(feature = "arch-cortex-m", path = "arch/cortex_m.rs")]
#[cfg_attr(feature = "arch-riscv32", path = "arch/riscv32.rs")]
#[cfg_attr(feature = "arch-xtensa", path = "arch/xtensa.rs")]
#[cfg_attr(feature = "arch-std", path = "arch/std.rs")]
#[cfg_attr(feature = "arch-wasm", path = "arch/wasm.rs")]
mod arch;
#[cfg(feature = "_arch")]
2023-11-01 04:56:56 +01:00
#[allow(unused_imports)] // don't warn if the module is empty.
pub use arch::*;
pub mod raw;
mod spawner;
pub use spawner::*;
2023-04-03 01:11:42 +02:00
/// Implementation details for embassy macros.
/// Do not use. Used for macros and HALs only. Not covered by semver guarantees.
2021-03-17 01:47:45 +01:00
#[doc(hidden)]
pub mod _export {}