Write a macro for supplying different kind of `freezable` tasks to the Executor
Opened this issue · 0 comments
Quoting from runtime/README.md
:
The tasks given to the
Executor
needs to be the same type. This restriction can be eliminated
withVec<Box<dyn Trait>>
. But I did not like the idea of storing all the async tasks in the heap
for this project. If we are to utilize the heap for massive memory allocation, we could as well store the
necessary information related to each state in the heap, and have a much simpler state machine structire
as well.Not using the heap is also good for the embedded systems (some machines do not have heap, or very
limited heap). I want this example to be as simple as possible. So that it would serve as a stepping stone
for what can be further done.Another strategy for eliminating requirement of the tasks being the same type, would be using
macros (take a look atselect
from tokio: https://docs.rs/tokio/latest/tokio/macro.select.html).Note that macros are utilized in practice (in tokio), instead of heaps :)