Dynamically Sized Types - The Rust Reference (original) (raw)

The Rust Reference

Dynamically Sized Types

Most types have a fixed size that is known at compile time and implement the trait Sized. A type with a size that is known only at run-time is called a dynamically sized type (DST) or, informally, an unsized type.Slices and trait objects are two examples of DSTs.

Such types can only be used in certain cases:

Note: variables, function parameters, const items, and static items must beSized.