The Kernel Crate and Its Prelude
When you write Rust inside Linux there is no standard library: no Vec, no String, no println. Everything a driver is allowed to use lives in one library shipped with the kernel source called the kernel crate, and its prelude module is the short list of names almost every driver imports on line one. It is the menu of what the kernel community has reviewed and blessed for driver code. Without knowing it you either reinvent something that already exists or reach for a crate that cannot compile in a place with no operating system under it.
Questions this Concept answers
- What does it mean that kernel Rust is `no_std`?
kernel::prelude
Rust code in the Linux kernel cannot use the normal Rust standard library, so everything a driver may use ships in one library called the kernel crate. This page documents that crate's prelude, the s…