Rustを使うためにやったこと

 Rustを使うためにやったこと

The Rust Programming ( https://doc.rust-lang.org/book/ )
Rust by Example ( http://rustbyexample.com )
rust-lang-nursery/rustup ( https://github.com/rust-lang-nursery/rustup.rs )
hyperium/hyper ( https://github.com/hyperium/hyper )

Dd307cfc553fa838357daa26f3f02f84?s=128

Tomohide Takao

March 01, 2017
Tweet

Transcript

  1. RustΛ࢖͏ͨΊʹ
 ΍ͬͨ͜ͱ T.Takao@Rustೖ໳ऀͷू͍#2

  2. T.Takao / @dorayaki_kun • ೔ʑɺߴඌࢁ໰୊ʹࠔ͍ͬͯ·͢ • ͓࢓ࣄͰ͸ɺ+BWB4DSJQU Java, Scala, Swift,

    Obj-C, C#ͳͲ৮ͬͯ·͢ • ࠷ۙɺगҹूΊ͍ͯ·͢
  3. Rust֨޷ྑ͍Ͱ͢ΑͶ

  4. ֨޷ྑ͍ϙΠϯτ • ؔ਺ܕݴޠͰ͋Δ • ૣ͍ • WebAssemblyʹ΋࢖͑ΔҰ൪خ͍͠

  5. Ͱ΋…

  6. Ͳ͏΍ͬͯษڧ͢Δͷ???

  7. ࣗ෼͕͜͜਺ϲ݄Ͱ΍ͬͨ ษڧ๏Λ঺հ͠·͢

  8. ಋೖฤ • The Rust Programming • Rust by Example جຊతͳߏจɾߟ͑ํΛֶͿͷʹ

    Ұ൪ࢀߟʹͳΓ·ͨ͠
  9. ࣮ફฤ खΛ׳Βͨ͢ΊʹCUIπʔϧΛ࡞Γ·ͨ͠ ΍ͬͯΑ͔ͬͨ͜ͱ • module(mod)Λͭ͘Δ • ؔ਺ͷҾ਺ʹstructΛ࢖͏

  10. ࣮ࡍʹϋϚͬͨίʔυྫ fn create_slack_message(items: &Vec<TodoistItem>, project_name_map: &HashMap<i64, String>, message_template: &MessageTemplate) ->

    String { let message = items.into_iter() .map(|item| { let project_name = project_name_map.get(&item.project_id).unwrap(); format!("{} {} `{}`", message_template.prefix_today_tasks.unwrap_or("default".to_string()) , item.content, project_name) }) .collect::<Vec<String>>() .join("\n"); }
  11. ࣮ࡍʹϋϚͬͨίʔυྫ fn create_slack_message(items: &Vec<TodoistItem>, project_name_map: &HashMap<i64, String>, message_template: &MessageTemplate) ->

    String { let message = items.into_iter() .map(|item| { let project_name = project_name_map.get(&item.project_id).unwrap(); format!("{} {} `{}`", message_template.prefix_today_tasks.unwrap_or("default".to_string()) , item.content, project_name) }) .collect::<Vec<String>>() .join("\n"); } ࢀরͰ౉ͨ͠ͷʹ ॴ༗ݖΛୣ͓͏ͱͯ͠͠·ͬͨʜ
  12. ࣮ફฤ(͖ͭͮ) ͍ͣΕ΋ɺॴ༗ݖ΍ϥΠϑλΠϜΛҙࣝ͢ΔΩο Χέʹͳͬͨ mainؔ਺͚ͩʹดͯ͡ษڧ͢Δͱɺதʑؾ͚ͮ ͳ͍໰୊ʹײͨ͡

  13. ͦͷଞ RustΛ৮Δલʹֶश͢Δͱྑͦ͞͏ͳݴޠ • JavaScript/Swift • ؔ਺͕ୈҰڃΦϒδΣΫτ
 (ม਺ʹ୅ೖͰ͖Δ) • Swift͸pattern match΍if

    let΋͋Δ
  14. ͦͷଞ(͖ͭͮ) • ޙଓݴޠಛ༗ͷศརػೳ͸SwiftͳͲΛษڧ͢ Δ͜ͱͰ༧श͕Ͱ͖Δ • ॴ༗ݖ΍ϥΠϑλΠϜɺRustಛ༗ͷߟ͑͸ Rustͱ޲͖߹Θͳ͍ͱ਎ʹ͔ͭͳ͍

  15. ͦͷଞ(͖ͭͮ) GitHub͋͞Γ • Α͘ݟ͍ͯΔ΋ͷ • rust-lang-nursery/rustup • hyperium/hyper

  16. ͍·ࠔ͍ͬͯΔ͜ͱ • ϥΠϑλΠϜ • গͣͭ͠ݴ͍͍ͨ͜ͱ͕෼͔͖͚ͬͯͨͲ… • <‘a>ͷ࢖͍ํ͕… • moduleߏ੒ •

    Կ͔ͬ͘͠Γ͜ͳ͍
  17. ͜Ε͔ΒࠔΓͦ͏ͳ͜ͱ • ฒྻॲཧ • moveͱ͔Arcͱ͔Mutexͱ͔

  18. ͝ਗ਼ௌ
 ͋Γ͕ͱ͏͍͟͝·ͨ͠