limine_protocol/
default_const.rs1pub trait ConstDefault {
3 const DEFAULT: Self;
5}
6
7impl<T> ConstDefault for Option<T> {
8 const DEFAULT: Self = None;
9}
10
11impl<T> ConstDefault for *const T {
12 const DEFAULT: Self = core::ptr::null();
13}
14
15impl<T> ConstDefault for *mut T {
16 const DEFAULT: Self = core::ptr::null_mut();
17}
18
19macro_rules! impl_number_constants {
21 ($($ty:ty$(,)*)*) => {
22 $(
23 impl ConstDefault for $ty {
24 const DEFAULT: Self = Self::MIN;
25 }
26 )*
27 };
28}
29
30impl_number_constants!(u8, i8, u16, i16, u32, i32, u64, i64, u128, i128);