TLDR.chat
Get the extension
Colour theme
New summary

Reading settings

Typeface
Text size
Line spacing
Line width

Challenges of Supporting Asynchronous and Synchronous Code in Rust

Summary of The bane of my existence: Supporting both async and sync code in Rust · Open original ↗NullDeref · Mario Ortiz Manero · Jan 14, 2024

Sit beside me and hear this crazy old man's tale of when I asked Rust for too much

The article discusses the challenges of supporting both asynchronous and synchronous code in Rust, using the example of creating a library to wrap a public API. The author initially faced difficulties in accommodating both async and sync usage, leading to code duplication and complexity. They explored various solutions, including manual copy-pasting, using block_on to make async code synchronous, and even considering separate crates for async and sync usage. Ultimately, they found success with the "maybe_async" crate, which allowed them to support multiple HTTP clients independently of their async/sync nature. However, they encountered a fundamental problem with feature conflicts in Rust, which led to discussions about potential solutions and the limitations of current approaches. The author reflects on the challenges and complexities involved in supporting both async and sync code and considers potential future directions for addressing these issues in Rust.

  • The author faces challenges in supporting both async and sync code in Rust for a library wrapping a public API.
  • They explore different solutions including manual copy-pasting, using block_on, and considering separate crates, before finding success with the "maybe_async" crate.
  • Feature conflicts in Rust present a fundamental problem, leading to discussions about potential solutions and the limitations of current approaches.
  • The author reflects on the challenges and complexities involved in supporting both async and sync code and considers potential future directions for addressing these issues in Rust.

Ask about this page

Ask anything about the original page. Answers come from its text.

Only you see your questions. We don't save them.

Enter to send · Shift+Enter for a new line