Unsize in core::marker - Rust (original) (raw)

pub trait Unsize<T: ?Sized> { }

🔬This is a nightly-only experimental API. (unsize #18598)

Expand description

Types that can be “unsized” to a dynamically-sized type.

For example, the sized array type [i8; 2] implements Unsize<[i8]> andUnsize<dyn fmt::Debug>.

All implementations of Unsize are provided automatically by the compiler. Those implementations are:

Unsize is used along with ops::CoerceUnsized to allow “user-defined” containers such as Rc to contain dynamically-sized types. See the DST coercion RFC and the nomicon entry on coercionfor more details.