RUST PROGRAMMING LANGUAGE
RUST
A language empowering everyone to build reliable and efficient software.Rust is a
multi-paradigm system programming language focused on safety, especially safe
concurrency. Rust is syntactically similar to C++, but is designed to provide better
memory safety while maintaining high performance
From the official website (http://rust-lang.org):
Email:mujahidmalikarain@gmail.com
HISTORY OF RUST
The language grew out of a personal project begun in 2006
by Mozilla employee Graydon Hoare.
Project was possibly named after the rust family of fungi.
Mozilla began sponsoring the project in 2009, and announced
it in 2010.
Rust 1.0, the first stable release, was released on May 15,
2015.
GOALS OF RUST
The three goals on which Rust focuses include
● Speed
● Concurrency
● Safety
These goals are maintained through the eradication of
garbage collector, which makes this language useful for a
number of cases.
Syntax of RUST
The concrete syntax of Rust is similar to C and C++, with
blocks of code delimited by curly brackets, and control flow
keywords such as if, else, while, and for. Not all C or C++
keywords are implemented, however, and some Rust
functions (such as the use of the keyword match for pattern
matching) will be less familiar to those versed in these
languages.
SIMPLE PROGRAM IN RUST
fn main() {
println!("Hello, world!");
}
● Above code can be save in file.rs , but it can be any name
with .rs extension.
● Compiling via rustc file.rs
● Executing by ./file on Linux and Mac or file.exe on
Windows
Performance comparison of RUST and other languages
Language Time (sec) Memory (mb)
C++ Gcc 1.94 1.0
Rust 2.16 4.8
Java 4.03 513.8
LuaJIT 12.61 1.0
Lua 5.1 182.74 1.0
Python 314.79 4.9
Why Rust?
Why Rust?
Performance
Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power
performance-critical services, run on embedded devices, and easily integrate with other languages.
Reliability
Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — and enable
you to eliminate many classes of bugs at compile-time.
Productivity:
Rust has great documentation, a friendly compiler with useful error messages, and
top-notch tooling — an integrated package manager and build tool, smart multi-
editor support with auto-completion and type inspections, an auto-formatter, and
more.
How Rust Compares to
Other Programming
Languages
Developers love Rust,” the latest Stack Overflow survey, released last month, proclaimed.
The Mozilla Foundation, known for the popular Firefox web browser and Thunderbird email clients, has
also been working on the open source Rust programming language for a while now. Many developers
have been watching Rust with anticipation, waiting for the right time to dive in and start building things.
Given that Rust hit 1.0 last May, it is now better than ever to start hacking on Rust!
As with any language or tool, though, it’s important to understand what problems Rust was introduced to
solve, and what types of solutions best flow from it.
More like C++ and Go, less like Node and Ruby
While Rust is a general purpose language, you could write your next web app in Rust, but you wouldn’t be
best experiencing what it has to offer. Rust is a low-level language, best suited for systems, embedded,
and other performance critical code. While it is conceivable that one day people will be writing the latest
3D video games in Rust — an area where high performance has historically been critical — it is unlikely
ever to have a web framework that will go toe-to-toe with Ruby on Rails.
Safer than C/C++:
The biggest — and some would say most vital — difference between Rust and C++ is the emphasis on
writing safe code.
With “safe code,” objects are managed by the programming language from the beginning to end. The
developer doesn’t do any pointer arithmetic or manage memory, as can be necessary in C or C++ programs.
For a given object the proper amount of memory is promised to be allocated — or, reserved — for the
object. When accessing this object, it is impossible to accidentally access a memory location that is out of
bounds. And when its job is done, the object will automatically be deallocated by the system, by which I
mean the programmer will not have to manually “free” or unreserve the memory used by that object.
With unmanaged code, not only is it harder to write code that is correct and bug-free, but leaves code far
more vulnerable to security threats. A particularly common threat is a buffer overflow, where a user can
enter more information than can be contained within the program’s allotted memory space, allowing a
malicious user to modify memory in parts of the system not under direct control of the code.
Framework :
Rocket is a web framework for Rust that makes it simple to write fast, secure web applications without
sacrificing flexibility, usability, or type safety.
Rust in production
panies around the world are using Rust in production today for fast, low-resource, cross-platform
solutions. Software you know and love, like Firefox, Dropbox, and Cloudflare, uses Rust. From startups
to large corporations, from embedded devices to scalable web services, Rust is a great fit.
Rust programming-language
Rust programming-language

Rust programming-language

  • 1.
  • 2.
    RUST A language empoweringeveryone to build reliable and efficient software.Rust is a multi-paradigm system programming language focused on safety, especially safe concurrency. Rust is syntactically similar to C++, but is designed to provide better memory safety while maintaining high performance From the official website (http://rust-lang.org): Email:mujahidmalikarain@gmail.com
  • 3.
    HISTORY OF RUST Thelanguage grew out of a personal project begun in 2006 by Mozilla employee Graydon Hoare. Project was possibly named after the rust family of fungi. Mozilla began sponsoring the project in 2009, and announced it in 2010. Rust 1.0, the first stable release, was released on May 15, 2015.
  • 4.
    GOALS OF RUST Thethree goals on which Rust focuses include ● Speed ● Concurrency ● Safety These goals are maintained through the eradication of garbage collector, which makes this language useful for a number of cases.
  • 6.
    Syntax of RUST Theconcrete syntax of Rust is similar to C and C++, with blocks of code delimited by curly brackets, and control flow keywords such as if, else, while, and for. Not all C or C++ keywords are implemented, however, and some Rust functions (such as the use of the keyword match for pattern matching) will be less familiar to those versed in these languages.
  • 7.
    SIMPLE PROGRAM INRUST fn main() { println!("Hello, world!"); } ● Above code can be save in file.rs , but it can be any name with .rs extension. ● Compiling via rustc file.rs ● Executing by ./file on Linux and Mac or file.exe on Windows
  • 8.
    Performance comparison ofRUST and other languages Language Time (sec) Memory (mb) C++ Gcc 1.94 1.0 Rust 2.16 4.8 Java 4.03 513.8 LuaJIT 12.61 1.0 Lua 5.1 182.74 1.0 Python 314.79 4.9
  • 9.
    Why Rust? Why Rust? Performance Rustis blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages. Reliability Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — and enable you to eliminate many classes of bugs at compile-time.
  • 10.
    Productivity: Rust has greatdocumentation, a friendly compiler with useful error messages, and top-notch tooling — an integrated package manager and build tool, smart multi- editor support with auto-completion and type inspections, an auto-formatter, and more.
  • 11.
    How Rust Comparesto Other Programming Languages
  • 12.
    Developers love Rust,”the latest Stack Overflow survey, released last month, proclaimed. The Mozilla Foundation, known for the popular Firefox web browser and Thunderbird email clients, has also been working on the open source Rust programming language for a while now. Many developers have been watching Rust with anticipation, waiting for the right time to dive in and start building things. Given that Rust hit 1.0 last May, it is now better than ever to start hacking on Rust! As with any language or tool, though, it’s important to understand what problems Rust was introduced to solve, and what types of solutions best flow from it.
  • 13.
    More like C++and Go, less like Node and Ruby While Rust is a general purpose language, you could write your next web app in Rust, but you wouldn’t be best experiencing what it has to offer. Rust is a low-level language, best suited for systems, embedded, and other performance critical code. While it is conceivable that one day people will be writing the latest 3D video games in Rust — an area where high performance has historically been critical — it is unlikely ever to have a web framework that will go toe-to-toe with Ruby on Rails.
  • 14.
    Safer than C/C++: Thebiggest — and some would say most vital — difference between Rust and C++ is the emphasis on writing safe code. With “safe code,” objects are managed by the programming language from the beginning to end. The developer doesn’t do any pointer arithmetic or manage memory, as can be necessary in C or C++ programs. For a given object the proper amount of memory is promised to be allocated — or, reserved — for the object. When accessing this object, it is impossible to accidentally access a memory location that is out of bounds. And when its job is done, the object will automatically be deallocated by the system, by which I mean the programmer will not have to manually “free” or unreserve the memory used by that object. With unmanaged code, not only is it harder to write code that is correct and bug-free, but leaves code far more vulnerable to security threats. A particularly common threat is a buffer overflow, where a user can enter more information than can be contained within the program’s allotted memory space, allowing a malicious user to modify memory in parts of the system not under direct control of the code.
  • 15.
    Framework : Rocket isa web framework for Rust that makes it simple to write fast, secure web applications without sacrificing flexibility, usability, or type safety. Rust in production panies around the world are using Rust in production today for fast, low-resource, cross-platform solutions. Software you know and love, like Firefox, Dropbox, and Cloudflare, uses Rust. From startups to large corporations, from embedded devices to scalable web services, Rust is a great fit.