0% found this document useful (0 votes)
89 views22 pages

Overview of the Rust Programming Language

Rust is a general-purpose programming language known for its performance, type safety, concurrency, and memory safety, developed by Graydon Hoare at Mozilla starting in 2006. It features a unique ownership system that ensures memory safety without a garbage collector, and has gained popularity in various software projects and among developers. The Rust Foundation was established in 2021 to support the language's development after Mozilla's layoffs raised concerns about its future.

Uploaded by

Mobile Phone
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views22 pages

Overview of the Rust Programming Language

Rust is a general-purpose programming language known for its performance, type safety, concurrency, and memory safety, developed by Graydon Hoare at Mozilla starting in 2006. It features a unique ownership system that ensures memory safety without a garbage collector, and has gained popularity in various software projects and among developers. The Rust Foundation was established in 2021 to support the language's development after Mozilla's layoffs raised concerns about its future.

Uploaded by

Mobile Phone
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Rust (programming language)

Rust is a general-purpose programming language. It is noted for its emphasis on performance,


type safety, concurrency, and memory safety.

Rust supports multiple programming paradigms. It was influenced by ideas from functional
programming, including immutability, higher-order functions, algebraic data types, and pattern
matching. It also supports object-oriented programming via structs, enums, traits, and
methods. Rust is noted for enforcing memory safety (i.e., that all references point to valid
memory) without a conventional garbage collector; instead, memory safety errors and data
races are prevented by the "borrow checker", which tracks the object lifetime of references at
compile time.

Software developer Graydon Hoare created Rust in 2006 while working at Mozilla, which
officially sponsored the project in 2009. The first stable release, Rust 1.0, was published in May
2015. Following a layoff of Mozilla employees in August 2020, four other companies joined
Mozilla in sponsoring Rust through the creation of the Rust Foundation in February 2021.

Rust has been adopted by many software projects, especially web services and system
software. It has been studied academically and has a growing community of developers.

History

2006–2009: Early years

Rust began as a personal project by Mozilla employee Graydon Hoare in 2006. According to MIT
Technology Review, he started the project due to his frustration with a broken elevator in his
apartment building whose software had crashed, and named the language after the group of

Página 1
Rust (programming language)

fungi of the same name that is "over-engineered for survival". During the time period between
2006 and 2009, Rust was not publicized to others at Mozilla and was written in Hoare's free
time;: 7:50 Hoare began speaking about the language around 2009 after a small group at
Mozilla became interested in the project. Hoare cited languages from the 1970s, 1980s, and
1990s as influences — including CLU, BETA, Mesa, NIL,[note 4] Erlang, Newsqueak, Napier,
Hermes, Sather, Alef, and Limbo. He described the language as "technology from the past come
to save the future from itself.": 8:17 Early Rust developer Manish Goregaokar similarly
described Rust as being based on "mostly decades-old research."

During the early years, the Rust compiler was written in about 38,000 lines of OCaml.: 15:34
Features of early Rust that were later removed include explicit object-oriented programming via
an obj keyword,: 10:08 and a typestates system for variable state changes (such as going from
uninitialized to initialized).: 13:12

2009–2012: Mozilla sponsorship

Mozilla officially sponsored the Rust project in 2009. Brendan Eich and other executives,
intrigued by the possibility of using Rust for a safe web browser engine, placed engineers on
the project including Patrick Walton, Niko Matsakis, Felix Klock, and Manish Goregaokar. A
conference room taken by the project developers was dubbed "the nerd cave," with a sign
placed outside the door.

During this time period, work had shifted from the initial OCaml compiler to a self-hosting
compiler (i.e., written in Rust) targetting LLVM.[note 5] The ownership system was in place by
2010. The Rust logo was developed in 2011 based on a bicycle chainring.

Rust 0.1 became the first public release on January 20, 2012 for Windows, Linux, and MacOS.
The early 2010s witnessed an increasing number of full-time engineers at Mozilla, as well as
increasing involvement from open source volunteers outside of Mozilla and outside of the
United States.

2012–2015: Evolution

Página 2
Rust (programming language)

