sigma_types/
zero.rs

1//! Types equipped with an additive identity (i.e., zero).
2
3/// Types equipped with an additive identity (i.e., zero).
4pub trait Zero {
5    /// Additive identity (i.e., zero).
6    const ZERO: Self;
7}
8
9impl Zero for f32 {
10    const ZERO: Self = 0.;
11}
12
13impl Zero for f64 {
14    const ZERO: Self = 0.;
15}
16
17impl Zero for i128 {
18    const ZERO: Self = 0;
19}
20
21impl Zero for i16 {
22    const ZERO: Self = 0;
23}
24
25impl Zero for i32 {
26    const ZERO: Self = 0;
27}
28
29impl Zero for i64 {
30    const ZERO: Self = 0;
31}
32
33impl Zero for i8 {
34    const ZERO: Self = 0;
35}
36
37impl Zero for isize {
38    const ZERO: Self = 0;
39}
40
41impl Zero for u128 {
42    const ZERO: Self = 0;
43}
44
45impl Zero for u16 {
46    const ZERO: Self = 0;
47}
48
49impl Zero for u32 {
50    const ZERO: Self = 0;
51}
52
53impl Zero for u64 {
54    const ZERO: Self = 0;
55}
56
57impl Zero for u8 {
58    const ZERO: Self = 0;
59}
60
61impl Zero for usize {
62    const ZERO: Self = 0;
63}