Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Course Rust basics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
REIT
Course Rust basics
Commits
27bcc4e2
Commit
27bcc4e2
authored
5 months ago
by
Jeff Smits
Browse files
Options
Downloads
Patches
Plain Diff
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
5 months ago
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
content/020-rust.qmd
+8
-8
8 additions, 8 deletions
content/020-rust.qmd
content/100-wrap-up.qmd
+4
-0
4 additions, 0 deletions
content/100-wrap-up.qmd
content/img/tu-delft-strike.png
+0
-0
0 additions, 0 deletions
content/img/tu-delft-strike.png
with
12 additions
and
8 deletions
content/020-rust.qmd
+
8
−
8
View file @
27bcc4e2
...
...
@@ -72,8 +72,8 @@ int main () {
while (1) {}
}
int un
used
() {
std::cout << "
unused?
" << std::endl;
int un
reachable
() {
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];
...
...
This diff is collapsed.
Click to expand it.
content/100-wrap-up.qmd
+
4
−
0
View file @
27bcc4e2
...
...
@@ -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:

## {background-image="img/tu-delft-strike.png" background-size="contain"}
# Thank you!
We'd love your feedback!
...
...
This diff is collapsed.
Click to expand it.
content/img/tu-delft-strike.png
0 → 100644
+
0
−
0
View file @
27bcc4e2
660 KiB
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment