SlideShare a Scribd company logo
A 30-minute Introduction
to Rust
summary
1. Rust?
● 2006년에 모질라 개발자인 Graydon Hoare에
의한 개인 프로젝트로 시작.
● 모질라가 2009년부터 스폰서로 지원하기 시
작.
● 2010년에 0.1 release
● 모질라의 리서치 프로젝트인 Servo
(experimental web browser layout engine)가
Rust를 사용해서 만들어지고 있음.
1. Rust?
● A strongly-typed systems programming
language with a focus on memory safety and
concurrency.
● an ownership-oriented programming
language.
● 조만간 1.0 나올 예정
Cargo
● Package manager
● $ cargo new hello_world --bin
● - Cargo.toml
● - src
● ---- main.rs
● $ cargo run

Recommended for you

Rust言語紹介
Rust言語紹介Rust言語紹介
Rust言語紹介

The document discusses Rust, a systems programming language developed by Mozilla. It provides an agenda, introduction to the speaker and company, why Rust was chosen, basic Rust concepts, and examples of Rust code. Memory safety is emphasized as Rust avoids vulnerabilities like memory leaks and use-after-free by using a borrow checker to validate references. Examples demonstrate immutable and mutable references, structs, functions, and memory management using Box to move values.

rust
File. Java
File. JavaFile. Java
File. Java

This document discusses the File class in Java and methods for working with files and directories. It describes the File class's constructors and methods for getting file attributes, checking permissions, renaming, deleting and creating files/directories. It also introduces the FileFilter and FilenameFilter interfaces for filtering files, and provides examples of their use. Finally, it discusses working with dates using the Date and GregorianCalendar classes.

javajava se
Cli
CliCli
Cli

This document contains configuration commands for routers and switches. It sets passwords, IP addresses, descriptions and other settings on interfaces for routers R1 and switches S1. The router configurations enable services like SSH and set the domain name and username/password. The switch configurations erase previous configuration files, set the hostname, IP address on VLAN 1, and passwords for console and vty lines.

Cargo.toml
[package]
name: “hello_world”
version: “0.0.1”
authors: [“Your Name <you@example.com>”]
Main.rs
fn main() {
println!(“Hello, world!”);
}
Adding dependency
[package]
name: “hello_world”
version: “0.0.1”
authors: [“Your Name <you@example.com>”]
[dependencies.semver]
git = “https://github.com/rust-lang/semver.git
Main.rs
extern crate semver;
use semver::Version
fn main() {
assert!(Version::parse(“1.2.3”) == Ok(Version {
major: 1u,
minor: 2u,
patch: 3u,
pre: vec!(),
build: vec!(),
}));
println!(“Versions compared successfully!”);
}

Recommended for you

Closures for Java
Closures for JavaClosures for Java
Closures for Java

Closures for Java and other thoughts on language evolution The document discusses goals for language changes including simplifying programs, reducing bugs, and adapting to changing requirements like multicore processors and concurrency. It proposes adding closures to Java to help meet these goals by allowing for more concise code, avoiding repetition, and making programming with concurrency easier. Specific examples are given of how closures could help implement common patterns like try-with-resources and iteration in a more readable way while also enabling flexibility for programmers to extend the language.

Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM

This document summarizes a presentation about coding in the Go programming language. It discusses: - A brief history of Go and how it was created at Google in 2007. - What makes Go special, including its fast compilation, lack of a virtual machine, concurrency features using goroutines and channels, and standard library. - An overview of Go's syntax including variables, loops, conditions, arrays, maps, functions, closures, pointers, and structs. - How to handle concurrency using goroutines and channels. - Building HTTP servers and APIs in Go using the net/http package. - Popular Go frameworks and toolkits like Gorilla Mux

golanggdggo
Rust Synchronization Primitives
Rust Synchronization PrimitivesRust Synchronization Primitives
Rust Synchronization Primitives

These are slides for a presentation I gave to my OS class. It was mostly me talking, using the code to drive the examples and show how Rust approaches the problems of synchronization. Not super detailed, doesn't get into the meaty stuff (Condvar, mutex::Mutex, etc)

synchronizationrust
Ownership
fn main() {
let mut v = vec![];
v.push(“Hello”);
let x = &v[0];
v.push(“world”);
println!(“{}”, x);
}
Ownership
fn main() {
let mut v = vec![];
v.push(“Hello”);
let x = &v[0];
v.push(“world”);
println!(“{}”, x);
}
Compile Error!
Ownership
fn main() {
let mut v = vec![];
v.push(“Hello”);
let x = &v[0];
v.push(“world”);
println!(“{}”, x);
}
Compile Error!
Ownership
fn main() {
let mut v = vec![];
v.push(“Hello”);
let x = &v[0];
v.push(“world”);
println!(“{}”, x);
}
Compile Error!

Recommended for you

Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#

This document contains code for a custom Name textbox control that can parse a full name entered into the textbox and separate it into first and last name properties. The Name control overrides the OnPaint method and contains private first and last name string properties, along with GetFirstName and GetLastName public methods that call an UpdateNames method to split the full name on a comma or space and assign the values. A sample form code demonstrates getting the first and last name from an instance of the Name control.

c#custom controlname seperator control
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク

The document shows an example Java class called HelloWorld that contains a greeting method to return the string "Hello" plus a name. It then demonstrates initializing an instance of the class, setting the name, and calling the greet method to print the greeting. The document also shows how this example is translated to use Groovy instead of Java.

llgrailsgroovy
Script inicio
Script inicioScript inicio
Script inicio

This document contains commands to stop a service, create a text file with FTP commands to download an executable file from a remote server, run the FTP commands to download the file, execute the downloaded file, and delete the text file containing the FTP commands. The executable file is downloaded without validation and executed, potentially downloading malware or harmful files.

Ownership
fn main() {
let mut v = vec![];
v.push(“Hello”);
let x = &v[0];
v.push(“world”);
println!(“{}”, x);
}
fn main() {
let mut v = vec![];
v.push(“Hello”);
let x = v[0].clone();
v.push(“world”);
println!(“{}”, x);
}
Concurrency
fn main() {
let mut numbers = vec![1i, 2i, 3i];
for i in range(0u, 3u) {
spawn(proc() {
for j in range(0, 3) { numbers[j] += 1 }
});
}
}
Concurrency
fn main() {
let mut numbers = vec![1i, 2i, 3i];
for i in range(0u, 3u) {
spawn(proc() {
for j in range(0, 3) { numbers[j] += 1 }
});
}
}
Compile Error!
Concurrency
fn main() {
let mut numbers = vec![1i, 2i, 3i];
for i in range(0u, 3u) {
spawn(proc() {
for j in range(0, 3) { numbers[j] += 1 }
});
}
}
Compile Error!

Recommended for you

Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...

2011-11-02 | 05:45 PM - 06:35 PM | Victoria The Disruptor is new open-source concurrency framework, designed as a high performance mechanism for inter-thread messaging. It was developed at LMAX as part of our efforts to build the world's fastest financial exchange. Using the Disruptor as an example, this talk will explain of some of the more detailed and less understood areas of concurrency, such as memory barriers and cache coherency. These concepts are often regarded as scary complex magic only accessible by wizards like Doug Lea and Cliff Click. Our talk will try and demystify them and show that concurrency can be understood by us mere mortal programmers.

jaxconcurrencyjax london
Finagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusFinagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ Knoldus

This document introduces Finagle, an open source library developed by Twitter for building reliable services. It discusses how Finagle uses futures and promises to handle asynchronous operations. It also describes how Finagle provides networking capabilities like address resolution and load balancing. Finagle allows defining services as functions that return futures, and combines multiple services through composition of futures. This provides benefits like reliability, performance and flexibility in service definition.

scala
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashes

This document discusses using low-level techniques in Ruby like direct syscalls and memory allocation to implement semaphores and handle segmentation faults. It shows how to use the Kernel.syscall method, DL library, and libsigsegv library to perform operations directly at the OS level. The goal is to explore pushing Ruby's capabilities by interacting with lower levels of the system. Examples demonstrate creating and using semaphores for locking, allocating and modifying memory, and installing signal handlers to catch and handle segmentation faults. Further reading links are provided on related debugging and low-level Ruby topics.

