Rust Install and Setup
INSTALL install - ์ค์น ํ ~/.bashrc์ ~/.cargo ์๋ ํ๊ฒฝ ์ค์ $ curl https://sh.rustup.rs -sSf | sh -- --help rustup ์ ๋ฐ์ดํธ/ ์ ๊ฑฐ $ rustup update $ rustup self uninstall rustc ์ปดํ์ผ๋ฌ ๋ฒ์ ํ์ธ $ rustc --version Hello World $ vim hello_world.rs fn main() { #println!๋ ํจ์๊ฐ ์๋ ๋งคํฌ๋ก println!("Hello, world!"); } $ rustc hello_world.rs Cargo๋ฅผ ํตํ ๊ฐ๋ฐ $ cargo new hello_cargo --bin $ cd hello_cargo $ vim src/main.rs fn main() { println!("Hello, world!"); } ./target/debug/hello_cargo ๋ก ๋ฐ์ด๋๋ฆฌ ์์ฑ $ cargo run # compile and run $ cargo run # run only: source is not changed $ cargo check # compile only no exe file create (rapid compile and test) $ cargo clean # cleanup all object and binary files $ cargo run -- --help #์คํํ์ผ ์ธ์๋ฅผ ๋ฐ์์ ์คํํ ๋ $ cargo build $ cargo build --release (optimize for release) ๋ชจ๋์ ์ฌ์ฉํ ๊ฒฝ์ฐ $ cargo add ansi_term #์๋์ผ๋ก Cargo.toml์ ๋ชจ๋์ด๋ฆ๊ณผ ๋ฒ์ ์ด ๋ฑ๋ก๋๋ค. $ vim src/main.rs #use ansi_term::xxxx ์ ๋ฃ๊ณ ์ฝ๋ฉ $ cargo run Build From Git $ git clone someurl.com/someproject $ cd someproject $ cargo build reference ์ ์ผ ๊ถ๊ธํ ๊ฒ์ ์ ์ฒด์ ์ธ ๊ฐ๋ฐ ๋ฐ ๋ฐฐํฌ ๊ณผ์ ์ธ๋ฐ ์๋๊ฐ ์์ฃผ ์ข์ https://free-strings.blogspot.com/2017/03/cargo-cargo.html https://rust-cli.github.io/book/tutorial/packaging.html ์์ฃผ ํ๋ฅญํ ์ฟก๋ถ์ด๋ค. ๋จผ์ ๊ธฐ๋ณธ ์จ๋ผ์ธ๋ถ์ ๋ณด๊ณ ์ ์ด๊ฒ์ ๊ณต๋ถํ์. https://rust-lang-nursery.github.io/rust-cookbook/