Skip to content

Commit 6b7724d

Browse files
committed
feat: update docs order and examples
1 parent 1639775 commit 6b7724d

File tree

6 files changed

+41
-49
lines changed

6 files changed

+41
-49
lines changed

docs/docs/module0/2_why_not.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ sidebar_position: 2
44

55
# Why not Rust
66

7-
1. **Learning Curve**: I'll be honest with you—Rust has a steeper learning curve than many languages, including C#. The ownership and borrowing concepts will challenge you, especially in your first few weeks. You'll likely experience what Rustaceans call "fighting with the borrow checker" as you learn to structure your code to satisfy Rust's strict rules. Don't be discouraged! The struggle is temporary, and most developers report a "click moment" when these concepts suddenly make sense. The compiler provides extremely helpful error messages that guide you toward correct code, and the community is exceptionally welcoming to beginners.
7+
1. **Ecosystem Maturity**: While the Rust ecosystem has grown impressively, it's still younger than .NET's. Some specialized libraries might be less mature or feature-complete than their .NET counterparts. You may occasionally need to implement functionality yourself that would be available out-of-the-box in .NET. The good news is that the ecosystem is growing rapidly, and many libraries are already production-ready.
88

9-
2. **Ecosystem Maturity**: While the Rust ecosystem has grown impressively, it's still younger than .NET's. Some specialized libraries might be less mature or feature-complete than their .NET counterparts. You may occasionally need to implement functionality yourself that would be available out-of-the-box in .NET. The good news is that the ecosystem is growing rapidly, and many libraries are already production-ready.
9+
2. **Team Adoption**: If you're working on a team, transitioning to Rust requires bringing everyone along on the learning journey. Finding experienced Rust developers for hiring can be more challenging than finding .NET developers, though this is changing as Rust's popularity continues to grow. You'll need to factor in training time and potential short-term productivity impacts when considering adoption.
1010

11-
3. **Team Adoption**: If you're working on a team, transitioning to Rust requires bringing everyone along on the learning journey. Finding experienced Rust developers for hiring can be more challenging than finding .NET developers, though this is changing as Rust's popularity continues to grow. You'll need to factor in training time and potential short-term productivity impacts when considering adoption.
11+
3. **Compile Times**: Rust is slower than compiling code than .NET. The compiler toolchain is complex, and as you'll see throughout the workshop there are a lot of safety checks that happen at compile time. This is beneficial, as it removes a whole class of runtime bugs. Equally, you will find yourself sat around waiting for compilation to happen. Particularly if you're working on a large code base with lots of dependencies.
1212

13-
4. **Compile Times**: Rust is slower than compiling code than .NET. The compiler toolchain is complex, and as you'll see throughout the workshop there are a lot of safety checks that happen at compile time. This is beneficial, as it removes a whole class of runtime bugs. Equally, you will find yourself sat around waiting for compilation to happen. Particularly if you're working on a large code base with lots of dependencies.
13+
4. **Strictness**: The Rust compiler is strict. At some point in your Rust journey you'll find yourself swearing at the compiler wondering why the code you've written won't compile. The strictness is intentional, it stops you being a lazy programmer. Eventually, you'll come to appreciate this feature. I promise.
1414

15-
5. **Strictness**: The Rust compiler is strict. At some point in your Rust journey you'll find yourself swearing at the compiler wondering why the code you've written won't compile. The strictness is intentional, it stops you being a lazy programmer. Eventually, you'll come to appreciate this feature. I promise.
15+
5. **Learning Curve**: I'll be honest with you—Rust has a steeper learning curve than many languages, including C#. The ownership and borrowing concepts will challenge you, especially in your first few weeks. You'll likely experience what Rustaceans call "fighting with the borrow checker" as you learn to structure your code to satisfy Rust's strict rules. Don't be discouraged! The struggle is temporary, and most developers report a "click moment" when these concepts suddenly make sense. The compiler provides extremely helpful error messages that guide you toward correct code, and the community is exceptionally welcoming to beginners.

docs/docs/module2/8_mutability.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_position: 8
3+
---
4+
5+
# Mutability
6+
7+
:::important
8+
9+
Every variable in Rust is immutable by default.
10+
11+
:::
12+
13+
To see this in action, go and run the `module3` code:
14+
15+
```rust
16+
let integer_example = 99;
17+
integer_example = 12;
18+
```
19+
20+
And oops! There's a problem:
21+
22+
**error[E0384]: cannot assign twice to immutable variable `integer_example`**
23+
24+
So how would you go about declaring a variable that you could change? That's easy, introducing the `mut` keyword.
25+
26+
:::important
27+
The `mut` keywords explicitally declares a variable as something you want to mutate later. If you declare a variable as mutable but never actually change it, the compiler will give you a warning and recommend you remove the `mut` keyword. Neat!
28+
:::
29+
30+
```rust showLineNumbers
31+
let mut str_example = "This string is now mutable";
32+
str_example = "And can be edited";
33+
println!("{}", str_example);
34+
```
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 8
2+
sidebar_position: 9
33
---
44

55
# Challenge
@@ -12,7 +12,7 @@ Open up Activity Monitor on Mac, or Task Manager on Windows, and then run both t
1212

1313
## Challenge
1414

15-
The code in [src/examples/module2/rust_app](/src/examples/module2/rust_app/) contains the beginnings of a user management application. But it **doesn't compile** 🥺, your challenge is to get this small code snippet working. There are issues with borrowing, ownership and mutability.
15+
The code in `src/examples/module2/rust_app` contains the beginnings of a user management application. But it **doesn't compile** 🥺, your challenge is to get this small code snippet working. There are issues with borrowing, ownership and mutability.
1616

1717
If you get past that, you can also try to better handle errors in the `update_name` function. Instead of always updating the name, let's return an error if the length of the new name is less than or equal to zero.
1818

docs/docs/module3/3_0_mutability.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/docs/module3/3_5_mutability_part_2.md renamed to docs/docs/module3/3_shadowing.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@
22
sidebar_position: 3
33
---
44

5-
# Mutability Part 2
6-
7-
If you delete the line assigning the `integer_example` then congrats 🎉 You're a Rust developer now.
8-
9-
So how would you go about declaring a variable that you could change? That's easy, introducing the `mut` keyword.
10-
11-
:::important
12-
The `mut` keywords explicitally declares a variable as something you want to mutate later. If you declare a variable as mutable but never actually change it, the compiler will give you a warning and recommend you remove the `mut` keyword. Neat!
13-
:::
14-
15-
```rust showLineNumbers
16-
let mut str_example = "This string is now mutable";
17-
str_example = "And can be edited";
18-
println!("{}", str_example);
19-
```
20-
215
## Shadowing
226

237
When you're working with Rust, you'll often encounter a concept called shadowing. Here's how it works:

src/examples/module3/rust_app/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ async fn main() {
3131
let bool_example: bool = true;
3232
println!("{}", bool_example);
3333

34-
integer_example = 99;
35-
3634
// Everything is immutable by default in Rust
3735
let mut mutable_string = "Hello";
3836
mutable_string = "Hello World";

0 commit comments

Comments
 (0)