[Rust] Cargo
Updated:
개요
- 빌드 시스템 및 패키지 매니저
명령어
- 크레이트(crate) 생성 및 초기화
- 라이브러리
cargo new ${project name} --lib
- 바이너리
cargo new ${project name} --bin
- 라이브러리
- 크레이트(crate) 초기화
- 라이브러리
cargo init ${project name} --lib
- 바이너리
cargo init ${project name} --bin
- 라이브러리
- 디버그 빌드
cargo build
- 바이너리 위치
.\target\debug\${project name}
- 릴리스 빌드
cargo build --release
- 바이너리 위치
.\target\release\${project name}
- 빌드 및 실행
cargo run
- 컴파일 여부 확인
cargo check
- 바이너리 생성 과정이 빠지므로 build에 비해 속도가 빠름
- crate 업데이트
cargo update
Cargo.toml
-
[package] name = "test" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [profile.dev] opt-level = 0 [profile.release] opt-level = 3 [dependencies]