Merge pull request #2262 from embassy-rs/executor-macros

executor: rename macro crate to embassy-executor-macros, bump it.
This commit is contained in:
Dario Nieuwenhuis 2023-12-06 23:55:58 +00:00 committed by GitHub
commit 83138ce68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 28 additions and 34 deletions

View File

@ -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"

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 }
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 = []

View File

@ -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};

View File

@ -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};

View File

@ -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};

View File

@ -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::*;

View File

@ -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)*]) => {

View File

@ -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.

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!`
// 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.
///

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.