The years from 2012 to 2015 were marked by substantial changes to the Rust type
system.: 18:36 Memory management through the ownership system was gradually consolidated
and expanded. By 2013, the garbage collector was rarely used, and was removed in favor of
the ownership system. Other features were removed in order to simplify the language,
including typestates, the pure keyword, various specialized pointer types, and syntax support
for channels.: 22:32

According to Steve Klabnik, Rust was influenced during this period by developers coming from
C++ (e.g., low-level performance of features), scripting languages (e.g., Cargo and package
management), and functional programming (e.g., type systems development).: 30:50

Graydon Hoare stepped down from Rust in 2013. After Hoare's departure, it evolved organically
under a federated governance structure, with a "core team" of initially six people,: 21:45 and
around 30-40 developers total across various other teams.: 22:22 A Request for Comments
(RFC) process for new language features was added in March 2014.: 33:47 The core team would
grow to nine people by 2016: 21:45 with over 1600 RFCs.: 34:08

According to Andrew Binstock for Dr. Dobb's Journal in January 2014, while Rust was "widely
viewed as a remarkably elegant language", adoption slowed because it radically changed from
version to version. Rust development at this time focused on finalizing features for version 1.0
so that it could begin promising backward compatibility.: 41:26

Six years after Mozilla's sponsorship, Rust 1.0 was published and became the first stable
release on May 15, 2015. A year after, the Rust compiler had accumulated over 1,400
contributors and there were over 5,000 third-party libraries published on the Rust package
management website [Link].: 43:15

2015–2020: Servo and early adoption

Página 3
Rust (programming language)

The development of the Servo browser engine continued in parallel with Rust, jointly funded by
Mozilla and Samsung. The teams behind the two projects worked in close collaboration; new
features in Rust were tested out by the Servo team, and new features in Servo were used to
give feedback back to the Rust team.: 5:41 The first version of Servo was released in 2016. The
Firefox web browser shipped with Rust code as of 2016 (version 45),: 53:30 but components of
Servo did not appear in Firefox until September 2017 (version 57) as part of the Gecko and
Quantum projects.

Improvements were made to the Rust toolchain ecosystem during the years following 1.0
including Rustfmt, integrated development environment integration,: 44:56 and a regular
compiler testing and release cycle.: 46:48 Rust gained a community code of conduct and an IRC
chat for community discussion.: 50:36

The earliest known adoption outside of Mozilla was by individual projects at Samsung, Facebook
(now Meta Platforms), Dropbox, and Tilde, Inc., the company behind [Link].: 55:44 Amazon
Web Services followed in 2020. Engineers cited performance, lack of a garbage collector,
safety, and pleasantness of working in the language as reasons for the adoption. Amazon
developers cited a finding by Portuguese researchers that Rust code used less energy
compared to similar code written in Java.

2020–present: Mozilla layoffs and Rust Foundation

In August 2020, Mozilla laid off 250 of its 1,000 employees worldwide, as part of a corporate
restructuring caused by the COVID-19 pandemic. The team behind Servo was disbanded. The
event raised concerns about the future of Rust. In the following week, the Rust Core Team
acknowledged the severe impact of the layoffs and announced that plans for a Rust foundation
were underway. The first goal of the foundation would be to take ownership of all trademarks
and domain names and to take financial responsibility for their costs.

On February 8, 2021, the formation of the Rust Foundation was announced by five founding
companies: Amazon Web Services, Google, Huawei, Microsoft, and Mozilla. The foundation
would provide financial support for Rust developers in the form of grants and server funding. In
a blog post published on April 6, 2021, Google announced support for Rust within the Android
Open Source Project as an alternative to C/C++.

Página 4
Rust (programming language)

On November 22, 2021, the Moderation Team, which was responsible for enforcing the
community code of conduct, announced their resignation "in protest of the Core Team placing
themselves unaccountable to anyone but themselves". In May 2022, members of the Rust
leadership council posted a public response to the incident.

The Rust Foundation posted a draft for a new trademark policy on April 6, 2023, which resulted
in widespread negative reactions from Rust users and contributors. The trademark policy
included rules for how the Rust logo and name could be used.

On February 26, 2024, the U.S. White House Office of the National Cyber Director released a
19-page press report urging software development to move away from C and C++ to
memory-safe languages like C#, Go, Java, Ruby, Swift, and Rust.

