Tüm Rehberler

Rust ve Cargo Kurulumu

Rust programlama dilini ve Cargo paket yöneticisini kurun.

Orta15 dk

Kurulum Adımları

1. Rust'ı rustup ile kurun:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

2. Shell'i yeniden yükleyin:

source $HOME/.cargo/env

3. Versiyonları kontrol edin:

rustc --version
cargo --version

4. Yeni proje oluşturun:

cargo new proje_adi
cd proje_adi

5. Proje yapısı:

proje_adi/
  src/main.rs
  Cargo.toml

6. Programı derleyin ve çalıştırın:

cargo run

7. Release build:

cargo build --release

8. Bağımlılık ekleme (Cargo.toml):

[dependencies]
serde = { version = "1.0", features = ["derive"] }
reqwest = { version = "0.12", features = ["json"] }
tokio = { version = "1", features = ["full"] }

9. Paketleri yükleyin:

cargo build

10. Testleri çalıştırın:

cargo test

11. Rust'ı güncelleyin:

rustup update