Comments (4)
I'm going to attempt to improve the experience of writing and running actors as follows:
- Introduce a
spawn_actor!
macro to simplify creation and mounting of the actor context + actor:
let address = spawn_actor!(spawner, BUTTON_A, Button::new(board.btn_a));
- Introduce a
actor
proc macro to simplify the Actor impl:
#[actor]
impl Actor for MyActor {
type Message<'m> = MyMessage;
async fn on_mount<M>(&mut self, address: Address<Self>, inbox: &mut M)
where M: Inbox<Self>
{
loop {
if let Some(m) = inbox.next().await {
// ... handle message
}
}
}
}
The purpose of this macro is not to remove all the boilerplate, but rather prepare the actor implementations to require minimal modifications when async traits are fully available in Rust, so that just removing the #[actor] macro (and making the macro a dummy) will allow the code to keep working.
from drogue-device.
What I guess would help is:
- Add some documentation on the actor model of Drogue Device
- What is an actor
- What is the lifecycle? Init, Inbox, ...
- When to use an actor vs when not to
- A basic tutorial, which builds (step by step) a simple device (like a blinking LED with a push-button that changes its behavior). Maybe pointing to a dedicated GitHub repository, which contains the full code (and only that). Ready to check out, build, and flash on a device we choose (like the microbit).
from drogue-device.
Ok, after re-checking the docs. I think it already is there.
from drogue-device.
Improvements:
Will take a stab at improving the code docs.
from drogue-device.
Related Issues (20)
- Remove all warnings and add CI check for warnings HOT 1
- Consolidate config file compilation in examples to be more friendly HOT 1
- Create integration test for drogue-temperature app HOT 1
- WIFI AP mode HOT 3
- Suggestion to add Config type to Board trait HOT 4
- Add links from example docs page, to code
- Add MQTT client HOT 2
- examples/std/cloud not works. HOT 4
- Unable to discern whether to use boards or device/src/bsp/boards HOT 2
- Pico W example error linking HOT 3
- Book: broken link
- Device Request: Esp32-C3 Risc-V target HOT 4
- Add CoAP client
- Add TCP/TLS examples that can be run locally
- Replace kernel channel implementation with the one from embassy
- Want to compile drogue-device\examples\stm32l0xx\lora-discovery - always get this error... HOT 2
- Drivers doc missing page title
- Add example for stm32 iot01a wifi and sensor HOT 1
- Missing images/connector.jpg in nrf52/microbit/uart/README.adoc HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drogue-device.