Syntax and features

Rust's syntax is similar to that of C and C++, although many of its features were influenced by
functional programming languages such as OCaml. Hoare has described Rust as targeted at
frustrated C++ developers.

Hello World program

Below is a "Hello, World!" program in Rust. The fn keyword denotes a function, and the println!
macro (see § Macros) prints the message to standard output. Statements in Rust are separated
by semicolons.

Variables

Variables in Rust are defined through the let keyword. The example below assigns a value to
the variable with name foo of type i32 and outputs its value; the type annotation : i32 can be
omitted.

Variables are immutable by default, unless the mut keyword is added. The following example

Página 5
Rust (programming language)

uses //, which denotes the start of a comment.

Multiple let expressions can define multiple variables with the same name, known as variable
shadowing. Variable shadowing allows transforming variables without having to name the
variables differently. The example below declares a new variable with the same name that is
double the original value:

Variable shadowing is also possible for values of different types. For example, going from a
string to its length:

Block expressions and control flow

A block expression is delimited by curly brackets. When the last expression inside a block does
not end with a semicolon, the block evaluates to the value of that trailing expression:

Trailing expressions of function bodies are used as the return value:

if expressions

An if conditional expression executes code based on whether the given value is true. else can
be used for when the value evaluates to false, and else if can be used for combining multiple
expressions.

if and else blocks can evaluate to a value, which can then be assigned to a variable:

while loops

while can be used to repeat a block of code while a condition is met.

for loops and iterators

Página 6
Rust (programming language)

For loops in Rust loop over elements of a collection.


for expressions work over any iterator type.

In the above code, 4..=10 is a value of type Range which implements the Iterator trait. The
code within the curly braces is applied to each element returned by the iterator.

Iterators can be combined with functions over iterators like map, filter, and sum. For example,
the following adds up all numbers between 1 and 100 that are multiples of 3:

loop and break statements

More generally, the loop keyword allows repeating a portion of code until a break occurs. break
may optionally exit the loop with a value. In the case of nested loops, labels denoted by
'label_name can be used to break an outer loop rather than the innermost loop.

Pattern matching

The match and if let expressions can be used for pattern matching. For example, match can be
used to double an optional integer value if present, and return zero otherwise:

Equivalently, this can be written with if let and else:

Types

Rust is strongly typed and statically typed, meaning that the types of all variables must be
known at compilation time. Assigning a value of a particular type to a differently typed variable
causes a compilation error. Type inference is used to determine the type of variables if
unspecified.

The type (), called the "unit type" in Rust, is a concrete type that has exactly one value. It
occupies no memory (as it represents the absence of value). All functions that do not have an
indicated return type implicitly return (). It is similar to void in other C-style languages, however

Página 7
Rust (programming language)

void denotes the absence of a type and cannot have any value.

The default integer type is i32, and the default floating point type is f64. If the type of a literal
number is not explicitly provided, it is either inferred from the context or the default type is
used.

Primitive types

Integer types in Rust are named based on the signedness and the number of bits the type
takes. For example, i32 is a signed integer that takes 32 bits of storage, whereas u8 is unsigned
and only takes 8 bits of storage. isize and usize take storage depending on the memory address
bus width of the compilation target. For example, when building for 32-bit targets, both types
will take up 32 bits of space.

By default, integer literals are in base-10, but different radices are supported with prefixes, for
example, 0b11 for binary numbers, 0o567 for octals, and 0xDB for hexadecimals. By default,
integer literals default to i32 as its type. Suffixes such as 4u32 can be used to explicitly set the
type of a literal. Byte literals such as b'X' are available to represent the ASCII value (as a u8) of
a specific character.

The Boolean type is referred to as bool which can take a value of either true or false. A char
takes up 32 bits of space and represents a Unicode scalar value: a Unicode codepoint that is
not a surrogate. IEEE 754 floating point numbers are supported with f32 for single precision
floats and f64 for double precision floats.

Compound types

Compound types can contain multiple values. Tuples are fixed-size lists that can contain values
whose types can be different. Arrays are fixed-size lists whose values are of the same type.
Expressions of the tuple and array types can be written through listing the values, and can be
accessed with .index or [index]:

