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アプリケーション(1)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
NearMeの技術発表資料です
PRO
December 09, 2022
Programming
59
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RustでつくるWebアプリケーション(1)
NearMeの技術発表資料です
PRO
December 09, 2022
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
36
LLM + 強化学習
nearme_tech
PRO
0
23
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
30
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
59
初めてのLean言語
nearme_tech
PRO
0
94
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
33
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
66
SQL/ID抽出タスクから考える 実践的なハルシネーション対策
nearme_tech
PRO
1
81
OpenCode & Local LLM
nearme_tech
PRO
0
280
Other Decks in Programming
See All in Programming
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
260
今さら聞けない .NET CLI
htkym
0
200
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
490
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
250
プロポーザルを書いてもらう
pvcresin
0
560
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
110
メールのエイリアス機能を履き違えない
isshinfunada
0
250
SlackアプリとLambdaの 連携を構築した話
pawn_4_s
1
130
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
340
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
190
Android CLI
fornewid
0
230
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4.9k
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Cult of Friendly URLs
andyhume
79
7k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
A better future with KSS
kneath
240
18k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Automating Front-end Workflow
addyosmani
1369
210k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Docker and Python
trallard
47
4.1k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
4 Signs Your Business is Dying
shpigford
187
23k
Transcript
0 RustでつくるWebアプリケーション(1) 2022-12-9 第24回NearMe技術勉強会 Asahi Kaito
1 今回から、本格的にアプリケーションを 作成していきます
2 今回は、 (1) Actixの使い方 (2) Rustの文法〜trait〜とは ついてまとめます。
3 今回用いるもの • Rust → これがなくては始まらない • Cargo → Rustのプロジェクト作成に必要
• Actix → Rust用のWebフレームワーク
4 Actixとは 公式Webサイトによると... “ Actix Web is a powerful, pragmatic,
and extremely fast web framework for Rust “ 高速なWebフレームワークをRustで作れますよということです! https://actix.rs/
5 Actixの例(基本編) use actix_web::{web, App, HttpRequest, HttpServer, Responder}; async fn
greet(req: HttpRequest) -> impl Responder { let name = req.match_info().get("name").unwrap_or("World"); format!("Hello {}!", &name) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .route("/", web::get().to(greet)) .route("/{name}", web::get().to(greet)) }) .bind(("127.0.0.1", 8080))? .run() .await } https://actix.rs/
6 Actixの例(基本編) use actix_web::{web, App, HttpRequest, HttpServer, Responder}; async fn
greet(req: HttpRequest) -> impl Responder { let name = req.match_info().get("name").unwrap_or("World"); format!("Hello {}!", &name) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .route("/", web::get().to(greet)) .route("/{name}", web::get().to(greet)) }) .bind(("127.0.0.1", 8080))? .run() .await } https://actix.rs/ “http://127.0.0.1:8080”に接続すると... “http://127.0.0.1:8080/{適当な文字列}”に接続すると...
7 〜ハンズオン中〜
8 Actixの例(getマクロを用いる) use actix_web::{get, web, App, HttpRequest, HttpServer, Responder}; #[get("/")]
async fn index(_req: HttpRequest) -> impl Responder { "Hello from the index page." } async fn hello(path: web::Path<String>) -> impl Responder { format!("Hello {}!", &path) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(index) .route("/{name}", web::get().to(hello)) }).bind(("127.0.0.1", 8080))?.run().await } https://actix.rs/
9 Actixの例(getマクロを用いる) use actix_web::{get, web, App, HttpRequest, HttpServer, Responder}; #[get("/")]
async fn index(_req: HttpRequest) -> impl Responder { "Hello from the index page." } async fn hello(path: web::Path<String>) -> impl Responder { format!("Hello {}!", &path) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(index) .route("/{name}", web::get().to(hello)) }).bind(("127.0.0.1", 8080))?.run().await } “http://127.0.0.1:8080”に接続すると... “http://127.0.0.1:8080/{適当な文字列}”に接続すると... https://actix.rs/
10 〜ハンズオン中〜
11 Rustの文法~traitとは?~ • trait = 型 → 複数の構造体などに同じような振る舞いを適用させたいときに 用い る
• traitの使い方 (1) traitを作成する (2) 構造体を作成する (3) implを用いて、traitを構造体に適用する
12 Rustの文法~traitとは?~ (1) traitを作成する pub trait Introduction { fn introduction(&self)
-> String; } (2) 構造体を作成する pub struct Pokemon { pub name: String, pub types: Vec<String>, pub tera_type: String, pub location: String, }
13 Rustの文法~traitとは?~ (3) implを用いて、traitを構造体に適用する impl Introduction for Pokemon { fn
introduction(&self) -> String { format!( "Name: {}, types: {:?}, tera_type: {}, location: {}", self.name, self.types, self.tera_type, self.location ) } }
14 〜ハンズオン中〜
15 Thank you