Skip to content

Commit

Permalink
week2 essential mission added
Browse files Browse the repository at this point in the history
  • Loading branch information
4roring committed Sep 3, 2023
1 parent 73124c2 commit af3f51b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 4 deletions.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Created by https://www.toptal.com/developers/gitignore/api/rust,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=rust,visualstudiocode

### Rust ###
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.toml
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/rust,visualstudiocode
Binary file added images/2_OwnerShip/03_essential_mission.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions missions/week2/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fn sum_array(input: &[i32]) -> i32 {
todo!();
}

fn swap(lhs: &mut String, rhs: &mut String) {
todo!();
}

fn main() {
let input_arr = [1, 2, 3, 4, 5];
let sum_arr = sum_array(&input_arr);
const SUM_RESULT: i32 = 15;
assert!(sum_arr == SUM_RESULT);
println!("{sum_arr} == {SUM_RESULT}");

let mut lhs = String::from("AAA");
let mut rhs = String::from("BBB");
swap(&mut lhs, &mut rhs);
assert!(lhs == "BBB");
assert!(rhs == "AAA");
println!("{lhs} {rhs}");
}
12 changes: 9 additions & 3 deletions ppt/2_ownership.html

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion ppt/2_ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,9 @@ let slice = &a[1..3]; // [2, 3]

# 2주차 미션

---
---

![height:500px](../images/2_OwnerShip/03_essential_mission.png)

- [저장소의 missions/week2/main.rs 완성하기](https://github.com/4roring/cheese-cRust/tree/master/missions/week2/main.rs)
**(필수 미션)**

0 comments on commit af3f51b

Please sign in to comment.