I have a library that spawns a bunch of tasks. The library is very lightweight; it opens only a few TCP connections and spends 99.9% of its time idle, so scaling is not important. The library works fine with both
current_thread runtimes, and I want to provide an API that works with both. For this I need to abstract over two things:
- spawn function to use:
- "shared mutable reference" type:
A simple generalization of both of these APIs (spawn functions and ref types) would mean adding
Send constraint to my API methods even though I don't need
current_thread runtime is used.
So I need something more sophisticated, but I'm not sure what. Any help would be appreciated.