Better approach for statically dispatching async function?

⚓ Rust    📅 2025-08-08    👤 surdeus    👁️ 5      

surdeus

Hello everyone,
I recently discovered the linkme crate, and I find its capabilities to be incredibly compelling.

The ability to statically distribute code at virtually no cost, and with a convenience that rivals dynamic dispatch, is an excellent feature. I have successfully used it to build several small utilities, and I am now hoping to apply it to a more substantial project.

However, I have encountered an unexpected challenge. I had assumed that distributing an async fn would be as straightforward as a regular fn. After attempting various approaches, I have come to realise this is not the case. It appears that distributing an async fn necessitates incurring the overhead associated with dyn, a limitation I find quite frustrating.

I would be very grateful for any suggestions from the community on this matter. Is there a known method to statically dispatch async fn with the same convenience that linkme provides for synchronous functions, but without resorting to the dyn keyword?

Thank you for your time and assistance.

3 posts - 3 participants

Read full topic

🏷️ Rust_feed