You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/vision/status_quo.md
+137-3Lines changed: 137 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,140 @@ These stories may not be true, but they are not fiction. They are based on real-
28
28
29
29
[roadmap]: ./roadmap.md
30
30
31
-
## Where are the stories?
32
-
33
-
Check the sidebar with the table of contents bar!
31
+
## Metanarrative
32
+
33
+
*What follows is a kind of "metanarrative" of using async Rust that summarizes the challenges that are present today. At each point, we link to the various stories; you can read the full set in the table of contents on the left. We would like to extend this to also cover some of its glories, since reading the current stories is a litany of difficulties, but obviouly we see great promise in async Rust. Note that many stories here appear more than once.*
34
+
35
+
Rust strives to be a language that brings together performance, productivity, and correctness. Rust programs are designed to surface bugs early and to make common patterns both ergonomic and efficient, leading to a sense that "if it compiles, it generally works, and works efficiently". Async Rust aims to extend that same feeling to an async setting, in which a single process interweaves numerous tasks that execute concurrently. Sometimes this works beautifully. However, other times, the reality falls short of that goal.
36
+
37
+
<details><summary>Making hard choices from a complex ecosystem from the start</summary>
38
+
39
+
The problems begin from the very first moment a user starts to try out async Rust. The async Rust support in Rust itself is very basic, consisting only of the core Future mechanism. Everything else -- including the basic async runtimes themselves -- lives in user space. This means that users must make a number of choices rom the very beginning:
40
+
41
+
* what runtime to use
42
+
*[Barbara makes their first foray into async](status_quo/barbara_makes_their_first_steps_into_async.md)
43
+
*[Niklaus wants to share knowledge](status_quo/niklaus_wants_to_share_knowledge.md)
44
+
* what http libraries to use
45
+
*[Barbara anguishes over http](status_quo/barbara_anguishes_over_http.md)
46
+
* basic helpers and utility crates are hard to find, and there are many choices, often with subtle differences between them
* Furthermore, the async ecosystem is fractured. Choosing one library may entail choosing a specific runtime. Sometimes you may wind up with multiple runtimes running at once.
49
+
*[Alan started trusting the rust compiler but then async](status_quo/alan_started_trusting_the_rust_compiler_but_then_async.md)
* 🚧 Need a story about multiple runtimes working together
52
+
* There is a lack of common, standardized abstractions, which means that often there are multiple attempts to establish common traits and different libraries will employ a distinct subset.
53
+
*[`Sink` is not implemented by async-std websockets](status_quo/alan_tries_a_socket_sink.md)
54
+
* 🚧 No standardized lower-level traits for read, write, iterators in an async setting
55
+
* 🚧 Lack of widely used higher-level abstractions (like those tower aims to provide)
56
+
* 🚧 Tokio doesn't support the futures `Stream` trait because of stability concerns
57
+
* Some of the problems are due to the design of Rust itself. The coherence rules in particular.
58
+
* 🚧 Write about how coherence makes it impossible to establish
59
+
60
+
</details>
61
+
62
+
<details><summary>Once your basic setup is done, the best design patterns are subtle and not always known.</summary>
63
+
64
+
Writing async programs turns out to have all kinds of subtle tradeoffs. Rust aims to be a language that gives its users control, but that also means that users wind up having to make a lot of choices, and we don't give them much guidance.
65
+
66
+
* If you need synchronization, you might want an async lock, but you might want a synchronous lock, it's hard to know.
67
+
*[Alan thinks he needs async locks](status_quo/alan_thinks_he_needs_async_locks.md)
68
+
* Mixing sync and async code is tricky and it's not always obvious how to do it -- something it's not even clear what is "sync" (how long does a loop have to run before you can consider it blocking?)
69
+
*[Barbara bridges sync and async](status_quo/barbara_bridges_sync_and_async.md)
70
+
*[Barbara compares some C++ code](status_quo/barbara_compares_some_cpp_code.md)
71
+
* There are often many options for doing things like writing futures or other core concepts; which libraries or patterns are best?
*[Grace wants to integrate c api](status_quo/grace_wants_to_integrate_c_api.html#the-second-problem-doing-this-many-times)
74
+
*[Barbara plays with async](status_quo/barbara_plays_with_async.md), where she tries a number of combinations before she lands on `Box::pin(async move { .. })`
75
+
* If you would to have data or task parallel operations, it's not always obvious how to do that
76
+
*[Barbara plays with async](status_quo/barbara_plays_with_async.md)
<details><summary>Rust has always aimed to interoperate well with other languages and to fit itself into every niche, but that's harder with async.</summary>
157
+
158
+
* Runtimes like tokio and async-std are not designed to "share ownership" of the event loop with foreign runtimes
159
+
*[Alan has an event loop](status_quo/alan_has_an_event_loop.md)
160
+
* Embedded environments can have pretty stringent requirements; Future was designed to be minimal, but perhaps not minimal enough
0 commit comments