constant/constdef_impls/
primitive.rs1use crate::Constdef;
2
3macro_rules! impl_numeric {
4 ($($ty:ty),*) => {
5 $(impl Constdef for $ty {
6 const DEFAULT: $ty = 0;
7 })*
8 };
9}
10
11impl_numeric! {
12 u8, i8, u16, i16, u32, i32, u64, i64, u128, i128, usize, isize
13}
14
15impl Constdef for f32 {
16 const DEFAULT: f32 = 0.0;
17}
18
19impl Constdef for f64 {
20 const DEFAULT: f64 = 0.0;
21}
22
23impl Constdef for char {
24 const DEFAULT: char = '\0';
25}
26
27impl<'a> Constdef for &'a str {
28 const DEFAULT: &'a str = "";
29}
30
31impl Constdef for bool {
32 const DEFAULT: bool = false;
33}
34
35impl Constdef for () {
36 const DEFAULT: () = ();
37}