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