mirror of
https://github.com/microsoft/RustTraining.git
synced 2026-05-06 06:06:43 -04:00
Fix reported issues: hint mismatch, broken diagrams, chapter ordering
- async ch15: Fix exercise 4 hint to say Semaphore instead of mpsc - python ch12: Fix broken Mermaid iterator chain diagram (quote edge labels) - python ch14: Remove unnecessary escaped parens in Mermaid node label - c-cpp ch16: Rename sub-chapter file so it sorts after parent in file listings - c-cpp SUMMARY: Update sub-chapter title to reflect case studies 3-5
This commit is contained in:
@@ -196,7 +196,7 @@ async fn main() {
|
||||
|
||||
Implement an async-aware mutex using channels (without using `tokio::sync::Mutex`).
|
||||
|
||||
*Hint*: Use a `tokio::sync::mpsc` channel with capacity 1 as a semaphore.
|
||||
*Hint*: Use a `tokio::sync::Semaphore` with 1 permit to serialize access.
|
||||
|
||||
<details>
|
||||
<summary>🔑 Solution</summary>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
- [15. no_std — Rust Without the Standard Library](ch15-no_std-rust-without-the-standard-library.md)
|
||||
- [Embedded Deep Dive](ch15-1-embedded-deep-dive.md)
|
||||
- [16. Case Studies: Real-World C++ to Rust](ch16-case-studies.md)
|
||||
- [Case Study — Lifetime Borrowing](ch16-1-case-study-lifetime-borrowing.md)
|
||||
- [Case Studies 3–5: Lifetimes, Composability, Trait Objects](ch16-cases-3-5-lifetime-borrowing.md)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -173,10 +173,10 @@ flat = [item for sublist in nested for item in sublist]
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A["Source<br/>[1,2,3,4,5]"] -->|.iter\(\)| B["Iterator"]
|
||||
B -->|.filter\(\|x\| x%2==0\)| C["[2, 4]"]
|
||||
C -->|.map\(\|x\| x*x\)| D["[4, 16]"]
|
||||
D -->|.collect\(\)| E["Vec<i32><br/>[4, 16]"]
|
||||
A["Source<br/>[1,2,3,4,5]"] -->|".iter()"| B["Iterator"]
|
||||
B -->|".filter(x: x%2==0)"| C["[2, 4]"]
|
||||
C -->|".map(x: x*x)"| D["[4, 16]"]
|
||||
D -->|".collect()"| E["Vec<i32><br/>[4, 16]"]
|
||||
style A fill:#ffeeba
|
||||
style E fill:#d4edda
|
||||
```
|
||||
|
||||
@@ -13,7 +13,7 @@ Python never gives you direct memory access.
|
||||
flowchart TB
|
||||
subgraph Safe ["Safe Rust (99% of code)"]
|
||||
S1["Your application logic"]
|
||||
S2["pub fn safe_api\(&self\) -> Result"]
|
||||
S2["pub fn safe_api(&self) -> Result"]
|
||||
end
|
||||
subgraph Unsafe ["unsafe block (minimal, audited)"]
|
||||
U1["Raw pointer dereference"]
|
||||
|
||||
Reference in New Issue
Block a user