Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Yeni bir proje oluşturma

Cargo ile olusturulan yeni bir proje, varsayilan olarak en yeni surumu kullanacak sekilde ayarlanir:

$ cargo new ornek
    Creating binary (application) `ornek` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ cat ornek/Cargo.toml
[package]
name = "ornek"
version = "0.1.0"
edition = "2024"

[dependencies]

Buradaki edition = "2024" ayari, paketin Rust 2024 surumu ile derlenecegini belirler. Ek bir ayar gerekmez.

Projeyi belirli bir surumle olusturmak icin cargo new komutunun --edition <YEAR> secenegini kullanabilirsiniz. Ornegin Rust 2018 surumunu kullanan yeni bir proje olusturmak su sekilde yapilabilir:

$ cargo new --edition 2018 ornek
    Creating binary (application) `ornek` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ cat ornek/Cargo.toml
[package]
name = "ornek"
version = "0.1.0"
edition = "2018"

[dependencies]

Surum yili icin gecersiz bir deger yazarsaniz endiselenmeyin; cargo new gecersiz bir surum yilini kabul etmez:

$ cargo new --edition 2019 ornek
error: invalid value '2019' for '--edition <YEAR>'
  [possible values: 2015, 2018, 2021, 2024]

  tip: a similar value exists: '2021'

For more information, try '--help'.

edition anahtarinin degerini, Cargo.toml dosyasini duzenleyerek kolayca degistirebilirsiniz. Ornegin paketinizi Rust 2015 surumuyle derletmek icin anahtari su sekilde ayarlarsiniz:

[package]
name = "ornek"
version = "0.1.0"
edition = "2015"

[dependencies]