devela/data/value/build.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
// devela::data::value::build
//
//! All the data-value related types are declared here.
//!
//! Firstly some mockups of unimported types are defined in order for the
//! `define_all_sizes` macro to work correctly under any feature combination.
//!
//! Secondly the crate types are built for the following sizes:
//! - bytes: 1, 2, 4, 8, 16, 32, 64, 128
//! - bits: 8, 16, 32, 64, 128, 256, 512, 1024
//
use super::*;
// 1. Mockups replacing unused dependencies
// -----------------------------------------------------------------------------
// "deps_continuous"
// #[cfg(not(feature = "half"))]
// mod half {
// #![allow(dead_code)]
// pub struct f16;
// pub struct bf16;
// }
// #[cfg(not(feature = "twofloat"))]
// mod twofloat {
// #![allow(dead_code)]
// pub struct TwoFloat;
// }
// "deps_discrete"
// #[cfg(not(feature = "num-rational"))]
// mod num_rational {
// #![allow(dead_code)]
// pub struct Ratio;
// }
//
// #[cfg(not(feature = "num-bigint"))]
// mod num_bigint {
// #![allow(dead_code)]
// pub struct BigInt;
// }
// #[cfg(not(feature = "rust_decimal"))]
// mod rust_decimal {
// #![allow(dead_code)]
// pub struct Decimal;
// }
// "deps_string"
// #[cfg(not(feature = "arraystring"))]
// mod arraystring {
// #![allow(dead_code)]
// pub struct ArrayString<T> {
// _t: T,
// }
// }
// #[cfg(feature = "arraystring")]
// use arraystring::{typenum, ArrayString};
// "deps_time"
// #[cfg(not(feature = "fugit"))]
// mod fugit {
// #![allow(dead_code)]
// pub struct Instant<T, const A: usize, B: Into<usize>> {
// _t: T,
// _b: B,
// }
// pub struct Duration<T, const A: usize, B: Into<usize>> {
// _t: T,
// _b: B,
// }
// }
// #[cfg(not(feature = "time"))]
// mod time {
// #![allow(dead_code)]
// pub struct Date;
// pub struct Time;
// pub struct Instant;
// pub struct UtcOffset;
// pub struct OffsetDateTime;
// pub struct PrimitiveDateTime;
// pub struct Duration;
// }
// 2. TYPES DEFINITIONS
// -----------------------------------------------------------------------------
define_data_value_type_raw! {
all_sizes: DataValue, DataType, DataRaw, // order matters
// --------------------------------------------------------------- 1-B / 8-b
copy_variants_1B:
"8-bit unsigned integer ", U8, u8, // def:true,
"8-bit signed integer", I8, i8, //def:true,
"1-Byte array of bytes", ByteArray1B, [u8; 1], //def:true,
"Boolean value", Bool, bool, //def:true,
copy_variants_1B_dep:
copy_variants_1B_psize:
"8-bit usize", Usize, usize, target_pointer_width = "8", //def:true,
"8-bit isize", Isize, isize, target_pointer_width = "8", //def:true,
copy_variants_1B_psize_dep:
noncopy_variants_1B:
noncopy_variants_1B_dep:
noncopy_variants_1B_psize:
noncopy_variants_1B_psize_dep:
// -------------------------------------------------------------- 2-B / 16-b
copy_variants_2B:
"16-bit unsigned integer ", U16, u16,
"16-bit signed integer", I16, i16,
"2-Byte array of bytes", ByteArray2B, [u8; 2],
copy_variants_2B_dep:
// "16-bit floating-point number", F16, ::core::f16, "nightly_float", "nightly_float",
copy_variants_2B_psize:
"16-bit usize", Usize, usize, target_pointer_width = "16",
"16-bit isize", Isize, isize, target_pointer_width = "16",
copy_variants_2B_psize_dep:
noncopy_variants_2B:
noncopy_variants_2B_dep:
noncopy_variants_2B_psize:
noncopy_variants_2B_psize_dep:
// -------------------------------------------------------------- 4-B / 32-b
copy_variants_4B:
"32-bit unsigned integer ", U32, u32,
"32-bit signed integer", I32, i32,
"32-bit floating-point number", F32, f32,
"4-Byte array of bytes", ByteArray4B, [u8; 4],
"4-Byte char ", Char, char,
copy_variants_4B_dep:
copy_variants_4B_psize:
"32-bit usize", Usize, usize, target_pointer_width = "32",
"32-bit isize", Isize, isize, target_pointer_width = "32",
copy_variants_4B_psize_dep:
noncopy_variants_4B:
noncopy_variants_4B_dep:
noncopy_variants_4B_psize:
noncopy_variants_4B_psize_dep:
// -------------------------------------------------------------- 8-B / 64-b
copy_variants_8B:
"64-bit unsigned integer ", U64, u64,
"64-bit signed integer", I64, i64,
"64-bit floating-point number", F64, f64,
"8-Byte array of bytes", ByteArray8B, [u8; 8],
copy_variants_8B_dep:
copy_variants_8B_psize:
"64-bit usize", Usize, usize, target_pointer_width = "64",
"64-bit isize", Isize, isize, target_pointer_width = "64",
copy_variants_8B_psize_dep:
noncopy_variants_8B:
noncopy_variants_8B_dep:
noncopy_variants_8B_psize:
noncopy_variants_8B_psize_dep:
"6-Byte fat-pointer String", String, crate::String,
target_pointer_width = "16", "alloc", "alloc",
// ------------------------------------------------------------- 16-B /128-b
copy_variants_16B:
"128-bit unsigned integer ", U128, u128,
"128-bit signed integer", I128, i128,
"16-Byte array of bytes", ByteArray16B, [u8; 16],
"128-bit Duration", Duration, crate::Duration,
copy_variants_16B_dep:
// "128-bit floating-point number", F128, ::core::f128, "nightly_float", "nightly_float",
"128-bit SystemInstant", SystemInstant, crate::SystemInstant, "std", "std",
"128-bit SystemTime", SystemTime, crate::SystemTime, "std", "std",
copy_variants_16B_psize:
"128-bit usize", Usize, usize, target_pointer_width = "128",
"128-bit isize", Isize, isize, target_pointer_width = "128",
copy_variants_16B_psize_dep:
noncopy_variants_16B:
noncopy_variants_16B_dep:
noncopy_variants_16B_psize:
noncopy_variants_16B_psize_dep:
"12-Byte fat-pointer String", String, crate::String,
target_pointer_width = "32", "alloc", "alloc",
// ------------------------------------------------------------ 32-B / 256-b
copy_variants_32B:
"32-Byte array of bytes", ByteArray32B, [u8; 32],
copy_variants_32B_dep:
copy_variants_32B_psize:
copy_variants_32B_psize_dep:
noncopy_variants_32B:
noncopy_variants_32B_dep:
noncopy_variants_32B_psize:
noncopy_variants_32B_psize_dep:
"24-Byte fat-pointer String", String, crate::String,
target_pointer_width = "64", "alloc", "alloc",
// ------------------------------------------------------------ 64 B / 512-b
copy_variants_64B:
"64-Byte array of bytes", ByteArray64B, [u8; 64],
copy_variants_64B_dep:
copy_variants_64B_psize:
copy_variants_64B_psize_dep:
noncopy_variants_64B:
noncopy_variants_64B_dep:
noncopy_variants_64B_psize:
noncopy_variants_64B_psize_dep:
"48-Byte fat-pointer String", String, crate::String,
target_pointer_width = "128", "alloc", "alloc",
// ---------------------------------------------------------- 128-B / 1024-b
copy_variants_128B:
"128-Byte array of bytes", ByteArray128B, [u8; 128],
copy_variants_128B_dep:
copy_variants_128B_psize:
copy_variants_128B_psize_dep:
noncopy_variants_128B:
noncopy_variants_128B_dep:
noncopy_variants_128B_psize:
noncopy_variants_128B_psize_dep:
}