Upgrade to Pro — share decks privately, control downloads, hide ads and more …

プログラミング言語Rust

 プログラミング言語Rust

Rustの紹介的な勉強会

Yusuke Hosonuma

November 09, 2016
Tweet

More Decks by Yusuke Hosonuma

Other Decks in Technology

Transcript

  1. ҆શʁ • C/C++Ͱ͸ϝϞϦؔ࿈ͷόά͕ઈ͑ͳ͍ • ະॳظԽ or ൣғ֎ͷྖҬʹΞΫηεͨ͠Γ • όοϑΝʔΦʔόʔϑϩʔ੬ऑੑͷѱເ •

    RustͰ͸ίϯύΠϧ࣌ʹແޮͳϝϞϦΞΫηε͕ൃ ੜ͠ͳ͍͜ͱΛอূ͢Δ • ੩తܕ෇͚Ͱܕਪ࿦͋Γ
  2. ࣮੷ʁ • Friends of Rust
 https://www.rust-lang.org/en-US/friends.html
 
 ↑࣮ϓϩμΫτʹRustΛ࢖͍ͬͯΔ૊৫ • Mozilla͸FirefoxͷϝσΟΞύʔβͰར༻


    ˠ 10ԯਓҎ্͕ར༻͍ͯ͠Δͷʹɺ1݅΋Τϥʔ͕ ൃੜ͍ͯ͠ͳ͍ʢΒ͍͠ʣ • Dropbox΍LINEͱ͍ͬͨେޚॴ΋ར༻͍ͯ͠Δ
  3. ϑΟϘφον਺ྻ fn fib(n: u32) -> u32 { // Function definition


    match n { // Pattern match
 0 => 1,
 1 => 1,
 _ => fib(n - 1) + fib(n - 2), // Recursive call
 } // not need `return`
 }
 
 fn main() {
 let fib5 = fib(5); // local variable (Immutable is default)
 println!("fib(5): {}", fib5); // `{}` is placeholder
 // => 8
 }
  4. Rustͷ࢝Ίํ • $ brew install rust • $ cargo new

    hello --bin • $ cd ./hello • $ cargo run • > Hello, world!