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
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
230
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
1.5k
為你自己學 Python - 冷知識篇
eddie
1
350
Reading Rails 1.0 Source Code
okuramasafumi
0
240
Vue・React マルチプロダクト開発を支える Vite
andpad
0
110
チームのテスト力を鍛える
goyoki
3
170
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
600
Zendeskのチケットを Amazon Bedrockで 解析した
ryokosuge
3
310
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
450
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
テストコードはもう書かない:JetBrains AI Assistantに委ねる非同期処理のテスト自動設計・生成
makun
0
320
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.6k
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
13k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
GraphQLとの向き合い方2022年版
quramy
49
14k
Embracing the Ebb and Flow
colly
87
4.8k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.2k
Bash Introduction
62gerente
615
210k
Unsuck your backbone
ammeep
671
58k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
Scaling GitHub
holman
463
140k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
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