lsrc2009lone star ruby conference 2009ruby
Concurrency
use std::sync::{Arc, Mutex};
fn main() {
let numbers = Arc::new(Mutex::new(vec![1i, 2i, 3i]));
for i in range(0u, 3u) {
let number = numbers.clone();
spawn(proc() {
let mut array = number.lock();
(*(*array).get_mut(i)) += 1;
println!(“numbers[{}] is {}”, i, (*array)[i]);
});
}
}
Concurrency
use std::sync::{Arc, Mutex};
fn main() {
let numbers = Arc::new(Mutex::new(vec![1i, 2i, 3i]));
for i in range(0u, 3u) {
let number = numbers.clone();
spawn(proc() {
let mut array = number.lock();
(*(*array).get_mut(i)) += 1;
println!(“numbers[{}] is {}”, i, (*array)[i]);
});
}
}
Arc : atomically reference counted
Mutex: synchronize our access
Safety and speed
ownership에 의해 compile time에 safety check
가 가능
let vec = vec![1i, 2, 3];
for i in range(1u, vec.len()) {
println!(“{}”, vec[i]);
}
let vec = vec![1i, 2, 3];
for x in vec.iter() {
println!(“{}”, x);
}
Safety and speed
ownership에 의해 compile time에 safety check
가 가능
let vec = vec![1i, 2, 3];
for i in range(1u, vec.len()) {
println!(“{}”, vec[i]);
}
let vec = vec![1i, 2, 3];
for x in vec.iter() {
println!(“{}”, x);
}
bounds checking

Recommended for you

C++ Programming - 6th Study
C++ Programming - 6th StudyC++ Programming - 6th Study
C++ Programming - 6th Study

The document contains C++ code examples demonstrating constructors, destructors, initialization lists, and member access in classes. Example 1 shows a basic class with a default constructor. Example 2 adds a parameterized constructor. Example 3 adds a constant string member initialized in the initialization list. Example 4 improves initialization by using an initialization list. Later examples demonstrate a class with a destructor, multiple classes with constructors and destructors, and proper use of 'this' for member access.

c++c++ programming
Asphalt8.ifgiovanni
Asphalt8.ifgiovanniAsphalt8.ifgiovanni
Asphalt8.ifgiovanni

The document allocates memory for variables used to store information about a data conversion routine. It allocates 1024 bytes each for the conversion and back conversion routines, 256 bytes for a type name, and 4 bytes to store the byte size. It then stores the type name "Asphalt8.IFGIOVANNI" and sets the byte size to 4 and a flag for using floats to 0. The conversion routine XORs and rotates the passed in value, while the back conversion routine reverses these operations to convert the value back.

dfiñ
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simple

A lightning talk on Clojure given in 7 minutes and 20 seconds at one of the London Java Community events.

java virtual machineclojuremaven
Happy Hacking!

More Related Content

What's hot

Understanding the Disruptor
Understanding the DisruptorUnderstanding the Disruptor
Understanding the Disruptor
Trisha Gee
 
File-I/O -- ist doch ganz einfach, oder?
File-I/O -- ist doch ganz einfach, oder?File-I/O -- ist doch ganz einfach, oder?
File-I/O -- ist doch ganz einfach, oder?
Christian Kauhaus
 
ZIP, GZIP Streams in java
ZIP, GZIP Streams in javaZIP, GZIP Streams in java
ZIP, GZIP Streams in java
Alexey Bovanenko
 
Rust言語紹介
Rust言語紹介Rust言語紹介
Rust言語紹介
Paweł Rusin
 
File. Java
File. JavaFile. Java
File. Java
Alexey Bovanenko
 
Cli
CliCli
Closures for Java
Closures for JavaClosures for Java
Closures for Java
nextlib
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
Raveen Perera
 
Rust Synchronization Primitives
Rust Synchronization PrimitivesRust Synchronization Primitives
Rust Synchronization Primitives
Corey Richardson
 
Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#
priya Nithya
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Tsuyoshi Yamamoto
 
Script inicio
Script inicioScript inicio
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
JAX London
 
Finagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusFinagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ Knoldus
Knoldus Inc.
 
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashes
Eleanor McHugh
 
C++ Programming - 6th Study
C++ Programming - 6th StudyC++ Programming - 6th Study
C++ Programming - 6th Study
Chris Ohk
 
Asphalt8.ifgiovanni
Asphalt8.ifgiovanniAsphalt8.ifgiovanni
Asphalt8.ifgiovanni
201419942010
 
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simple
John Stevenson
 
Golang design4concurrency
Golang design4concurrencyGolang design4concurrency
Golang design4concurrency
Eduardo Ferro Aldama
 
LMAX Disruptor as real-life example
LMAX Disruptor as real-life exampleLMAX Disruptor as real-life example
LMAX Disruptor as real-life example
Guy Nir
 

What's hot (20)

Understanding the Disruptor
Understanding the DisruptorUnderstanding the Disruptor
Understanding the Disruptor
 
