Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update embassy dependencies #19

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ In any case, you will need:

* **A supported development kit** - Drogue device is about ... devices, so having a kit that you can run will help you test and validate code for peripherals (see [examples](examples/) for what boards we have working examples for).

* **Rust Nightly** – Drogue-device relies on features only available in Rust nightly. You can use nightly either by running all
rust commands with `+nightly`, or just change default to nightly by running `rustup default nightly`.

* **An IDE** – Whatever works best for you. Eclipse, Emacs, IntelliJ, Vim, … [^1] should all be usable with this
project. We do not require any specific IDE. We also do not commit any IDE specific files either.

Expand Down
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ector is an open source async, no-alloc actor framework for embedded devices.
# Ector is an open source async, no-alloc actor framework for embedded devices

[![CI](https://github.com/drogue-iot/ector/actions/workflows/ci.yaml/badge.svg)](https://github.com/drogue-iot/ector/actions/workflows/ci.yaml)
[![crates.io](https://img.shields.io/crates/v/ector.svg)](https://crates.io/crates/ector)
Expand All @@ -16,10 +16,6 @@ Each actor has exclusive access to its own state and only communicates with othe
## Example

```rust
#![macro_use]
#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]

use ector::*;

/// A Counter that we wish to create an Actor for.
Expand All @@ -41,9 +37,8 @@ impl Actor for Counter {
/// The following arguments are provided:
/// * The address to 'self'
/// * An inbox from which the actor can receive messages
async fn on_mount<M>(&mut self, _: Address<Self::Message<'m>>, mut inbox: M) -> !
where M: Inbox<Self::Message<'m>> {
{
async fn on_mount<M>(&mut self, _: DynamicAddress<Self::Message>, mut inbox: M) -> !
where M: Inbox<Self::Message> {
loop {
// Await the next message and increment the counter
let _ = inbox.next().await;
Expand All @@ -53,11 +48,11 @@ impl Actor for Counter {
}

/// The entry point of the application is using the embassy runtime.
#[embassy::main]
async fn main(spawner: embassy::executor::Spawner) {
#[embassy_executor::main]
async fn main(spawner: embassy_executor::Spawner) {

// Mounting the Actor will spawn an embassy task
let addr = ector::actor!(spawner, counter, Counter, Counter { count 0 });
let addr = ector::actor!(spawner, counter, Counter, Counter { count: 0 });

// The actor address may be used in any embassy task to communicate with the actor.
let _ = addr.notify(Increment).await;
Expand All @@ -66,19 +61,17 @@ impl Actor for Counter {

## Building

To build `ector`, you must install the [nightly rust toolchain](https://rustup.rs/). Once
installed, you can build and test the framework by running
You can build and test the framework by running

~~~shell
```shell
cargo test
~~~
```

## Directory layout

* `ector` - an actor framework
* `macros` - macros used by drogue-device and application code


## Contributing

See the document [CONTRIBUTING.md](CONTRIBUTING.md).
Expand Down
35 changes: 24 additions & 11 deletions ector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "ector"
version = "0.5.0"
version = "0.6.0"
description = "Ector is an open source async, no-alloc actor framework for embedded devices."
documentation = "https://docs.rs/ector"
readme = "../README.md"
Expand All @@ -15,27 +15,40 @@ exclude = [".github"]
doctest = false

[dependencies]
embassy-executor = { version = "0.4", default-features = false }
embassy-sync = { version = "0.5", default-features = false }
atomic-polyfill = "1"
embassy-executor = { version = "0.6", default-features = false }
embassy-sync = { version = "0.6", default-features = false }
portable-atomic = { version = "1.3", default-features = false }

log = { version = "0.4", optional = true }
defmt = { version = "0.3", optional = true }

ector-macros = { version = "0.5.0", path = "../macros" }
futures = { version = "0.3", default-features = false }
static_cell = "1.0.0"
static_cell = "2.1"


[dev-dependencies]
embassy-executor = { version = "0.4.0", default-features = false, features = ["integrated-timers", "arch-std", "executor-thread"]}
embassy-time = { version = "0.2.0", default-features = false, features = ["std"] }
futures = { version = "0.3", default-features = false, features = ["executor"] }
critical-section = { version = "1.1", features = ["std"] }
embassy-executor = { version = "0.6.0", default-features = false, features = [
"integrated-timers",
"arch-std",
"executor-thread",
] }
embassy-time = { version = "0.3.2", default-features = false, features = [
"std",
] }
futures = { version = "0.3.31", default-features = false, features = [
"executor",
] }
critical-section = { version = "1.2.0", features = ["std"] }
ector = { path = ".", features = ["std", "log", "time", "test-utils"] }

[features]
default = [ "std", "log", "time" ]
std = ["embassy-executor/integrated-timers", "embassy-executor/arch-std", "embassy-time/std", "critical-section/std"]
default = ["std", "log", "time"]
std = [
"embassy-executor/integrated-timers",
"embassy-executor/arch-std",
"embassy-time/std",
"critical-section/std",
]
test-utils = []
time = []
5 changes: 0 additions & 5 deletions ector/examples/cancel_panic.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
//! Example where cancellation will cause a panic

#![macro_use]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

use {
ector::*,
embassy_time::{Duration, Timer},
Expand Down
5 changes: 0 additions & 5 deletions ector/examples/macro-usage.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#![macro_use]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

use {
ector::{mutex::NoopRawMutex, *},
embassy_time::{Duration, Timer},
Expand Down
5 changes: 0 additions & 5 deletions ector/examples/pingpong.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#![macro_use]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

use {
ector::*,
embassy_time::{Duration, Ticker},
Expand Down
5 changes: 0 additions & 5 deletions ector/examples/request.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#![macro_use]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

use {
ector::*,
embassy_time::{Duration, Timer},
Expand Down
5 changes: 0 additions & 5 deletions ector/examples/send.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#![macro_use]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

use ector::mutex::CriticalSectionRawMutex;

use {
Expand Down
2 changes: 1 addition & 1 deletion ector/src/testutils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use {
crate::{Actor, DynamicAddress, Inbox},
atomic_polyfill::{AtomicBool, Ordering},
core::{cell::RefCell, future::Future, pin::Pin},
embassy_executor::{raw, Spawner},
embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal},
portable_atomic::{AtomicBool, Ordering},
static_cell::StaticCell,
std::{cell::UnsafeCell, marker::PhantomData, vec::Vec},
};
Expand Down
2 changes: 0 additions & 2 deletions ector/tests/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![macro_use]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

#[cfg(feature = "std")]
Expand Down
2 changes: 0 additions & 2 deletions ector/tests/notifications.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(dead_code)]
#![allow(incomplete_features)]
#![warn(unused_attributes)]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_in_trait)]

use ector::{
testutils::{DummyActor, *},
Expand Down
2 changes: 1 addition & 1 deletion macros/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn transform_sig(sig: &mut Signature) {
.predicates
.push(parse_quote_spanned!(bound_span=> Self: 'm));

for (_, arg) in sig.inputs.iter_mut().enumerate() {
for arg in sig.inputs.iter_mut() {
match arg {
FnArg::Receiver(arg) => {
let s = arg.span();
Expand Down
1 change: 0 additions & 1 deletion macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(incomplete_features)]
#![feature(proc_macro_diagnostic)]

extern crate proc_macro;
mod actor;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Before upgrading check that everything is available on all tier1 targets here:
# https://rust-lang.github.io/rustup-components-history
[toolchain]
channel = "nightly-2023-11-01"
channel = "stable"
components = ["clippy"]
Loading