exercises 06 done, onto structs

This commit is contained in:
2026-06-17 16:13:28 +02:00
parent 6baf967df0
commit 8031b2858f
11 changed files with 112 additions and 27 deletions
+17 -2
View File
@@ -1,4 +1,19 @@
fn main() {
// DON'T EDIT THIS SOLUTION FILE!
// It will be automatically filled after you finish the exercise.
// You can optionally experiment here.
}
#[cfg(test)]
mod tests {
#[test]
fn move_semantics4() {
let mut x = Vec::new();
let y = &mut x;
// `y` used here.
y.push(42);
// The mutable reference `y` is not used anymore,
// therefore a new reference can be created.
let z = &mut x;
z.push(13);
assert_eq!(x, [42, 13]);
}
}