r[dynamic-sized]

Dynamically Sized Types

r[dynamic-sized.intro] 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, trait objects, and str are examples of DSTs.

r[dynamic-sized.restriction] Such types can only be used in certain cases:

r[dynamic-sized.pointer-types]

r[dynamic-sized.question-sized]

r[dynamic-sized.trait-impl]

r[dynamic-sized.struct-field]

[!NOTE] Variables, function parameters, const items, and static items must be Sized.