File-I/O -- ist doch ganz einfach, oder?
File-I/O -- ist doch ganz einfach, oder?File-I/O -- ist doch ganz einfach, oder?
File-I/O -- ist doch ganz einfach, oder?
 
ZIP, GZIP Streams in java
ZIP, GZIP Streams in javaZIP, GZIP Streams in java
ZIP, GZIP Streams in java
 
Rust言語紹介
Rust言語紹介Rust言語紹介
Rust言語紹介
 
File. Java
File. JavaFile. Java
File. Java
 
Cli
CliCli
Cli
 
Closures for Java
Closures for JavaClosures for Java
Closures for Java
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 
Rust Synchronization Primitives
Rust Synchronization PrimitivesRust Synchronization Primitives
Rust Synchronization Primitives
 
Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
Script inicio
Script inicioScript inicio
Script inicio
 
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
 
Finagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusFinagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ Knoldus
 
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashes
 
C++ Programming - 6th Study
C++ Programming - 6th StudyC++ Programming - 6th Study
C++ Programming - 6th Study
 
Asphalt8.ifgiovanni
Asphalt8.ifgiovanniAsphalt8.ifgiovanni
Asphalt8.ifgiovanni
 
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simple
 
Golang design4concurrency
Golang design4concurrencyGolang design4concurrency
Golang design4concurrency
 
LMAX Disruptor as real-life example
LMAX Disruptor as real-life exampleLMAX Disruptor as real-life example
LMAX Disruptor as real-life example
 

Similar to Introduction to rust

Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
Gines Espada
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
Geeks Anonymes
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ahmed Salama
 
Golang
GolangGolang
Golang
Felipe Mamud
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
Jaehue Jang
 
Hands on Session on Python
Hands on Session on PythonHands on Session on Python
Hands on Session on Python
Sumit Raj
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
João Oliveira
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
Yuren Ju
 
Clojure basics
Clojure basicsClojure basics
Clojure basics
Knoldus Inc.
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
Yuren Ju
 
The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212
Mahmoud Samir Fayed
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
Ben Hall
 
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
The Statistical and Applied Mathematical Sciences Institute
 
PenTest using Python By Purna Chander
PenTest using Python By Purna ChanderPenTest using Python By Purna Chander
PenTest using Python By Purna Chander
nforceit
 
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Tim Chaplin
 
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
Christian Martorella
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017
pramode_ce
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Víctor Bolinches
 
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан КольцовRust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Yandex
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
Robert Stern
 

Similar to Introduction to rust (20)

Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Golang
GolangGolang
Golang
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
 
Hands on Session on Python
Hands on Session on PythonHands on Session on Python
Hands on Session on Python
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Clojure basics
Clojure basicsClojure basics
Clojure basics
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
 
PenTest using Python By Purna Chander
PenTest using Python By Purna ChanderPenTest using Python By Purna Chander
PenTest using Python By Purna Chander
 
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
 
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
 
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан КольцовRust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 

Recently uploaded

A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
kalichargn70th171
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
AUGNYC
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
MaisnamLuwangPibarel
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
sofiafernandezon
 
Cultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational TransformationCultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational Transformation
Mindfire Solution
 
React Native vs Flutter - SSTech System
React Native vs Flutter  - SSTech SystemReact Native vs Flutter  - SSTech System
React Native vs Flutter - SSTech System
SSTech System
 
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdfIndependence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Livetecs LLC
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
908dutch
 
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTIONBITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
ssuser2b426d1
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
Ortus Solutions, Corp
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
SimonedeGijt
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
sachin chaurasia
 
Break data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud ConnectorsBreak data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud Connectors
confluent
 
Top 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your WebsiteTop 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your Website
e-Definers Technology
 
Overview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptxOverview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptx
Mitchell Marsh
 
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdfResponsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Trackobit
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
sheqnetworkmarketing
 
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
avufu
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
miso_uam
 
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdfdachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
DNUG e.V.
 

Recently uploaded (20)

A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
 
Cultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational TransformationCultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational Transformation
 
React Native vs Flutter - SSTech System
React Native vs Flutter  - SSTech SystemReact Native vs Flutter  - SSTech System
React Native vs Flutter - SSTech System
 
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdfIndependence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
 
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTIONBITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
 
Break data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud ConnectorsBreak data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud Connectors
 
Top 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your WebsiteTop 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your Website
 