Arrays can also be constructed through copying a single value a number of times:

Página 8
Rust (programming language)

Ownership and references

Rust's ownership system consists of rules that ensure memory safety without using a garbage
collector. At compile time, each value must be attached to a variable called the owner of that
value, and every value must have exactly one owner. Values are moved between different
owners through assignment or passing a value as a function parameter. Values can also be
borrowed, meaning they are temporarily passed to a different function before being returned to
the owner. With these rules, Rust can prevent the creation and use of dangling pointers:

The function print_string takes ownership over the String value passed in; Alternatively, & can
be used to indicate a reference type (in &String) and to create a reference (in &s):

Because of these ownership rules, Rust types are known as affine types, meaning each value
may be used at most once. This enforces a form of software fault isolation as the owner of a
value is solely responsible for its correctness and deallocation.

When a value goes out of scope, it is dropped by running its destructor. The destructor may be
programmatically defined through implementing the Drop trait. This helps manage resources
such as file handles, network sockets, and locks, since when objects are dropped, the resources
associated with them are closed or released automatically.

Lifetimes

Object lifetime refers to the period of time during which a reference is valid; that is, the time
between the object creation and destruction. These lifetimes are implicitly associated with all
Rust reference types. While often inferred, they can also be indicated explicitly with named
lifetime parameters (often denoted 'a, 'b, and so on).

A value's lifetime in Rust can be thought of as lexically scoped, meaning that the duration of an
object lifetime is inferred from the set of locations in the source code (i.e., function, line, and
column numbers) for which a variable is valid. For example, a reference to a local variable has a
lifetime from the expression it is declared in up until the last use of it.

The borrow checker in the Rust compiler then enforces that references are only used in the
locations of the source code where the associated lifetime is valid. In the example above,

Página 9
Rust (programming language)

