byte_unit/byte/
constants.rs1use super::Byte;
2#[cfg(feature = "u128")]
3use super::RONNABYTE;
4
5#[rustfmt::skip]
7impl Byte {
8 pub const BYTE: Byte = Byte(1);
10
11 pub const KILOBYTE: Byte = Byte(1_000);
13 pub const MEGABYTE: Byte = Byte(1_000_000);
15 pub const GIGABYTE: Byte = Byte(1_000_000_000);
17 pub const TERABYTE: Byte = Byte(1_000_000_000_000);
19 pub const PETABYTE: Byte = Byte(1_000_000_000_000_000);
21 pub const EXABYTE: Byte = Byte(1_000_000_000_000_000_000);
23 #[cfg(feature = "u128")]
24 pub const ZETTABYTE: Byte = Byte(1_000_000_000_000_000_000_000);
26 #[cfg(feature = "u128")]
27 pub const YOTTABYTE: Byte = Byte(1_000_000_000_000_000_000_000_000);
29
30 pub const KIBIBYTE: Byte = Byte(1 << 10);
32 pub const MEBIBYTE: Byte = Byte(1 << 20);
34 pub const GIBIBYTE: Byte = Byte(1 << 30);
36 pub const TEBIBYTE: Byte = Byte(1 << 40);
38 pub const PEBIBYTE: Byte = Byte(1 << 50);
40 pub const EXBIBYTE: Byte = Byte(1 << 60);
42 #[cfg(feature = "u128")]
43 pub const ZEBIBYTE: Byte = Byte(1 << 70);
45 #[cfg(feature = "u128")]
46 pub const YOBIBYTE: Byte = Byte(1 << 80);
48
49
50 pub const KILOBIT: Byte = Byte::KILOBYTE.div_8();
52 pub const MEGABIT: Byte = Byte::MEGABYTE.div_8();
54 pub const GIGABIT: Byte = Byte::GIGABYTE.div_8();
56 pub const TERABIT: Byte = Byte::TERABYTE.div_8();
58 pub const PETABIT: Byte = Byte::PETABYTE.div_8();
60 pub const EXABIT: Byte = Byte::EXABYTE.div_8();
62 #[cfg(feature = "u128")]
63 pub const ZETTABIT: Byte = Byte::ZETTABYTE.div_8();
65 #[cfg(feature = "u128")]
66 pub const YOTTABIT: Byte = Byte::YOTTABYTE.div_8();
68
69
70 pub const KIBIBIT: Byte = Byte::KIBIBYTE.div_8();
72 pub const MEBIBIT: Byte = Byte::MEBIBYTE.div_8();
74 pub const GIBIBIT: Byte = Byte::GIBIBYTE.div_8();
76 pub const TEBIBIT: Byte = Byte::TEBIBYTE.div_8();
78 pub const PEBIBIT: Byte = Byte::PEBIBYTE.div_8();
80 pub const EXBIBIT: Byte = Byte::EXBIBYTE.div_8();
82 #[cfg(feature = "u128")]
83 pub const ZEBIBIT: Byte = Byte::ZEBIBYTE.div_8();
85 #[cfg(feature = "u128")]
86 pub const YOBIBIT: Byte = Byte::YOBIBYTE.div_8();
88
89 pub const MIN: Byte = Byte(0);
91 pub const MAX: Byte = {
93 #[cfg(feature = "u128")]
94 {
95 Byte(RONNABYTE - 1)
96 }
97
98 #[cfg(not(feature = "u128"))]
99 {
100 Byte(u64::MAX)
101 }
102 };
103}