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
480
Rustのweb開発を助ける 便利なツール紹介
Rustの web開発がもっと楽になる、そんなツールの紹介です。
Yuki Ishii
July 16, 2024
Tweet
Share
More Decks by Yuki Ishii
See All by Yuki Ishii
Server側でStateを使用した時の情報漏洩の危険性を見てみる
yuki0418
1
110
Other Decks in Programming
See All in Programming
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
520
個人軟體時代
ethanhuang13
0
320
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
140
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
120
Laravel Boost 超入門
fire_arlo
3
210
速いWebフレームワークを作る
yusukebe
5
1.7k
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
230
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
140
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
210
AIコーディングAgentとの向き合い方
eycjur
0
270
もうちょっといいRubyプロファイラを作りたい (2025)
osyoyu
1
420
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
10
3.8k
Featured
See All Featured
The Language of Interfaces
destraynor
161
25k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Making Projects Easy
brettharned
117
6.4k
Typedesign – Prime Four
hannesfritz
42
2.8k
A designer walks into a library…
pauljervisheath
207
24k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.2k
For a Future-Friendly Web
brad_frost
180
9.9k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Agile that works and the tools we love
rasmusluckow
330
21k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
A better future with KSS
kneath
239
17k
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