2022-12-21 16:36:30 +01:00
|
|
|
# Code Samples in This Training
|
|
|
|
|
|
|
|
For this training, we will mostly explore the Rust language through examples
|
|
|
|
which can be executed through your browser. This makes the setup much easier and
|
|
|
|
ensures a consistent experience for everyone.
|
|
|
|
|
|
|
|
Installing Cargo is still encouraged: it will make it easier for you to do the
|
|
|
|
exercises. On the last day, we will do a larger exercise which shows you how to
|
|
|
|
work with dependencies and for that you need Cargo.
|
|
|
|
|
|
|
|
The code blocks in this course are fully interactive:
|
|
|
|
|
|
|
|
```rust,editable
|
|
|
|
fn main() {
|
|
|
|
println!("Edit me!");
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-01-06 10:40:37 +01:00
|
|
|
You can use <kbd>Ctrl + Enter</kbd> to execute the code when focus is in the
|
|
|
|
text box.
|
2023-01-07 16:51:57 +01:00
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
|
|
Most code samples are editable like shown above. A few code samples
|
|
|
|
are not editable for various reasons:
|
|
|
|
|
|
|
|
* The embedded playgrounds cannot execute unit tests. Copy-paste the
|
|
|
|
code and open it in the real Playground to demonstrate unit tests.
|
|
|
|
|
|
|
|
* The embedded playgrounds lose their state the moment you navigate
|
|
|
|
away from the page! This is the reason that the students should
|
|
|
|
solve the exercises using a local Rust installation or via the
|
|
|
|
Playground.
|
|
|
|
|
|
|
|
</details>
|