storing a reference to variable x in r is valid, as variable x has a longer lifetime ('a) than
variable r ('b). However, when x has a shorter lifetime, the borrow checker would reject the
program:

Since the lifetime of the referenced variable ('b) is shorter than the lifetime of the variable
holding the reference ('a), the borrow checker errors, preventing x from being used from
outside its scope.

Lifetimes can be indicated using explicit lifetime parameters on function arguments. For
example, the following code specifies that the reference returned by the function has the same
lifetime as original (and not necessarily the same lifetime as prefix):

In the compiler, ownership and lifetimes work together to prevent memory safety issues such
as dangling pointers.

User-defined types

User-defined types are created with the struct or enum keywords. The struct keyword is used to
denote a record type that groups multiple related values. enums can take on different variants
at runtime, with its capabilities similar to algebraic data types found in functional programming
languages. Both records and enum variants can contain fields with different types. Alternative
names, or aliases, for the same type can be defined with the type keyword.

The impl keyword can define methods for a user-defined type. Data and functions are defined
separately. Implementations fulfill a role similar to that of classes within other languages.

Standard library

Página 10
Rust (programming language)

The Rust standard library defines and implements many widely used custom data types,
including core data structures such as Vec, Option, and HashMap, as well as smart pointer
types. Rust provides a way to exclude most of the standard library using the attribute
#![no_std], for applications such as embedded devices. Internally, the standard library is
divided into three parts, core, alloc, and std, where std and alloc are excluded by #![no_std].

Rust uses the option type Option<T> to define optional values, which can be matched using if
let or match to access the inner value:

Similarly, Rust's result type Result<T, E> holds either a successfully computed value (the Ok
variant) or an error (the Err variant). Like Option, the use of Result means that the inner value
cannot be used directly; programmers must use a match expression, syntactic sugar such as ?
(the “try” operator), or an explicit unwrap assertion to access it. Both Option and Result are
used throughout the standard library and are a fundamental part of Rust's explicit approach to
handling errors and missing data.

Pointers

The & and &mut reference types are guaranteed to not be null and point to valid memory. The
raw pointer types *const and *mut opt out of the safety guarantees, thus they may be null or
invalid; however, it is impossible to dereference them unless the code is explicitly declared

Página 11
Rust (programming language)

unsafe through the use of an unsafe block. Unlike dereferencing, the creation of raw pointers is
allowed inside safe Rust code.

Type conversion

Rust provides no implicit type conversion (coercion) between most primitive types. But, explicit
type conversion (casting) can be performed using the as keyword.

Polymorphism

Rust supports polymorphism through traits, generic functions, and trait objects.

Traits

Common behavior between types is declared using traits and impl blocks:

The example above includes a method is_zero which provides a default implementation that
may be overridden when implementing the trait.

Generic functions

A function can be made generic by adding type parameters inside angle brackets (<Num>),
which only allow types that implement the trait:

In the examples above, Num: Zero as well as where Self: PartialEq are trait bounds that
constrain the type to only allow types that implement Zero or PartialEq. Within a trait or impl,
Self refers to the type that the code is implementing.

Generics can be used in functions to allow implementing a behavior for different types without
repeating the same code (see bounded parametric polymorphism). Generic functions can be
written in relation to other generics, without knowing the actual type.

Página 12
Rust (programming language)

Trait objects

By default, traits use static dispatch: the compiler monomorphizes the function for each
concrete type instance, yielding performance equivalent to type-specific code at the cost of
longer compile times and larger binaries.

When the exact type is not known at compile time, Rust provides trait objects &dyn Trait and
Box<dyn Trait>. Trait object calls use dynamic dispatch via a lookup table; a trait object is a
"fat pointer" carrying both a data pointer and a method table pointer. This indirection adds a
small runtime cost, but it keeps a single copy of the code and reduces binary size. Only
"object-safe" traits are eligible to be used as trait objects.

This approach is similar to duck typing, where all data types that implement a given trait can be
treated as functionally interchangeable. The following example creates a list of objects where
each object implements the Display trait:

If an element in the list does not implement the Display trait, it will cause a compile-time error.

Memory management

Rust does not use garbage collection. Memory and other resources are instead managed
through the "resource acquisition is initialization" convention, with optional reference counting.
Rust provides deterministic management of resources, with very low overhead. Values are
allocated on the stack by default, and all dynamic allocations must be explicit.

The built-in reference types using the & symbol do not involve run-time reference counting. The
safety and validity of the underlying pointers is verified at compile time, preventing dangling
pointers and other forms of undefined behavior. Rust's type system separates shared,
immutable references of the form &T from unique, mutable references of the form &mut T. A
mutable reference can be coerced to an immutable reference, but not vice versa.

Unsafe

Rust's memory safety checks (See #Safety) may be circumvented through the use of unsafe

Página 13
Rust (programming language)

blocks. This allows programmers to dereference arbitrary raw pointers, call external code, or
perform other low-level functionality not allowed by safe Rust. Some low-level functionality
enabled in this way includes volatile memory access, architecture-specific intrinsics, type
punning, and inline assembly.

Unsafe code is sometimes needed to implement complex data structures. A frequently cited
example is that it is difficult or impossible to implement doubly linked lists in safe Rust.

Programmers using unsafe Rust are considered responsible for upholding Rust's memory and
type safety requirements, for example, that no two mutable references exist pointing to the
same location. If programmers write code which violates these requirements, this results in
undefined behavior. The Rust documentation includes a list of behavior considered undefined,
including accessing dangling or misaligned pointers, or breaking the aliasing rules for
references.

Macros

Macros allow generation and transformation of Rust code to reduce repetition. Macros come in
two forms, with declarative macros defined through macro_rules!, and procedural macros,
which are defined in separate crates.

Declarative macros

A declarative macro (also called a "macro by example") is a macro, defined using the
macro_rules! keyword, that uses pattern matching to determine its expansion. Below is an
example that sums over all its arguments:

In this example, the macro named sum is defined using the form macro_rules! sum { (...) => {
... } }. The first part inside the parentheses of the definition, the macro pattern ( $initial:expr
$(, $expr:expr )* $(,)? ) specifies the structure of input it can take. Here, $initial:expr represents
the first expression, while $(, $expr:expr )* means there can be zero or more additional
comma-separated expressions after it. The trailing $(,)? allows the caller to optionally include a
final comma without causing an error. The second part after the arrow => describes what code

Página 14
Rust (programming language)

will be generated when the macro is invoked. In this case, $initial $(+ $expr)* means that the
generated code will start with the first expression, followed by a + and each of the additional
expressions in sequence. The * again means "repeat this pattern zero or more times". This
means, when the macro is later called in line 8, as sum!(1, 2, 3) the macro will resolve to 1 + 2
+ 3 representing the addition of all of the passed expressions.

Procedural macros

Procedural macros are Rust functions that run and modify the compiler's input token stream,
before any other components are compiled. They are generally more flexible than declarative
macros, but are more difficult to maintain due to their complexity.

Procedural macros come in three flavors:

Interface with C and C++

Rust supports the creation of foreign function interfaces (FFI) through the extern keyword. A
function that uses the C calling convention can be written using extern "C" fn. Symbols can be
exported from Rust to other languages through the #[unsafe(no_mangle)] attribute, and
symbols can be imported into Rust through extern blocks:[note 6]

The #[repr(C)] attribute enables deterministic memory layouts for structs and enums for use
across FFI boundaries. External libraries such as bindgen and cxx can generate Rust bindings
for C/C++.

Safety

Safety properties guaranteed by Rust include memory safety, type safety, and data race
freedom. As described above, these guarantees can be circumvented by using the unsafe
keyword.

Memory safety includes the absence of dereferences to null, dangling, and misaligned pointers,

Página 15
Rust (programming language)

and the absence of buffer overflows and double free errors.

Memory leaks are possible in safe Rust. Memory leaks may occur as a result of creating
reference counted pointers that point at each other (a reference cycle) or can be deliberately
created through calling Box::leak.

Ecosystem

The Rust ecosystem includes its compiler, its standard library, and additional components for
software development. Component installation is typically managed by rustup, a Rust toolchain
installer developed by the Rust project.

Compiler

The Rust compiler, rustc, compiles Rust code into binaries. First, the compiler parses the source
code into an AST. Next, this AST is lowered to IR. The compiler backend is then invoked as a
subcomponent to apply optimizations and translate the resulting IR into object code. Finally, a
linker is used to combine the object(s) into a single executable image.

rustc uses LLVM as its compiler backend by default, but it also supports using alternative
backends such as GCC and Cranelift. The intention of those alternative backends is to increase
platform coverage of Rust or to improve compilation times.

Cargo

Cargo is Rust's build system and package manager. It downloads, compiles, distributes, and

Página 16
Rust (programming language)

uploads packages—called crates—that are maintained in an official registry. It also acts as a


front-end for Clippy and other Rust components.

By default, Cargo sources its dependencies from the user-contributed registry [Link], but Git
repositories, crates in the local filesystem, and other external sources can also be specified as
dependencies.

Rustfmt

Rustfmt is a code formatter for Rust. It formats whitespace and indentation to produce code in
accordance with a common style, unless otherwise specified. It can be invoked as a standalone
program, or from a Rust project through Cargo.

Clippy

Clippy is Rust's built-in linting tool to improve the correctness, performance, and readability of
Rust code. As of 2025[update], it has 795 rules.

Versioning system

Following Rust 1.0, new features are developed in nightly versions which are released daily.
During each six-week release cycle, changes to nightly versions are released to beta, while
changes from the previous beta version are released to a new stable version.

Página 17
Rust (programming language)

Every two or three years, a new "edition" is produced. Editions are released to allow making
limited breaking changes, such as promoting await to a keyword to support async/await
features. Crates targeting different editions can interoperate with each other, so a crate can
upgrade to a new edition even if its callers or its dependencies still target older editions.
Migration to a new edition can be assisted with automated tooling.

IDE support

rust-analyzer is a set of utilities that provides integrated development environments (IDEs) and
text editors with information about a Rust project through the Language Server Protocol. This
enables features including autocomplete, and compilation error display, while editing code.

Performance

Since it performs no garbage collection, Rust is often faster than other memory-safe languages.
Most of Rust's memory safety guarantees impose no runtime overhead, with the exception of
array indexing which is checked at runtime by default. The performance impact of array
indexing bounds checks varies, but can be significant in some cases.

Many of Rust's features are so-called zero-cost abstractions, meaning they are optimized away
at compile time and incur no runtime penalty. The ownership and borrowing system permits
zero-copy implementations for some performance-sensitive tasks, such as parsing. Static
dispatch is used by default to eliminate method calls, except for methods called on dynamic
trait objects. The compiler uses inline expansion to eliminate function calls and
statically-dispatched method invocations.

Since Rust uses LLVM, all performance improvements in LLVM apply to Rust also. Unlike C and
C++, Rust allows the compiler to reorder struct and enum elements unless a #[repr(C)]
representation attribute is applied. This allows the compiler to optimize for memory footprint,
alignment, and padding, which can be used to produce more efficient code in some cases.

Página 18
Rust (programming language)

Adoption

In web services, OpenDNS, a DNS resolution service owned by Cisco, uses Rust internally.
Amazon Web Services uses Rust in "performance-sensitive components" of its several services.
In 2019, AWS open-sourced Firecracker, a virtualization solution primarily written in Rust.
Microsoft Azure IoT Edge, a platform used to run Azure services on IoT devices, has components
implemented in Rust. Microsoft also uses Rust to run containerized modules with WebAssembly
and Kubernetes. Cloudflare, a company providing content delivery network services, used Rust
to build a new web proxy named Pingora for increased performance and efficiency. The npm
package manager used Rust for its production authentication service in 2019.

In operating systems, the Linux kernel began introducing experimental support for Rust code in
Version 6.1 in late 2022, as part of the Rust for Linux project. The first drivers written in Rust
were included in version 6.8. In 2025, kernel developers at the Linux Kernel Developers Summit
determined the project to be a success, and Rust usage for kernel code will no longer be
considered experimental. The Android developers used Rust in 2021 to rewrite existing
components. Microsoft has rewritten parts of Windows in Rust. The r9 project aims to
re-implement Plan 9 from Bell Labs in Rust. Rust has also been used in the development of new
operating systems such as Redox, a "Unix-like" operating system and microkernel, Theseus, an
experimental operating system with modular state management, and most of Fuchsia. Rust is
used for command-line tools and operating system components such as stratisd, a file system
manager and COSMIC, a desktop environment by System76.

Página 19
Rust (programming language)

In web development, Deno, a secure runtime for JavaScript and TypeScript, is built on top of V8
using Rust and Tokio. Other notable adoptions in this space include Ruffle, an open-source SWF
emulator, and Polkadot, an open source blockchain and cryptocurrency platform. Components
from the Servo browser engine (funded by Mozilla and Samsung) were incorporated in the
Gecko browser engine underlying Firefox. In January 2023, Google (Alphabet) announced
support for using third party Rust libraries in Chromium.

In other uses, Discord, an instant messaging software company, rewrote parts of its system in
Rust for increased performance in 2020. In the same year, Dropbox announced that its file
synchronization had been rewritten in Rust. Facebook (Meta) used Rust to redesign its system
that manages source code for internal projects.

In the 2025 Stack Overflow Developer Survey, 14.8% of respondents had recently done
extensive development in Rust. The survey named Rust the "most admired programming
language" annually from 2016 to 2025 (inclusive), as measured by the number of existing
developers interested in continuing to work in the language.[note 7] In 2025, 29.2% of
developers not currently working in Rust expressed an interest in doing so.

In academic research

Rust's safety and performance have been investigated in programming languages research.

In other fields, a journal article published to Proceedings of the International Astronomical Union
used Rust to simulate multi-planet systems. An article published in Nature shared stories of
bioinformaticians using Rust. Both articles cited Rust's performance and safety as advantages,
and the learning curve as being a primary drawback to Rust adoption.

The 2025 DARPA project TRACTOR aims to automatically translate C to Rust using techniques
such as static analysis, dynamic analysis, and large language models.

Community

Página 20
Rust (programming language)

According to the MIT Technology Review, the Rust community has been seen as "unusually
friendly" to newcomers and particularly attracted people from the queer community, partly due
to its code of conduct. Inclusiveness has been cited as an important factor for some Rust
developers. The official Rust blog collects and publishes demographic data each year.

Rust Foundation

The Rust Foundation is a non-profit membership organization incorporated in United States; it


manages the Rust trademark, infrastructure, and assets.

It was established on February 8, 2021, with five founding corporate members (Amazon Web
Services, Huawei, Google, Microsoft, and Mozilla). The foundation's board was chaired by Shane
Miller, with Ashley Williams as interim executive director. In late 2021, Rebecca Rumbul
became Executive Director and CEO.

Governance teams

The Rust project is maintained by 8 top-level teams as of November 2025[update]: the


leadership council, compiler team, dev tools team, infrastructure team, language team,
launching pad, library team, and moderation team. The leadership council oversees the project
and is formed by representatives among the other teams.

Página 21
Rust (programming language)

See also

Notes

References

Book sources

Others

External links

Página 22

Common questions

Powered by AI

Functional programming influences are evident in Rust through features like immutability and pattern matching. Immutability in Rust, inspired by functional languages, ensures that variables are immutable by default, enhancing predictability and thread safety . Pattern matching in Rust, through match and if let expressions, allows expressive and concise data destructuring, akin to pattern matching in languages like Haskell or OCaml . These features promote safer and more maintainable code, similar to their benefits in functional programming languages .

Rust has been adopted by companies such as Amazon Web Services due to its emphasis on performance, safety, and the lack of a garbage collector . Rust code is known to use less energy compared to similar code in Java, which demonstrates its efficiency . The programming language combines low-level control and high-level guarantees, making it a safer alternative to C and C++ while providing similar or better performance characteristics .

Rust's ownership system contributes to memory safety by ensuring each value has exactly one owner, and through mechanisms like borrowing, it ensures that only valid references exist during a value's lifetime. When a value goes out of scope, it is automatically dropped by running its destructor, allowing Rust to manage resources such as file handles and network sockets without a garbage collector . This prevents common issues like dangling pointers and use-after-free errors, thus enforcing a robust form of software fault isolation .

The community-driven governance model established post-2013, with the core team and RFC process, democratized Rust's evolution. This federated approach enabled dynamic yet structured language evolution, balancing innovation with stability . It empowered community contributions, with over 1,400 contributors by 2016, speeding up feature stabilization and fostering open participation .

Rust handles optional values and errors using the Option<T> and Result<T, E> types, respectively. These types require explicit handling through pattern matching or syntactic sugar like the 'try' operator (?). This approach differs from traditional exception handling by enforcing that all error cases are considered at compile time, reducing runtime failures . This explicit handling of errors ensures more robust and predictable programs compared to implicit exception handling in languages like Java or Python .

After Mozilla's layoffs in 2020, the Rust Foundation was formed to safeguard Rust's future and influence its strategic direction. The Foundation took over ownership of trademarks and financed the language’s development . It aimed to counterbalance the loss of Mozilla's direct support by securing funding from multiple large tech companies, including Amazon, Microsoft, and Google, ensuring the community-based growth and sustenance of the language .

Mozilla's layoffs in 2020 prompted concerns about Rust's sustainability due to the reduced direct support. However, the formation of the Rust Foundation, backed by major tech companies, reassured the community about Rust's future . The Foundation's financial and strategic support demonstrated a commitment to sustained development and addressed community apprehension over Rust's viability beyond Mozilla .

Rust's lifetimes and borrow checking mechanisms enforce memory safety by ensuring references are valid as long as they are alive, preventing dangling pointers . Lifetimes are determined at compile time, capturing the scope and duration of references, while the borrow checker enforces their correct usage within these bounds. This compile-time checking prevents issues like use-after-free and null dereferences, common in languages like C and C++ .

The close collaboration between the Servo and Rust projects led to bidirectional feature development. New features in Rust were prototyped in Servo, allowing real-world testing and feedback, while innovations in Servo informed Rust’s evolution . This synergy accelerated feature stabilization and application, such as implementation in Firefox’s Quantum project, enhancing browser performance .

Between 2012 and 2015, Rust underwent significant changes in its type system and memory management approach. It eliminated the garbage collector by consolidating the ownership system . Features such as typestates and various specialized pointer types were removed to simplify the language . The ownership system became the primary mechanism for memory management, making Rust's approach more deterministic and resource efficient .

You might also like