Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rustのweb開発を助ける 便利なツール紹介
Search
Yuki Ishii
July 16, 2024
Programming
1
350
Rustのweb開発を助ける 便利なツール紹介
Rustの web開発がもっと楽になる、そんなツールの紹介です。
Yuki Ishii
July 16, 2024
Tweet
Share
Other Decks in Programming
See All in Programming
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
0
200
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
510
CSC509 Lecture 06
javiergs
PRO
0
140
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
2
320
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
2
1.5k
GPU Hash Table | レイトレ合宿10
yknishidate
0
360
Synchronizationを支える技術
s_shimotori
1
130
Identifying User Idenity
moro
4
5.1k
Java ジェネリクス入門 2024
nagise
0
480
#pixiv小説画像メーカー はこうしてできた / The Making of the pixiv Novel Image Maker
roiban
0
170
Workflow automationによるインシデント原因調査の自動化
showwin
1
120
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
160
Featured
See All Featured
Designing for humans not robots
tammielis
249
25k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
Become a Pro
speakerdeck
PRO
24
4.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Scaling GitHub
holman
458
140k
A Philosophy of Restraint
colly
203
16k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Thoughts on Productivity
jonyablonski
67
4.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Why Our Code Smells
bkeepers
PRO
334
57k
Statistics for Hackers
jakevdp
796
220k
Transcript
Rustのweb開発を助ける 便利なツール紹介 Yuki Ishii (いっしー)
自己紹介 - Yuki Ishii (いっしー) 開発: Web Development 経歴: ex-CyberAgent
はこぶね便事務局 (現 ひとりエンジニア) 使用言語: Rust, Svelte X: @YukiIshii10 Blog: https://blog.yuki-dev.com/ 副業もしてます
Summary 目的: 少しでも Rust でのWeb開発を楽しくなるように ターゲット : Rustで開発をしている人・はじめようとしてる人 今回は簡単な紹介になります。 どれも素敵なツールなので深い機能などは是非調べてみてください!
紹介する ツール - cargo-clippy - cargo-fmt - cargo-machete - cargo-nextest
- cargo-make - Cargo-audit - testcontainers-rs - VScode extension - crates
cargo-clippy cargo-fmt
cargo-clippy と cargo-fmt みんな大好き Rustの公式 Linter と Formatter. clippy は
静的解析ツールで 未使用の変数や関数、Clippy Lintsというサイトで定義され ている文法の場合は warn または deny を教えてくれます。 Clippy Lints: https://rust-lang.github.io/rust-clippy/master/index.html fmt は公式の フォーマッターで style guidelines に基づいて 自動でフォーマットをかけ てくれます。
cargo-clippy 円周率などの数学定数を扱った場合 $ cargo clippy をすると下記のように表示されます。
cargo-clippy 今回の円周率の場合は PI というconstant が用意されているのでそちらを使うように教 えてくれたので変更。
cargo-fmt $ cargo fmt で 自動的にオートフォーマットをかけてくれます。 無駄な new line や
スペースを消したり、見やすいように改行してくれます。 VS Code なら下記の設定を追加すると on save で自動で format をかけてくれます。
cargo-machete
cargo-machete 未使用の dependencies を教えてくれます。 例では serde を使ってない事を教えてくれました。
cargo-machete Actionが用意されてるので主に マージ前にチェックしてます。
cargo-nextest
cargo-nextest Rust の test runner です。 Features: - cargo test
に比べて 2x - 3x 早いです (ベンチマーク参照) - cargo test より UI が綺麗です - Slow and leaky テストを検知してくれます - pre-built binaries 用意されてるので CI 導入が楽です - config が豊富 - Doctests がまだサポートされてません・・・
cargo-nextest cargo test cargo nextest
cargo-make
cargo-make Rust の task runner です。機能がやたら豊富です。 Features: - Tasks, Dependencies,
and Aliases - Commands, Scripts, and Sub Tasks - Conditions - Environment Variables - Other Programming Languages - etc…
cargo-make Makefile.toml
cargo-make 他の言語もインストールしてなくても Script で実行できました。
cargo-audit
cargo-audit 脆弱性がある dependencies を教えてくれます。 RustSec Advisory Database という `rustsec/advisory-db` のレポジトリーにレポートが
あった Advisories を元に検知してます。 Dependabot みたいな感じです。
cargo-audit 例) libflate という crate の脆弱性
testcontainers-rs
testcontainers-rs テスト環境に必要な外部ツールなどをコンテナとして用意してくれます。これによって 外 部接続のモジュールなどをモックしたり、Dockerを用意する必要がなく、簡単にテストが 行うことができます。 また作成されたコンテナはスコープが外れたら自動的に削除されます。 例として redis を必要としてるアプリケーションのテスト時にコードから redis
server を動 かしてるコンテナを起動します。
testcontainers-rs 例) redis v7.2.4 をテスト時だけ起動する。(port 60874は自動的割り当て)
testcontainers-rs Community メンテされている testcontainers-modules を使用すればいろんな Image が module として提供されてます。
VScode extension crates
crates Cargo.toml ないの dependencies を管理するのに便利な機能を提供してます。 - Version 情報提供 - Commandで全ての
dependencies のバージョンをアップデート - Crev (Rust の public code review) のリンク表示 - Doc.rs のリンク表示
crates - Cargo.toml を開くと バージョンが 古い場合は 視覚的に教えてくれま す。 - 有効なバージョン一覧を表示してく
れます。 - crate.io, doc.rs, Crev(Check Reviews)のリンクを表示してくれま す。
crates Command で Cargo.toml ないの dependencies を update してくれます。 (あんまり使ってないかも)
eof Thank you @YukiIshii10