Skip to content

Latest commit

 

History

History
66 lines (49 loc) · 1.04 KB

rust.md

File metadata and controls

66 lines (49 loc) · 1.04 KB

Rustの環境構築

Rust のインストール

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

環境変数の設定

source $HOME/.cargo/env

インストールの確認

rustc --version
cargo --version

プロジェクトの作成

cargo new backend
cd backend

プロジェクトをビルドして実行

# ビルド
cargo build
# 実行
cargo run

依存ライブラリの追加

Cargo.tomlに追加したいライブラリを記述する。 その後ビルドして実行する。

[package]
name = "backend"
version = "0.1.0"
edition = "2021"

[dependencies]
# フレームワーク
axum = { version = "0.7", features = ["macros"]}

[dev-dependencies]
# 開発側

テスト

# 全てのテスト
cargo test
# ユーザーサービスのテスト
cargo test user_services_test
# ユーザーサービスの統合テスト
cargo test --test user_services_integration_test