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でパケットと戯れる
Search
nwiizo
December 22, 2017
170
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rustでパケットと戯れる
nwiizo
December 22, 2017
More Decks by nwiizo
See All by nwiizo
20分でわかるセキュアAPI
nwiizo
1
200
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
14
2.4k
システムは「動く」だけでは足りない 実装編 - 非機能要件・分散システム・トレードオフをコードで見る
nwiizo
4
690
システムは「動く」だけでは 足りない - 非機能要件・分散システム・トレードオフの基礎
nwiizo
32
12k
アーキテクチャモダナイゼーションとは何か
nwiizo
19
7.5k
【社内勉強会】新年度からコーディングエージェントを使いこなす - 構造と制約で引き出すClaude Codeの実践知
nwiizo
40
24k
技術的負債の泥沼から組織を救う3つの転換点
nwiizo
9
7.8k
30分でわかるアーキテクチャモダナイゼーション
nwiizo
12
9.4k
意志を実装するアーキテクチャモダナイゼーション
nwiizo
3
5.4k
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
The Limits of Empathy - UXLibs8
cassininazir
1
600
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Prompt Engineering for Job Search
mfonobong
0
400
Tell your own story through comics
letsgokoyo
1
1k
For a Future-Friendly Web
brad_frost
183
10k
Utilizing Notion as your number one productivity tool
mfonobong
4
520
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
260
Transcript
None
None
None
None
None
None
No.1 No.4 No.3 No.2
None
No.2
No.2 • • • • • • • • •
No.2 http://rust-lang-ja.org/rust-by-example/index.html
fn main() { println!("Hello World!"); } No.2 src/main.rs
$cargo run Hello World! No.2 src/main.rs
use std::process::Command; fn main() { Command::new("ls") .arg("-l") .arg("-a") .spawn() .expect("ls
command failed to start"); } No.2
use std::net::{TcpListener, TcpStream}; use std::thread; // traits use std::io::Read; use
std::io::Write; fn handle_client(mut stream: TcpStream) { let mut buf; loop { // clear out the buffer so we don't send garbage buf = [0; 512]; let _ = match stream.read(&mut buf) { Err(e) => panic!("Got an error: {}", e), Ok(m) => { if m == 0 { // we've got an EOF break; } m }, }; match stream.write(&buf) { Err(_) => break, Ok(_) => continue, } } } fn main() { let listener = TcpListener::bind("127.0.0.1:8888").unwrap(); for stream in listener.incoming() { match stream { Err(e) => { println!("failed: {}", e) } Ok(stream) => { thread::spawn(move || { handle_client(stream) }); } } } } No.2
None
None
No.3
No.3
No.3 • • • • https://rust-lang-ja.github.io/the-rust-programming- language-ja/1.6/book/crates-and-modules.html
No.3 • • • •
None