Embassy support - #11
Conversation
|
Thanks so much for doing this work, it's a lot for me to unpack as I've not done much embedded rust before but getting into it now. Would you prefer to wait until after Tokio is repaired? If not, I can try to figure out what it would take to fix when I get some free time soon |
|
Thanks for interest. This work as done as part of CoAP server implementation for the Fobnail project and currently I am focusing on other stuff but I plan to resume work on this PR soon. |
|
Ack'd, I may take a look shortly for my own goals and see if I can generalize it to still work with Tokio. There are some good insights into https://github.com/ryankurte/rust-coap-client for how this kind of generalization can work. |
|
I'm adding this support myself now as well as supporting no_std in order to use this code on my esp32. See: https://github.com/jasta/coap-server-rs/tree/main/coap-server-embassy |
This PR contains a WIP support for embassy.
Currently, the implementation is working and I can run CoAP server on nRF52840 target, but it breaks tokio. Changes done:
rand::thread_rng()embassy requires that all spawned futures must be 'static which caused major problemsEDIT: TaskPool used for spawning futures requires
self: &'static Self, futures must be 'static, not&'static. So taskpool would have to be declared as static and passed to CoAP server, to declare static variable we must known concrete type of the future to be spawned with TaskPool,static POOL: TaskPool<impl Future>won't work. AFAIK it's not possible to useasync move {}- futures need to be created by implementingFuturetrait.Closes #8 and #3