- ๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ ๋ฌ์คํธ ํ๋ก๊ทธ๋๋ฐ(https://github.com/wikibook/rust)
- The Rust Programming Language(https://rinthel.github.io/rust-lang-book-ko/ch00-00-introduction.html, https://github.com/rust-lang)
- Effective Rust(https://www.lurklurk.org/effective-rust/cover.html)
- Rust ๋ธ๋ก๊ทธ ์ถ์ฒ(https://m.blog.naver.com/PostList.naver?blogId=sssang97)
- Rust ์ค์น(https://www.rust-lang.org/tools/install)
- ๊ธฐ๋ณธ ๋๊ตฌ
- rustc (๋ฌ์คํธ ์ปดํ์ผ๋ฌ)
- rustup (๋ฌ์คํธ ์ค์น ๋๊ตฌ)
- cargo (๋ฌ์คํธ ํจํค์ง ๊ด๋ฆฌ ๋๊ตฌ)
- ์ ์ฉํ ๋๊ตฌ ์คํ
- rustfmt(์ฝ๋ ํฌ๋งทํฐ, ์ฝ๋ ์คํ์ผ ๊ต์ )
$ rustup component add rustfmt $ cargo fmt $ cargo fmt --all -- --check- Clippy(๋ฆฐํฐ, ์ฝ๊ธฐ ๋์ ์ฝ๋๋ฅผ ์์ )
$ rustup component add clippy $ cargo clippy --fix $ cargo clippy -- -D warnings - ์ฌ๋ฐ๋ฅด๊ฒ ์ค์น๋์๋์ง ํ์ธ / ์
๋ฐ์ดํธ / ์ ๊ฑฐ
$ rustc --version // ๋ฒ์ ํ์ธ $ rustup update // ์ ๋ฐ์ดํธ $ rustup self uninstall // ์ ๊ฑฐ - VSCode์์ rust-analyzer ํ์ฅ ๋ชจ๋ ์ค์น
- ์ถ๊ฐ๋ก ๋๋ฒ๊น ๋ชจ๋ ์ค์น. Microsoft C/C++, CodeLLDB: F5ํค๋ฅผ ์ด์ฉํด ๋๋ฒ๊น ์์
- ์๋ก์ด ํ๋ก์ ํธ ์์ฑ ๋ํดํธ๋ ๋ฐ์ด๋๋ฆฌ ํ๋ก์ ํธ / ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ๋ก์ ํธ ์์ฑ / ํ์ฌ ๋๋ ํ ๋ฆฌ์ ์์ฑ
$ cargo new PROJECT_NAME (--bin) // ์๋ก์ด ํ๋ก์ ํธ ์์ฑ (๋ํดํธ ๋ฐ์ด๋๋ฆฌ) $ cargo new LIBRARY_NAME --lib // ์๋ก์ด ํ๋ก์ ํธ ์์ฑ (๋ผ์ด๋ธ๋ฌ๋ฆฌ) $ cargo init // ํ์ฌ ๋๋ ํ ๋ฆฌ์ ์๋ก์ด ํ๋ก์ ํธ ์์ฑ - ํฌ๋ ์ดํธ ๊ฒ์(๋ฌ์คํธ ๊ฐ๋ฐ์๋ค์ crates.io์ ์์ ์ด ๋ง๋ ๋ฐ์ด๋๋ฆฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ณต์ ํจ.) ๋ฐ ์ค์น
$ cargo search CRATE_NAME // ํฌ๋ ์ดํธ ๊ฒ์ $ cargo install BINARY_NAME // ํฌ๋ ์ดํธ ์ค์น - Cargo.toml ํ์ธ
- ํ๋ก์ ํธ ์ด๋ฆ, ๋ฒ์ , ๋ฌ์คํธ ๋ฒ์ ๋ฑ์ด ์๋์ผ๋ก ์ ๋ ฅ.
- dependancies ๋ถ๋ถ์๋ ์ด ํจํค์ง์ ์์กด์ฑ์ ๊ฐ์ง๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ธฐ์ ํ๊ณ ๋ฒ์ ์ ๊ด๋ฆฌ
- dependancies ๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ฒ์ ์ ์ ์ ๋ค cargo buildํ๋ฉด ์๋์ผ๋ก ๋ค์ด ๊ฐ๋ฅ
- ์์ฑํ ๋ฌ์คํธ ํ๋ก์ ํธ๋ฅผ ๋น๋ํด๋ณด๊ธฐ(๋ฐ์ด๋๋ฆฌ ํ์ผ์ ์์ฑ.) / ๋น๋์ ์คํ์ ๋์์ ํด๋ณด๊ธฐ / ์ปดํ์ผ๋ง ์ํํด๋ณด๊ธฐ
$ cargo build // ๋น๋๋ง $ cargo run // ๋น๋ + ์คํ $ cargo check // ์ปดํ์ผ๋ง - .rsํ์ผ๋ง ์คํํด๋ณด๊ธฐ
$ rustc RUST_FILE.rs // ์ปดํ์ผ ์คํ $ (.\)RUST_FILE // .exe ํ์ผ ์คํ