Conceptual
Login

Sized and Unsized Types in Rust

Most types have a size the compiler knows exactly, but a few, like a slice of unknown length, do not. Rust assumes known size everywhere unless you explicitly relax that requirement. Knowing the difference explains why some values can only be used from behind a pointer.

Questions this Concept answers

  • Why must an unsized value such as `[u8]` be used from behind a reference or pointer?