ArticleslgStudy

computer science

Rust (programming language)

Rust (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Rust (programming language) rather than just read about it. In short: Rust is a general-purpose programming language that emphasizes performance, type safety, concurrency, and memory safety. Rust supports multiple programming paradigms.

Rust (programming language) — main illustration
Rust (programming language) — illustration

Key takeaways

  • Rust (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Rust (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Rust (programming language) from memory before moving on to harder problems.

Reference excerpt

Rust is a general-purpose programming language that emphasizes 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 enforces 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. The project has been sponsored by the Rust Foundation since 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

In 2006, Rust began as a personal project by Mozilla employee Graydon Hoare. 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 fungi of the same name that is "over-engineered for survival". Between 2006 and 2009, Rust was not publicized to others at Mozilla and was written in Hoare's free time. Hoare began speaking about the language around 2009 after a small group at Mozilla became interested. Early contributors have agreed that the language was based primarily on existing ideas. Hoare cited languages from the 1970s, 1980s, and 1990s as influences — including CLU, BETA, Mesa, NIL, Erlang, Newsqueak, Napier, Hermes, Sather, Alef, and Limbo. He described the language as "technology from the past come to save the future from itself." Early contributor Manish Goregaokar similarly described it as based on "mostly decades-old research." The first compiler was written in about 38,000 lines of OCaml. It supported a number of features no longer present today, including explicit object-oriented programming via an obj keyword and a typestate analysis system tracking variable state such as going from uninitialized to initialized.

2009–2012: Mozilla sponsorship In 2009, Mozilla officially sponsored the project. 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. Work shifted from the OCaml compiler to a self-hosting compiler (i.e., written in Rust) targeting LLVM. The ownership system was in place by 2010. The Rust logo was developed in 2011 based on a bicycle chainring. The early 2010s witnessed increasing involvement from full-time engineers at Mozilla and open source contributors. On January 20, 2012, Rust 0.1 became the first public release for Windows, Linux, and MacOS.

2012–2015: Evolution The following years were marked by substantial changes to the Rust type system. Memory management through the ownership system was gradually consolidated and expanded; by 2013, the garbage collector was rarely used, and was removed. Also removed were typestates, the pure keyword, various specialized pointer types, and syntax support for channels. According to Steve Klabnik, the language 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., the type system). In 2013, Graydon Hoare stepped down from Rust. After Hoare's departure, it evolved organically under a federated governance structure, with a "core team" of initially six people, and around 30-40 developers total across various other teams. In March 2014, a Request for Comments (RFC) process for new language features was added. By 2016, the core team would grow to nine people with over 1600 RFCs. Development focused on finalizing features for version 1.0 (which would begin providing backward compatibility). According to Andrew Binstock writing 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. On May 15, 2015, Rust 1.0 became the first stable release. One year later, the compiler had accumulated at least 1,400 contributors, and there were at least 5,000 third-party libraries published on the package management website Crates.io.

2015–2020: Servo and early adoption

The development of the Servo browser engine continued in parallel with Rust, funded by Mozilla and Samsung. 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. The first version of Servo was released in 2016. The Firefox web browser shipped with Rust code as of 2016 (version 45), but components of Servo did not appear in Firefox until September 2017 (version 57) as part of the Gecko and Quantum projects. In the years following 1.0, improvements were made to the toolchain ecosystem including Rustfmt, integrated development environment (IDE) support, and a regular compiler testing and release cycle. Rust's community gained a code of conduct and an IRC chat for discussion. The earliest known adoption outside of Mozilla was by individual projects at Samsung, Facebook (now Meta Platforms), Dropbox, and Tilde, Inc., the company behind ember.js. Amazon Web Services followed in 2020. Engineers cited performance, lack of a garbage collector, safety, and developer experience as reasons for the adoption. Amazon developers cited a 2017 research finding that Rust code was more energy efficient compared to similar Java code.

… excerpt ends here. Continue reading the full article.

Illustrations

Rust (programming language) illustration
Rust (programming language): Mozilla Foundation headquarters in Mountain View, California, June 2009
Mozilla Foundation headquarters in Mountain View, California, June 2009
Rust (programming language): Early homepage of Mozilla's Servo browser engine
Early homepage of Mozilla's Servo browser engine
Rust (programming language): A diagram of the dependencies between the standard library modules of Rust
A diagram of the dependencies between the standard library modules of Rust
Rust (programming language): Screenshot of crates.io in June 2022
Screenshot of crates.io in June 2022

Worked examples

Example 1 — a first encounter with Rust (programming language)

Start with the simplest possible case. Write down what Rust (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Rust (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Rust (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Rust (programming language)

In research
Rust (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Rust (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Rust (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Compiled programming languages, Concurrent programming languages, Free and open source compilers, so understanding it makes those chapters shorter.
In everyday life
Look for Rust (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Rust (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Rust (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Rust (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Rust (programming language) in simple terms?

Rust is a general-purpose programming language that emphasizes performance, type safety, concurrency, and memory safety. Rust supports multiple programming paradigms.

Why does Rust (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Rust (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Rust (programming language).

Tags

  • Compiled programming languages
  • Concurrent programming languages
  • Free and open source compilers
  • Free software projects
  • Functional languages
  • Mozilla
  • Multi-paradigm programming languages
  • Pattern matching programming languages
  • Procedural programming languages
  • Programming languages created in 2015
  • Rust (programming language)
  • Software using the Apache license

Keep exploring