Overview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptxOverview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptx
 
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdfResponsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
 
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
 
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdfdachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
 

Introduction to rust

  • 2. 1. Rust? ● 2006년에 모질라 개발자인 Graydon Hoare에 의한 개인 프로젝트로 시작. ● 모질라가 2009년부터 스폰서로 지원하기 시 작. ● 2010년에 0.1 release ● 모질라의 리서치 프로젝트인 Servo (experimental web browser layout engine)가 Rust를 사용해서 만들어지고 있음.
  • 3. 1. Rust? ● A strongly-typed systems programming language with a focus on memory safety and concurrency. ● an ownership-oriented programming language. ● 조만간 1.0 나올 예정
  • 4. Cargo ● Package manager ● $ cargo new hello_world --bin ● - Cargo.toml ● - src ● ---- main.rs ● $ cargo run
  • 7. Adding dependency [package] name: “hello_world” version: “0.0.1” authors: [“Your Name <you@example.com>”] [dependencies.semver] git = “https://github.com/rust-lang/semver.git
  • 8. Main.rs extern crate semver; use semver::Version fn main() { assert!(Version::parse(“1.2.3”) == Ok(Version { major: 1u, minor: 2u, patch: 3u, pre: vec!(), build: vec!(), })); println!(“Versions compared successfully!”); }
  • 9. Ownership fn main() { let mut v = vec![]; v.push(“Hello”); let x = &v[0]; v.push(“world”); println!(“{}”, x); }
  • 10. Ownership fn main() { let mut v = vec![]; v.push(“Hello”); let x = &v[0]; v.push(“world”); println!(“{}”, x); } Compile Error!
  • 11. Ownership fn main() { let mut v = vec![]; v.push(“Hello”); let x = &v[0]; v.push(“world”); println!(“{}”, x); } Compile Error!
  • 12. Ownership fn main() { let mut v = vec![]; v.push(“Hello”); let x = &v[0]; v.push(“world”); println!(“{}”, x); } Compile Error!
  • 13. Ownership fn main() { let mut v = vec![]; v.push(“Hello”); let x = &v[0]; v.push(“world”); println!(“{}”, x); } fn main() { let mut v = vec![]; v.push(“Hello”); let x = v[0].clone(); v.push(“world”); println!(“{}”, x); }
  • 14. Concurrency fn main() { let mut numbers = vec![1i, 2i, 3i]; for i in range(0u, 3u) { spawn(proc() { for j in range(0, 3) { numbers[j] += 1 } }); } }
  • 15. Concurrency fn main() { let mut numbers = vec![1i, 2i, 3i]; for i in range(0u, 3u) { spawn(proc() { for j in range(0, 3) { numbers[j] += 1 } }); } } Compile Error!
  • 16. Concurrency fn main() { let mut numbers = vec![1i, 2i, 3i]; for i in range(0u, 3u) { spawn(proc() { for j in range(0, 3) { numbers[j] += 1 } }); } } Compile Error!
  • 17. Concurrency use std::sync::{Arc, Mutex}; fn main() { let numbers = Arc::new(Mutex::new(vec![1i, 2i, 3i])); for i in range(0u, 3u) { let number = numbers.clone(); spawn(proc() { let mut array = number.lock(); (*(*array).get_mut(i)) += 1; println!(“numbers[{}] is {}”, i, (*array)[i]); }); } }
  • 18. Concurrency use std::sync::{Arc, Mutex}; fn main() { let numbers = Arc::new(Mutex::new(vec![1i, 2i, 3i])); for i in range(0u, 3u) { let number = numbers.clone(); spawn(proc() { let mut array = number.lock(); (*(*array).get_mut(i)) += 1; println!(“numbers[{}] is {}”, i, (*array)[i]); }); } } Arc : atomically reference counted Mutex: synchronize our access
  • 19. Safety and speed ownership에 의해 compile time에 safety check 가 가능 let vec = vec![1i, 2, 3]; for i in range(1u, vec.len()) { println!(“{}”, vec[i]); } let vec = vec![1i, 2, 3]; for x in vec.iter() { println!(“{}”, x); }
  • 20. Safety and speed ownership에 의해 compile time에 safety check 가 가능 let vec = vec![1i, 2, 3]; for i in range(1u, vec.len()) { println!(“{}”, vec[i]); } let vec = vec![1i, 2, 3]; for x in vec.iter() { println!(“{}”, x); } bounds checking