文書の過去の版を表示しています。
Rust ランゲージ メモ
よく使う機能 - Cargo 編 😍
新しいパッケージの作成 [new]
$ cargo new haruo_axum
Creating binary (application) `haruo_axum` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ tree haruo_axum
haruo_axum
├── Cargo.toml
└── src
└── main.rs
依存するクレートの追加 [add]
Cargo.toml を手で編集することなく、cargo add で好きなクレートをどんどん追加して開発できる😊
$ cd haruo_axum $ bat -p Cargo.toml
[package] name = "haruo_axum" version = "0.1.0" edition = "2021" [dependencies]
Axum を追加する場合…🤔
$ cargo add axum
Updating crates.io index
Adding axum v0.7.5 to dependencies
Features:
+ form
+ http1
+ json
+ matched-path
+ original-uri
+ query
+ tokio
+ tower-log
+ tracing
- __private_docs
- http2
- macros
- multipart
- ws
Updating crates.io index
$ bat -p Cargo.toml
[package] name = "haruo_axum" version = "0.1.0" edition = "2021" [dependencies] axum = "0.7.5"