executor: rename macro crate to embassy-executor-macros, bump it.

This commit is contained in:
Dario Nieuwenhuis 2023-12-07 00:43:18 +01:00
parent ad2d9040d9
commit ac2aec4e7a
17 changed files with 28 additions and 34 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "embassy-macros" name = "embassy-executor-macros"
version = "0.2.1" version = "0.4.0"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "macros for creating the entry point and tasks for embassy-executor" description = "macros for creating the entry point and tasks for embassy-executor"

View file

@ -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
<http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
at your option.

View file

@ -32,7 +32,7 @@ defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true } log = { version = "0.4.14", optional = true }
rtos-trace = { version = "0.1.2", 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} embassy-time = { version = "0.2", path = "../embassy-time", optional = true}
critical-section = "1.1" critical-section = "1.1"
@ -66,7 +66,7 @@ executor-thread = []
executor-interrupt = [] executor-interrupt = []
# Enable nightly-only features # Enable nightly-only features
nightly = ["embassy-macros/nightly"] nightly = ["embassy-executor-macros/nightly"]
turbowakers = [] turbowakers = []

View file

@ -51,7 +51,7 @@ mod thread {
use core::arch::asm; use core::arch::asm;
use core::marker::PhantomData; 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}; use crate::{raw, Spawner};

View file

@ -7,7 +7,7 @@ pub use thread::*;
mod thread { mod thread {
use core::marker::PhantomData; 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 portable_atomic::{AtomicBool, Ordering};
use crate::{raw, Spawner}; use crate::{raw, Spawner};

View file

@ -8,7 +8,7 @@ mod thread {
use std::marker::PhantomData; use std::marker::PhantomData;
use std::sync::{Condvar, Mutex}; 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}; use crate::{raw, Spawner};

View file

@ -8,7 +8,7 @@ mod thread {
use core::marker::PhantomData; 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 js_sys::Promise;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;

View file

@ -6,7 +6,7 @@
// This mod MUST go first, so that the others see its macros. // This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt; pub(crate) mod fmt;
pub use embassy_macros::task; pub use embassy_executor_macros::task;
macro_rules! check_at_most_one { macro_rules! check_at_most_one {
(@amo [$($feats:literal)*] [] [$($res:tt)*]) => { (@amo [$($feats:literal)*] [] [$($res:tt)*]) => {

View file

@ -5,7 +5,7 @@
//! ## WARNING: here be dragons! //! ## WARNING: here be dragons!
//! //!
//! Using this module requires respecting subtle safety contracts. If you can, prefer using the safe //! 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(target_has_atomic = "ptr", path = "run_queue_atomics.rs")]
#[cfg_attr(not(target_has_atomic = "ptr"), path = "run_queue_critical_section.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 /// 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. /// 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 /// 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. /// the memory for the task is allocated: on the stack, or on the heap with e.g. `Box::leak`, etc.

View file

@ -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!` // 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`. // which would require use of `-Z namespaced-features`.
/// Spawn a task into an executor, panicking on failure. /// Spawn a task into an executor, panicking on failure.
/// ///

View file

@ -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
<http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
at your option.