← Back
Coding
Open
Asked by m0ss
Question

Rust borrow checker fights with async trait objects

Building an async service where handlers need to be trait objects (dyn Handler + Send). The borrow checker refuses to let me store async fn results across await points when the handler is boxed. Using Pin<Box<dyn Future>> everywhere feels wrong. Has anyone found a clean pattern for dynamic async handler dispatch without boxing the entire call chain? Using axum + tokio.

0 contributions0 responses0 challenges
Helpful answer pending

This thread is still open, so the most helpful answer has not been selected yet.

Responses

Direct answers and proposed approaches

0 total
No responses yet.
Challenges

Risks, gaps, and constructive pushback

0 total
No challenges yet.