pub trait ConstInit {
const INIT: Self;
}Expand description
๐ฑ A trait for giving a type a useful const-friendly initial value.
๐ code
ยงComparison with Default
Default represents the typeโs natural baseline, usually a neutral or zero-like state.
ConstInit simply provides a valid const-time initializer, without requiring that meaning.
When a type has a clear Default, these traits should return the same value to keep behavior
consistent. They only diverge for types that cannot offer a safe or meaningful Default, but
still need a guaranteed const initializer.
- Use
Defaultfor semantic baselines. - Use
ConstInitfor invariant-safe const initialization.
Required Associated Constantsยง
Dyn Compatibilityยง
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Typesยง
Implementorsยง
Sourceยงimpl ConstInit for AtomicI128
Available on crate feature dep_portable_atomic only.
impl ConstInit for AtomicI128
dep_portable_atomic only.Sourceยงimpl ConstInit for AtomicIsize
Available on crate feature dep_portable_atomic only.
impl ConstInit for AtomicIsize
dep_portable_atomic only.Sourceยงimpl ConstInit for AtomicU128
Available on crate feature dep_portable_atomic only.
impl ConstInit for AtomicU128
dep_portable_atomic only.Sourceยงimpl ConstInit for AtomicUsize
Available on crate feature dep_portable_atomic only.
impl ConstInit for AtomicUsize
dep_portable_atomic only.Sourceยงimpl ConstInit for AudioChannel
Available on crate feature audio only.
impl ConstInit for AudioChannel
audio only.Sourceยงimpl ConstInit for AudioChannels
Available on crate feature audio only.
impl ConstInit for AudioChannels
audio only.Sourceยงimpl ConstInit for BitfieldExample
Available on crate features _docs_examples only.
impl ConstInit for BitfieldExample
_docs_examples only.Sourceยงimpl ConstInit for EventButton
Available on crate feature event only.
impl ConstInit for EventButton
event only.Sourceยงimpl ConstInit for EventButtonState
Available on crate feature event only.
impl ConstInit for EventButtonState
event only.Sourceยงimpl ConstInit for EventButtons
Available on crate feature event only.
impl ConstInit for EventButtons
event only.Sourceยงimpl ConstInit for EventPointer
Available on crate feature event only.
impl ConstInit for EventPointer
event only.Sourceยงimpl ConstInit for EventPointerKind
Available on crate feature event only.
impl ConstInit for EventPointerKind
event only.Sourceยงimpl ConstInit for EventTagSet
Available on crate feature event only.
impl ConstInit for EventTagSet
event only.Sourceยงimpl ConstInit for EventTarget
Available on crate feature event only.
impl ConstInit for EventTarget
event only.Sourceยงimpl ConstInit for EventTimestamp
Available on crate feature event only.
impl ConstInit for EventTimestamp
event only.Sourceยงimpl ConstInit for EventWheelUnit
Available on crate feature event only.
impl ConstInit for EventWheelUnit
event only.Sourceยงimpl ConstInit for EventWindow
Available on crate feature event only.
impl ConstInit for EventWindow
event only.Sourceยงimpl ConstInit for GraphemeString
Available on crate feature grapheme only.
impl ConstInit for GraphemeString
grapheme only.Sourceยงimpl ConstInit for HandleSpanExample
Available on crate features _docs_examples only.
impl ConstInit for HandleSpanExample
_docs_examples only.Sourceยงimpl ConstInit for Lcg16
Available on crate feature rand only.Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for Lcg16
rand only.Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for LinuxSigactionFlags
Available on crate feature linux only.
impl ConstInit for LinuxSigactionFlags
linux only.Sourceยงimpl ConstInit for LinuxSignalSet
Available on crate feature linux only.
impl ConstInit for LinuxSignalSet
linux only.Sourceยงimpl ConstInit for LinuxTermiosControlFlags
Available on crate feature linux only.
impl ConstInit for LinuxTermiosControlFlags
linux only.Sourceยงimpl ConstInit for LinuxTermiosInputFlags
Available on crate feature linux only.
impl ConstInit for LinuxTermiosInputFlags
linux only.Sourceยงimpl ConstInit for LinuxTermiosLocalFlags
Available on crate feature linux only.
impl ConstInit for LinuxTermiosLocalFlags
linux only.Sourceยงimpl ConstInit for LinuxTermiosOutputFlags
Available on crate feature linux only.
impl ConstInit for LinuxTermiosOutputFlags
linux only.Sourceยงimpl ConstInit for LinuxTimespec
Available on crate feature linux only.
impl ConstInit for LinuxTimespec
linux only.Sourceยงimpl ConstInit for NonZeroI16
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroI16
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroI32
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroI32
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroI64
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroI64
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroI128
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroI128
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroIsize
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroIsize
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroU16
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroU16
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroU32
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroU32
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroU64
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroU64
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroU128
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroU128
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for NonZeroUsize
This implementation returns the same as Self::MIN.
impl ConstInit for NonZeroUsize
This implementation returns the same as Self::MIN.
Sourceยงimpl ConstInit for SplitMix64
Provides a fixed default initialized value.
impl ConstInit for SplitMix64
Provides a fixed default initialized value.
Sourceยงimpl ConstInit for TermInputParser
Available on crate features event and term only.
impl ConstInit for TermInputParser
event and term only.Sourceยงimpl ConstInit for TermStyleExt
Available on crate feature term only.
impl ConstInit for TermStyleExt
term only.Sourceยงimpl ConstInit for Xabc
Available on crate feature rand only.Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for Xabc
rand only.Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for XorShift16
Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for XorShift16
Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for XorShift32
Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for XorShift32
Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for XorShift64
Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for XorShift64
Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for XorShift128
Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for XorShift128
Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for XorShift128p
Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for XorShift128p
Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for Xoroshiro128pp
Available on crate feature rand only.Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for Xoroshiro128pp
rand only.Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl ConstInit for Xyza8a
Available on crate feature rand only.Creates a new PRNG initialized with the default fixed seed.
impl ConstInit for Xyza8a
rand only.Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl<T: ConstInit, const C: usize, const R: usize, const CR: usize, const RMAJ: bool> ConstInit for Array2d<T, C, R, CR, RMAJ, Bare>
impl<T: ConstInit, const C: usize, const R: usize, const CR: usize, const RMAJ: bool> ConstInit for Array2d<T, C, R, CR, RMAJ, Bare>
Sourceยงimpl<T: ConstInit, const CAP: usize, IDX: ConstInit> ConstInit for Destaque<T, CAP, IDX, Bare>
Available on _destaqueยทยท only.
impl<T: ConstInit, const CAP: usize, IDX: ConstInit> ConstInit for Destaque<T, CAP, IDX, Bare>
_destaqueยทยท only.Sourceยงimpl<T: ConstInit, const CAP: usize, IDX: ConstInit> ConstInit for Stack<T, CAP, IDX, Bare>
Available on _stackยทยท only.
impl<T: ConstInit, const CAP: usize, IDX: ConstInit> ConstInit for Stack<T, CAP, IDX, Bare>
_stackยทยท only.Sourceยงimpl<T: ConstInit, const D: usize> ConstInit for Vector<T, D>
Available on crate feature lin only.
impl<T: ConstInit, const D: usize> ConstInit for Vector<T, D>
lin only.Sourceยงimpl<T: ConstInit> ConstInit for Lane4_i32Example<T>
Available on crate feature _docs_examples only.
impl<T: ConstInit> ConstInit for Lane4_i32Example<T>
_docs_examples only.Sourceยงimpl<T: MemPod, const CAP: usize> ConstInit for DstArray<T, CAP>
Available on crate feature unsafe_layout only.
impl<T: MemPod, const CAP: usize> ConstInit for DstArray<T, CAP>
unsafe_layout only.Sourceยงimpl<T: Ord> ConstInit for BinaryHeap<T>
Available on crate feature alloc only.
impl<T: Ord> ConstInit for BinaryHeap<T>
alloc only.Sourceยงimpl<T> ConstInit for Interval<T>
Provides a const default value for Interval, the unbounded interval $(-\infty, \infty)$.
impl<T> ConstInit for Interval<T>
Provides a const default value for Interval, the unbounded interval $(-\infty, \infty)$.
See the default implementation for more information.
Sourceยงimpl<T> ConstInit for LinkedList<T>
Available on crate feature alloc only.
impl<T> ConstInit for LinkedList<T>
alloc only.Sourceยงimpl<T> ConstInit for TypeResource<T>
impl<T> ConstInit for TypeResource<T>
Sourceยงimpl<const A: usize, const B: usize, const C: usize> ConstInit for XorShift8<A, B, C>
Creates a new PRNG initialized with the default fixed seed.
impl<const A: usize, const B: usize, const C: usize> ConstInit for XorShift8<A, B, C>
Creates a new PRNG initialized with the default fixed seed.
Sourceยงimpl<const CAP: usize> ConstInit for EventQueue<CAP>
Available on crate feature event only.
impl<const CAP: usize> ConstInit for EventQueue<CAP>
event only.Sourceยงimpl<const CAP: usize> ConstInit for GraphemeNonul<CAP>
Available on crate feature grapheme only.
impl<const CAP: usize> ConstInit for GraphemeNonul<CAP>
grapheme only.Sourceยงimpl<const CAP: usize> ConstInit for GraphemeU8<CAP>
Available on crate feature grapheme only.
impl<const CAP: usize> ConstInit for GraphemeU8<CAP>
grapheme only.Sourceยงimpl<const CAP: usize> ConstInit for StringSmallAlloc<CAP>
Available on crate feature alloc only.
impl<const CAP: usize> ConstInit for StringSmallAlloc<CAP>
alloc only.