Skip to content
Snippets Groups Projects
Commit 27bcc4e2 authored by Jeff Smits's avatar Jeff Smits
Browse files

Add slide on strike. Fix small bugs in slides intro rust

parent 19f7badc
Branches main
No related tags found
No related merge requests found
Pipeline #1234097 passed
......@@ -72,8 +72,8 @@ int main () {
while (1) {}
}
int unused() {
std::cout << "unused?" << std::endl;
int unreachable() {
std::cout << "hello, world" << std::endl;
}
```
......@@ -797,7 +797,7 @@ Hard to know with what values `x` and `y` this code even terminates
fn even_sum(numbers: &Vec<i32>) -> i32 {
let mut result = 0;
for i in numbers {
if i % 2 == 0 {result += i};
if i % 2 == 0 {result += i}
}
result
}
......@@ -988,12 +988,12 @@ Example 2: Copying elements
```rust
fn fill_vector_with_ref(src: &u32, dst: &mut Vec<u32>) {
for i in 0..src.len() { dst[i] = *src; }
for i in 0..dst.len() { dst[i] = *src; }
}
fn fill_vector_with_ref(src: &u32, dst: &mut Vec<u32>) {
let value = *src;
for i in 0..src.len() { dst[i] = value; }
for i in 0..dst.len() { dst[i] = value; }
}
```
......@@ -1010,12 +1010,12 @@ What if `src` is an element in `dst`?
```rust
fn fill_vector_with_ref(src: &u32, dst: &mut Vec<u32>) {
for i in 0..src.len() { dst[i] = *src; }
for i in 0..dst.len() { dst[i] = *src; }
}
fn fill_vector_with_ref(src: &u32, dst: &mut Vec<u32>) {
let value = *src;
for i in 0..src.len() { dst[i] = value; }
for i in 0..dst.len() { dst[i] = value; }
}
let mut x = vec![1, 2, 3];
......
......@@ -24,6 +24,7 @@ filters:
---
## Take-home message: Rust is pretty great
- **Fancy types from Functional Programming**
- **Ownership and Mutability**
- Use these two to make impossible states unexpressible
......@@ -37,6 +38,9 @@ filters:
![](img/REIT_courses_ad.png)
## {background-image="img/tu-delft-strike.png" background-size="contain"}
# Thank you!
We'd love your feedback!
......
content/img/tu-delft-strike.png

660 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment