Trait const_default::ConstDefault [−][src]
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();Associated Constants
Implementations on Foreign Types
impl<'a, T> ConstDefault for Cow<'a, T> where
T: ToOwned + ?Sized + 'a,
<T as ToOwned>::Owned: ConstDefault,
This is supported on crate features std or alloc only.
impl<'a, T> ConstDefault for Cow<'a, T> where
T: ToOwned + ?Sized + 'a,
<T as ToOwned>::Owned: ConstDefault,
This is supported on crate features
std or alloc only.impl<K: Ord, V> ConstDefault for BTreeMap<K, V>
This is supported on (crate features std or alloc) and crate feature unstable only.
impl<K: Ord, V> ConstDefault for BTreeMap<K, V>
This is supported on (crate features
std or alloc) and crate feature unstable only.impl<T: Ord> ConstDefault for BTreeSet<T>
This is supported on (crate features std or alloc) and crate feature unstable only.
impl<T: Ord> ConstDefault for BTreeSet<T>
This is supported on (crate features
std or alloc) and crate feature unstable only.impl ConstDefault for AtomicUsize
This is supported on crate features default or enable-atomics only.
impl ConstDefault for AtomicUsize
This is supported on crate features
default or enable-atomics only.impl ConstDefault for AtomicIsize
This is supported on crate features default or enable-atomics only.
impl ConstDefault for AtomicIsize
This is supported on crate features
default or enable-atomics only.impl<T> ConstDefault for AtomicPtr<T>
This is supported on crate features default or enable-atomics only.
impl<T> ConstDefault for AtomicPtr<T>
This is supported on crate features
default or enable-atomics only.