Async/await - Is there a Spawner trait available?

Hi there, I tried searching in rust core but did not find a Spawner trait so far.
I'm trying to build a library that uses async/await and futures and shall be able to spawn new futures to whatever executer is used by the user pf the library. So I assumed there might be trait available providing an interface to spawn new futures.
Either I overlooked this or it's not there. Or should my library take the decision on the executor on it's own, so the user of it is not free to choose another executor? Any best practices would be appreciated.

There is futures::task::Spawn, but that's only implemented by futures executors. Though writing your own shims for it for other runtimes is very easy.

Hi thx for this quick reply. So, it's not in core of rust but as part of the futures crate than.
I can work with that :slight_smile:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.