There is a new edition of the book and this is an old link.
Sometimes referred to as ‘DSTs’ or ‘unsized types’, these types let us talk about types whose size we can only know at runtime. The
Sized
trait is automatically implemented for everything the compiler knows the size of at compile time. A trait bound on?Sized
is the opposite of a trait bound onSized
; that is, we would read this as “T
may or may not beSized
”.
fn generic<T: ?Sized>(t: &T) { // ...snip... }Run
Here are the relevant sections in the new and old books: