pub trait ConstDefault {
    const DEFAULT: Self;
}
Expand description

Implements a compilation time default value for the implemented type.

Note

Unlike the Default trait implementation the DEFAULT of implementations of this trait can be used in constant evaluation contexts.

Example

const VEC: Vec<u8> = <Vec<u8> as ConstDefault>::DEFAULT;

The above code works while the below code does not:

const VEC: Vec<u8> = <Vec<u8> as Default>::default();

Required Associated Constants

The constant default value.

Implementations on Foreign Types

Implementors