-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hi.
I wrote a fairly well-thought-out safe async Rust wrapper around the OpenThread API for Fuchsia, and it should in theory port well to other operating systems.
Just wanted to point it out in case there were some useful design patterns.
https://fuchsia-docs.firebaseapp.com/rust/openthread/ot/index.html
What you would do is implement the Platform trait and pass that in when you initialize the ot::Instance. For example, the Fuchsia platform used this crate. You can then create a TaskletStream (src) and handle that however you see best in your async design paradigm. It is written in such a way that you can wrap the ot::Instance either directly in a mutex or in a struct which is protected by a mutex (as long as that class implements AsRef<ot::Instance>).
I spent years working on it. I'd like to think it is well thought-out, but never got around to having a formal release while I was at Google. All of the code is BSD-licensed.
The code that used this on Fuchsia was lowpan-ot-driver. You can see here where we initialize OpenThread with a async sink and stream for Spinel frames.