Content deleted Content added
m Undid revision 1297472892 by Dbeef (talk) |
|||
Line 70:
'''Rust''' is a [[General-purpose programming language|general-purpose]] [[programming language]] emphasizing [[Computer performance|performance]], [[type safety]], and [[Concurrency (computer science)|concurrency]]. It enforces [[memory safety]], meaning that all [[Reference (computer science)|references]] point to valid memory. It does so without a conventional [[Garbage collection (computer science)|garbage collector]]; instead, memory safety errors and [[data race]]s are prevented by the "borrow checker", which tracks the [[object lifetime]] of references [[Compiler|at compile time]].
Rust supports multiple [[programming paradigm]]s. It was influenced by ideas from [[functional programming]], including [[Immutable object|immutability]], [[higher-order function]]s, [[algebraic data type]]s, and [[pattern matching]]. It also supports [[object-oriented programming]] via structs, [[
Software developer Graydon Hoare created Rust as a personal project while working at [[Mozilla]] Research in 2006. Mozilla officially sponsored the project in 2009. The first stable release of Rust, Rust 1.0, was published in May 2015. Following a large layoff of Mozilla employees in August 2020, multiple other companies joined Mozilla in sponsoring Rust through the creation of the [[#Rust Foundation|Rust Foundation]] in February 2021. In December 2022, Rust became the first language other than [[C (programming language)|C]] and [[Assembly language|assembly]] to be supported in the development of the [[Linux kernel]].
Line 452:
==== Standard library ====
The Rust [[standard library]] defines and implements many widely used custom data types, including core data structures such as {{code|Vec}}, {{code|Option}}, and {{code|HashMap}}, as well as [[smart pointer]] types. Rust also provides a way to exclude most of the standard library using the attribute {{rust|#![no_std]}}; this enables applications, such as embedded devices, which want to remove dependency code or provide their own core data structures. Internally, the standard library is divided into three parts, {{code|core}}, {{code|alloc}}, and {{code|std}}, where {{code|std}} and {{Code|alloc}} are excluded by {{rust|#![no_std]}}.{{sfn|Gjengset|2021|pp=213-215}}
Rust uses [[Option type|<code>Option</code>]]
<syntaxhighlight lang="rust">
Line 473:
=== Pointers ===
▲Rust also supports raw pointer types <code>*const</code> and <code>*mut</code>, which may be null; however, it is impossible to dereference them unless the code is explicitly declared unsafe through the use of an <code>unsafe</code> block. Unlike dereferencing, the creation of raw pointers is allowed inside of safe Rust code.{{sfn|Klabnik|Nichols|2019|pp=418–427}}
=== Type conversion ===
Line 639 ⟶ 586:
[[File:Cargo compiling.webm|thumb|right|Compiling a Rust program with Cargo]]
The Rust ecosystem includes its compiler, its [[#Standard library|standard library]], and additional components for software development. Component installation is typically managed by {{code|rustup}}, a Rust [[toolchain]] installer developed by the Rust project.{{sfn|Blandy|Orendorff|Tindall|2021|pp=6-8}}
<!-- Add Miri Compiler? -->
|