Rust: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
→‎Operating System Development: Added a description of the alloc crate
Line 7: Line 7:
== Operating System Development ==
== Operating System Development ==


Rust has a comparable amount of runtime to C and C++, and has set up its standard library to be amenable towards OS development. Specifically, the standard library is split into two parts: core and std. Core is the lowest-level aspects only, and doesn't include things like allocation, threading, and other higher-level features. Std builds on top of core to add them. Using only core is as easy as adding an annotation in your main source file.
Rust has a comparable amount of runtime to C and C++, and has set up its standard library to be amenable towards OS development. Specifically, the standard library (std) consists of two smaller parts: core and alloc. Core consists of the primitive, platform-independent components of the standard library. It doesn't include things like allocation, threading, and other higher-level features. Alloc is used for managing heap allocations, smart pointers, and simple data collections. Std builds on top of core and alloc to add other OS dependent features, such as files and processes. Using only core and alloc instead of std is as easy as adding the '''no_std''' annotation to your main source file.


Every Rust compiler is a cross-compiler, which makes setup easier.
Every Rust compiler is a cross-compiler, which makes setup easier.