Async Rust is powerful. And it can be a pain to work with (and learn). Async Rust can be a pleasure to work with, though, if we can do it without `Send + Sync + 'static`.
I’m not sure what tokio (or axum) can do to avoid the trait bounds. Would it makes sense to provide a “share nothing” runtime implementation that can be injected at startup? I wonder how the intermediate layers (e.g. axum) would indicate that futures are usable by a more generic runtime which may or may not need Send + 'static.
Without some way to write generic code for either runtime, the whole tokio ecosystem would end up bifurcated by this choice of runtime.
I’m not sure what tokio (or axum) can do to avoid the trait bounds. Would it makes sense to provide a “share nothing” runtime implementation that can be injected at startup? I wonder how the intermediate layers (e.g. axum) would indicate that futures are usable by a more generic runtime which may or may not need
Send + 'static
.Without some way to write generic code for either runtime, the whole tokio ecosystem would end up bifurcated by this choice of runtime.
Isn’t this
tokio::task::spawn_local
?Not exactly. I’m talking specifically about being able to call
axum::serve
with non-Send futures.