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: docs/docs/module0/2_why_not.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ sidebar_position: 2
4
4
5
5
# Why not Rust
6
6
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.
8
8
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.
10
10
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.
12
12
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.
14
14
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.
To see this in action, go and run the `module3` code:
14
+
15
+
```rust
16
+
letinteger_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!
Copy file name to clipboardExpand all lines: docs/docs/module2/9_challenge.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
sidebar_position: 8
2
+
sidebar_position: 9
3
3
---
4
4
5
5
# Challenge
@@ -12,7 +12,7 @@ Open up Activity Monitor on Mac, or Task Manager on Windows, and then run both t
12
12
13
13
## Challenge
14
14
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.
16
16
17
17
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.
Copy file name to clipboardExpand all lines: docs/docs/module3/3_shadowing.md
-16Lines changed: 0 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,6 @@
2
2
sidebar_position: 3
3
3
---
4
4
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
-
letmutstr_example="This string is now mutable";
17
-
str_example="And can be edited";
18
-
println!("{}", str_example);
19
-
```
20
-
21
5
## Shadowing
22
6
23
7
When you're working with Rust, you'll often encounter a concept called shadowing. Here's how it works:
0 commit comments