<Pete[m]1>
Ok, first time really playing with no_std rust.. Design question: I'm trying to design a system where a "provider" type can be implemented outside the library, so using a trait, and the trait needs a function that can return a Stream/AsyncIterator that generates a stream of data/events to be consumed... I can't seem to find a reasonable solution that doesn't drag in Box and require an allocator. Any ideas?
jfsimon has quit [Ping timeout: 265 seconds]
diondokter[m] has joined #rust-embedded
<diondokter[m]>
<Pete[m]1> Ok, first time really playing with no_std rust.. Design question: I'm trying to design a system where a "provider" type can be implemented outside the library, so using a trait, and the trait needs a function that can return a Stream/AsyncIterator that generates a stream of data/events to be...
<diondokter[m]>
The trait can have an associated type. Then the impl decides how it's done
<vollbrecht[m]>
its a fully in rust written kernal/OS that also sources some dependency like embedded-io heapless smoletcp etc.
<thejpster[m]>
interesting. They use gn rather than cargo.
<Pete[m]1>
diondokterThanks. I'll explore there.
<thejpster[m]>
it's POSIX, but they run tests on the QEMU MPS2-AN385 machine, which uses an Arm Cortex-M3, and the MPS3-AN547 which is a generic Armv8-M Mainline based machine (like a Cortex-M33).
<vollbrecht[m]>
they are building smartphones afaik, and since many Chinese firms are needing to ditch Google/Android i think this is one of there attempts here
<thejpster[m]>
I'd guess more like smart watches and smart bulbs rather than mobile phones. Otherwise why target Cortex-M?
<vollbrecht[m]>
yeah that would make more sense, was just a wild guess by me looking at there background
<thejpster[m]>
If anyone has any ideas on how to handle cotton UsbEvents and interrupt endpoint reports from a future::Stream, please let me know
<dirbaio[m]>
You can make two tasks each with it's own loop
<dirbaio[m]>
Or put each loop in an async{} block then join() them
<dirbaio[m]>
Or you can match select(stream1.next(), stream2.next()).await
<dirbaio[m]>
ah well, I see the hid object comes from the "connect" event. maybe you can have a dedicated task for handling the hid device and spawn it when connected, and let it exit when it disconnects so you spawn it again later when reconnected
<thejpster[m]>
I'll try that
<thejpster[m]>
thanks
okhsunrog[m] has quit [Quit: Idle timeout reached: 172800s]
Noah[m] has quit [Quit: Idle timeout reached: 172800s]