diff --git a/embassy-macros/Cargo.toml b/embassy-executor-macros/Cargo.toml similarity index 89% rename from embassy-macros/Cargo.toml rename to embassy-executor-macros/Cargo.toml index e13104cf..6ea7ddb7 100644 --- a/embassy-macros/Cargo.toml +++ b/embassy-executor-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "embassy-macros" -version = "0.2.1" +name = "embassy-executor-macros" +version = "0.4.0" edition = "2021" license = "MIT OR Apache-2.0" description = "macros for creating the entry point and tasks for embassy-executor" diff --git a/embassy-executor-macros/README.md b/embassy-executor-macros/README.md new file mode 100644 index 00000000..a959c85d --- /dev/null +++ b/embassy-executor-macros/README.md @@ -0,0 +1,15 @@ +# embassy-executor-macros + +An [Embassy](https://embassy.dev) project. + +NOTE: Do not use this crate directly. The macros are re-exported by `embassy-executor`. + +## License + +This work is licensed under either of + +- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or + ) +- MIT license ([LICENSE-MIT](LICENSE-MIT) or ) + +at your option. diff --git a/embassy-macros/src/lib.rs b/embassy-executor-macros/src/lib.rs similarity index 100% rename from embassy-macros/src/lib.rs rename to embassy-executor-macros/src/lib.rs diff --git a/embassy-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs similarity index 100% rename from embassy-macros/src/macros/main.rs rename to embassy-executor-macros/src/macros/main.rs diff --git a/embassy-macros/src/macros/mod.rs b/embassy-executor-macros/src/macros/mod.rs similarity index 100% rename from embassy-macros/src/macros/mod.rs rename to embassy-executor-macros/src/macros/mod.rs diff --git a/embassy-macros/src/macros/task.rs b/embassy-executor-macros/src/macros/task.rs similarity index 100% rename from embassy-macros/src/macros/task.rs rename to embassy-executor-macros/src/macros/task.rs diff --git a/embassy-macros/src/util/ctxt.rs b/embassy-executor-macros/src/util/ctxt.rs similarity index 100% rename from embassy-macros/src/util/ctxt.rs rename to embassy-executor-macros/src/util/ctxt.rs diff --git a/embassy-macros/src/util/mod.rs b/embassy-executor-macros/src/util/mod.rs similarity index 100% rename from embassy-macros/src/util/mod.rs rename to embassy-executor-macros/src/util/mod.rs diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml index a79bd89f..ec5aca46 100644 --- a/embassy-executor/Cargo.toml +++ b/embassy-executor/Cargo.toml @@ -32,7 +32,7 @@ defmt = { version = "0.3", optional = true } log = { version = "0.4.14", optional = true } rtos-trace = { version = "0.1.2", optional = true } -embassy-macros = { version = "0.2.1", path = "../embassy-macros" } +embassy-executor-macros = { version = "0.4.0", path = "../embassy-executor-macros" } embassy-time = { version = "0.2", path = "../embassy-time", optional = true} critical-section = "1.1" @@ -66,7 +66,7 @@ executor-thread = [] executor-interrupt = [] # Enable nightly-only features -nightly = ["embassy-macros/nightly"] +nightly = ["embassy-executor-macros/nightly"] turbowakers = [] diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs index 4a6d5857..5c517e0a 100644 --- a/embassy-executor/src/arch/cortex_m.rs +++ b/embassy-executor/src/arch/cortex_m.rs @@ -51,7 +51,7 @@ mod thread { use core::arch::asm; use core::marker::PhantomData; - pub use embassy_macros::main_cortex_m as main; + pub use embassy_executor_macros::main_cortex_m as main; use crate::{raw, Spawner}; diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index ca12c340..c56f502d 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs @@ -7,7 +7,7 @@ pub use thread::*; mod thread { use core::marker::PhantomData; - pub use embassy_macros::main_riscv as main; + pub use embassy_executor_macros::main_riscv as main; use portable_atomic::{AtomicBool, Ordering}; use crate::{raw, Spawner}; diff --git a/embassy-executor/src/arch/std.rs b/embassy-executor/src/arch/std.rs index 598bb050..b02b1598 100644 --- a/embassy-executor/src/arch/std.rs +++ b/embassy-executor/src/arch/std.rs @@ -8,7 +8,7 @@ mod thread { use std::marker::PhantomData; use std::sync::{Condvar, Mutex}; - pub use embassy_macros::main_std as main; + pub use embassy_executor_macros::main_std as main; use crate::{raw, Spawner}; diff --git a/embassy-executor/src/arch/wasm.rs b/embassy-executor/src/arch/wasm.rs index 3faa9257..f9d0f935 100644 --- a/embassy-executor/src/arch/wasm.rs +++ b/embassy-executor/src/arch/wasm.rs @@ -8,7 +8,7 @@ mod thread { use core::marker::PhantomData; - pub use embassy_macros::main_wasm as main; + pub use embassy_executor_macros::main_wasm as main; use js_sys::Promise; use wasm_bindgen::prelude::*; diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs index 89769615..4c6900a6 100644 --- a/embassy-executor/src/lib.rs +++ b/embassy-executor/src/lib.rs @@ -6,7 +6,7 @@ // This mod MUST go first, so that the others see its macros. pub(crate) mod fmt; -pub use embassy_macros::task; +pub use embassy_executor_macros::task; macro_rules! check_at_most_one { (@amo [$($feats:literal)*] [] [$($res:tt)*]) => { diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index e9137f8f..b16a1c7c 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs @@ -5,7 +5,7 @@ //! ## WARNING: here be dragons! //! //! Using this module requires respecting subtle safety contracts. If you can, prefer using the safe -//! [executor wrappers](crate::Executor) and the [`embassy_executor::task`](embassy_macros::task) macro, which are fully safe. +//! [executor wrappers](crate::Executor) and the [`embassy_executor::task`](embassy_executor_macros::task) macro, which are fully safe. #[cfg_attr(target_has_atomic = "ptr", path = "run_queue_atomics.rs")] #[cfg_attr(not(target_has_atomic = "ptr"), path = "run_queue_critical_section.rs")] @@ -97,7 +97,7 @@ impl TaskRef { /// A `TaskStorage` must live forever, it may not be deallocated even after the task has finished /// running. Hence the relevant methods require `&'static self`. It may be reused, however. /// -/// Internally, the [embassy_executor::task](embassy_macros::task) macro allocates an array of `TaskStorage`s +/// Internally, the [embassy_executor::task](embassy_executor_macros::task) macro allocates an array of `TaskStorage`s /// in a `static`. The most common reason to use the raw `Task` is to have control of where /// the memory for the task is allocated: on the stack, or on the heap with e.g. `Box::leak`, etc. diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs index 5a3a0dee..27160624 100644 --- a/embassy-executor/src/spawner.rs +++ b/embassy-executor/src/spawner.rs @@ -115,9 +115,9 @@ impl Spawner { } } - // Used by the `embassy_macros::main!` macro to throw an error when spawn + // Used by the `embassy_executor_macros::main!` macro to throw an error when spawn // fails. This is here to allow conditional use of `defmt::unwrap!` - // without introducing a `defmt` feature in the `embassy_macros` package, + // without introducing a `defmt` feature in the `embassy_executor_macros` package, // which would require use of `-Z namespaced-features`. /// Spawn a task into an executor, panicking on failure. /// diff --git a/embassy-macros/README.md b/embassy-macros/README.md deleted file mode 100644 index d1d6f4cc..00000000 --- a/embassy-macros/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# embassy-macros - -An [Embassy](https://embassy.dev) project. - -Macros for creating the main entry point and tasks that can be spawned by `embassy-executor`. - -NOTE: The macros are re-exported by the `embassy-executor` crate which should be used instead of adding a direct dependency on the `embassy-macros` crate. - -## Minimum supported Rust version (MSRV) - -The `task` and `main` macros require the type alias impl trait (TAIT) nightly feature in order to compile. - -## License - -This work is licensed under either of - -- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or - ) -- MIT license ([LICENSE-MIT](LICENSE-MIT) or ) - -at your option.