oxedyne/fe2o3/fe2o3_jdat/src/conv.rs
14.2 KiB, 46 runs
created by r1870400018:461, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | use crate::{ |
| 2 | prelude::*, |
| 3 | int::DatInt, |
| 4 | usr::UsrKindId, |
| 5 | }; |
| 6 | |
| 7 | use oxedyne_fe2o3_core::{ |
| 8 | prelude::*, |
| 9 | }; |
| 10 | use oxedyne_fe2o3_num::{ |
| 11 | float::{ |
| 12 | Float32, |
| 13 | Float64, |
| 14 | }, |
| 15 | }; |
| 16 | |
| 17 | use std::{ |
| 18 | collections::BTreeMap, |
| 19 | convert::TryFrom, |
| 20 | time::Duration, |
| 21 | }; |
| 22 | |
| 23 | use bigdecimal::BigDecimal; |
| 24 | use num_bigint::BigInt; |
| 25 | |
| 26 | |
| 27 | pub trait FromDatMap : Default { |
| 28 | fn from_datmap(map: DaticleMap) -> Outcome<Self>; |
| 29 | } |
| 30 | |
| 31 | pub trait ToDatMap : Default { |
| 32 | fn to_datmap(input_struct: Self) -> Dat; |
| 33 | } |
| 34 | |
| 35 | pub trait ToDat { |
| 36 | fn to_dat(&self) -> Outcome<Dat>; |
| 37 | } |
| 38 | |
| 39 | pub trait IntoDat: ToDat { |
| 40 | fn into_dat(self) -> Outcome<Dat> where Self: Sized { |
| 41 | self.to_dat() |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | pub trait FromDat { |
| 46 | fn from_dat(dat: Dat) -> Outcome<Self> where Self: Sized; |
| 47 | } |
| 48 | |
| 49 | impl AsRef<Dat> for &Dat { |
| 50 | fn as_ref(&self) -> &Dat { |
| 51 | *self |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | impl ToDat for Dat { |
| 56 | fn to_dat(&self) -> Outcome<Dat> { |
| 57 | Ok(self.clone()) |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | impl FromDat for Dat { |
| 62 | fn from_dat(dat: Dat) -> Outcome<Self> { |
| 63 | Ok(dat) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // From, ToDat and FromDat conversions for native and fundamental types. |
| 68 | // |
| 69 | // Atomic Kinds =========================== |
| 70 | // Logic |
| 71 | to_from_dat! { bool, Bool } |
| 72 | // Fixed |
| 73 | to_from_dat! { u8, U8 } |
| 74 | to_from_dat! { u16, U16 } |
| 75 | to_from_dat! { u32, U32 } |
| 76 | to_from_dat! { u64, U64 } |
| 77 | to_from_dat! { u128, U128 } |
| 78 | to_from_dat! { i8, I8 } |
| 79 | to_from_dat! { i16, I16 } |
| 80 | to_from_dat! { i32, I32 } |
| 81 | to_from_dat! { i64, I64 } |
| 82 | to_from_dat! { i128, I128 } |
| 83 | to_from_dat! { Float32, F32 } |
| 84 | to_from_dat! { Float64, F64 } |
| 85 | // Variable |
| 86 | to_from_dat! { BigInt, Aint } |
| 87 | to_from_dat! { BigDecimal, Adec } |
| 88 | to_from_dat! { String, Str } |
| 89 | // Molecule Kinds ========================= |
| 90 | // Unitary |
| 91 | // Heterogenous |
| 92 | to_from_dat! { Vec<Dat>, List } |
| 93 | to_from_dat_boxed! { [Dat; 2], Tup2 } |
| 94 | to_from_dat_boxed! { [Dat; 3], Tup3 } |
| 95 | to_from_dat_boxed! { [Dat; 4], Tup4 } |
| 96 | to_from_dat_boxed! { [Dat; 5], Tup5 } |
| 97 | to_from_dat_boxed! { [Dat; 6], Tup6 } |
| 98 | to_from_dat_boxed! { [Dat; 7], Tup7 } |
| 99 | to_from_dat_boxed! { [Dat; 8], Tup8 } |
| 100 | to_from_dat_boxed! { [Dat; 9], Tup9 } |
| 101 | to_from_dat_boxed! { [Dat; 10], Tup10 } |
| 102 | // Homogenous |
| 103 | // Variable length bytes |
| 104 | to_from_dat! { Vec<u8>, BU64 } |
| 105 | // Fixed length bytes |
| 106 | to_from_dat! { [u8; 2], B2 } |
| 107 | to_from_dat! { [u8; 3], B3 } |
| 108 | to_from_dat! { [u8; 4], B4 } |
| 109 | to_from_dat! { [u8; 5], B5 } |
| 110 | to_from_dat! { [u8; 6], B6 } |
| 111 | to_from_dat! { [u8; 7], B7 } |
| 112 | to_from_dat! { [u8; 8], B8 } |
| 113 | to_from_dat! { [u8; 9], B9 } |
| 114 | to_from_dat! { [u8; 10], B10 } |
| 115 | to_from_dat! { [u8; 16], B16 } |
| 116 | to_from_dat! { B32, B32 } |
| 117 | impl From<[u8; 32]> for Dat { |
| 118 | fn from(x: [u8; 32]) -> Self { |
| 119 | Dat::B32(B32(x)) |
| 120 | } |
| 121 | } |
| 122 | // Fixed length numbers |
| 123 | |
| 124 | to_from_dat! { [u16; 2], Tup2u16 } |
| 125 | to_from_dat! { [u16; 3], Tup3u16 } |
| 126 | to_from_dat! { [u16; 4], Tup4u16 } |
| 127 | to_from_dat! { [u16; 5], Tup5u16 } |
| 128 | to_from_dat! { [u16; 6], Tup6u16 } |
| 129 | to_from_dat! { [u16; 7], Tup7u16 } |
| 130 | to_from_dat! { [u16; 8], Tup8u16 } |
| 131 | to_from_dat! { [u16; 9], Tup9u16 } |
| 132 | to_from_dat! { [u16; 10], Tup10u16 } |
| 133 | |
| 134 | to_from_dat! { [u32; 2], Tup2u32 } |
| 135 | to_from_dat! { [u32; 3], Tup3u32 } |
| 136 | to_from_dat! { [u32; 4], Tup4u32 } |
| 137 | to_from_dat! { [u32; 5], Tup5u32 } |
| 138 | to_from_dat! { [u32; 6], Tup6u32 } |
| 139 | to_from_dat! { [u32; 7], Tup7u32 } |
| 140 | to_from_dat! { [u32; 8], Tup8u32 } |
| 141 | to_from_dat! { [u32; 9], Tup9u32 } |
| 142 | to_from_dat! { [u32; 10], Tup10u32 } |
| 143 | |
| 144 | to_from_dat! { [u64; 2], Tup2u64 } |
| 145 | to_from_dat! { [u64; 3], Tup3u64 } |
| 146 | to_from_dat! { [u64; 4], Tup4u64 } |
| 147 | to_from_dat! { [u64; 5], Tup5u64 } |
| 148 | to_from_dat! { [u64; 6], Tup6u64 } |
| 149 | to_from_dat! { [u64; 7], Tup7u64 } |
| 150 | to_from_dat! { [u64; 8], Tup8u64 } |
| 151 | to_from_dat! { [u64; 9], Tup9u64 } |
| 152 | to_from_dat! { [u64; 10], Tup10u64 } |
| 153 | |
| 154 | to_from_dat! { [i8; 2], Tup2i8 } |
| 155 | to_from_dat! { [i8; 3], Tup3i8 } |
| 156 | to_from_dat! { [i8; 4], Tup4i8 } |
| 157 | to_from_dat! { [i8; 5], Tup5i8 } |
| 158 | to_from_dat! { [i8; 6], Tup6i8 } |
| 159 | to_from_dat! { [i8; 7], Tup7i8 } |
| 160 | to_from_dat! { [i8; 8], Tup8i8 } |
| 161 | to_from_dat! { [i8; 9], Tup9i8 } |
| 162 | to_from_dat! { [i8; 10], Tup10i8 } |
| 163 | |
| 164 | to_from_dat! { [i16; 2], Tup2i16 } |
| 165 | to_from_dat! { [i16; 3], Tup3i16 } |
| 166 | to_from_dat! { [i16; 4], Tup4i16 } |
| 167 | to_from_dat! { [i16; 5], Tup5i16 } |
| 168 | to_from_dat! { [i16; 6], Tup6i16 } |
| 169 | to_from_dat! { [i16; 7], Tup7i16 } |
| 170 | to_from_dat! { [i16; 8], Tup8i16 } |
| 171 | to_from_dat! { [i16; 9], Tup9i16 } |
| 172 | to_from_dat! { [i16; 10], Tup10i16 } |
| 173 | |
| 174 | to_from_dat! { [i32; 2], Tup2i32 } |
| 175 | to_from_dat! { [i32; 3], Tup3i32 } |
| 176 | to_from_dat! { [i32; 4], Tup4i32 } |
| 177 | to_from_dat! { [i32; 5], Tup5i32 } |
| 178 | to_from_dat! { [i32; 6], Tup6i32 } |
| 179 | to_from_dat! { [i32; 7], Tup7i32 } |
| 180 | to_from_dat! { [i32; 8], Tup8i32 } |
| 181 | to_from_dat! { [i32; 9], Tup9i32 } |
| 182 | to_from_dat! { [i32; 10], Tup10i32 } |
| 183 | |
| 184 | to_from_dat! { [i64; 2], Tup2i64 } |
| 185 | to_from_dat! { [i64; 3], Tup3i64 } |
| 186 | to_from_dat! { [i64; 4], Tup4i64 } |
| 187 | to_from_dat! { [i64; 5], Tup5i64 } |
| 188 | to_from_dat! { [i64; 6], Tup6i64 } |
| 189 | to_from_dat! { [i64; 7], Tup7i64 } |
| 190 | to_from_dat! { [i64; 8], Tup8i64 } |
| 191 | to_from_dat! { [i64; 9], Tup9i64 } |
| 192 | to_from_dat! { [i64; 10], Tup10i64 } |
| 193 | |
| 194 | impl From<Vec<String>> for Dat { |
| 195 | fn from(v: Vec<String>) -> Self { |
| 196 | let mut vd = Vec::new(); |
| 197 | for d in v { |
| 198 | vd.push(dat!(d)); |
| 199 | } |
| 200 | Dat::Vek(Vek(vd)) |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | // Conversions for standard library compound types. |
| 205 | |
| 206 | impl ToDat for Duration { |
| 207 | fn to_dat(&self) -> Outcome<Dat> { |
| 208 | Ok(Dat::U64(self.as_nanos() as u64)) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | impl FromDat for Duration { |
| 213 | fn from_dat(dat: Dat) -> Outcome<Self> { |
| 214 | Ok(Self::from_nanos(try_extract_dat!(dat, U64))) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | best_from_int_to_dat! { u8 } |
| 219 | best_from_int_to_dat! { u16 } |
| 220 | best_from_int_to_dat! { u32 } |
| 221 | best_from_int_to_dat! { u64 } |
| 222 | best_from_int_to_dat! { u128 } |
| 223 | best_from_int_to_dat! { i8 } |
| 224 | best_from_int_to_dat! { i16 } |
| 225 | best_from_int_to_dat! { i32 } |
| 226 | best_from_int_to_dat! { i64 } |
| 227 | best_from_int_to_dat! { i128 } |
| 228 | |
| 229 | // The BestFrom trait defaults to From, so implement this default for all the following types. |
| 230 | // Atomic Kinds =========================== |
| 231 | // Logic |
| 232 | impl BestFrom<bool> for Dat {} |
| 233 | // Fixed |
| 234 | impl BestFrom<Float32> for Dat {} |
| 235 | impl BestFrom<Float64> for Dat {} |
| 236 | // Variable |
| 237 | impl BestFrom<BigInt> for Dat {} |
| 238 | impl BestFrom<BigDecimal> for Dat {} |
| 239 | impl BestFrom<String> for Dat {} |
| 240 | // Molecule Kinds ========================= |
| 241 | // Unitary |
| 242 | // Heterogenous |
| 243 | impl BestFrom<Vec<Dat>> for Dat {} |
| 244 | impl BestFrom<[Dat; 2]> for Dat {} |
| 245 | impl BestFrom<[Dat; 3]> for Dat {} |
| 246 | impl BestFrom<[Dat; 4]> for Dat {} |
| 247 | impl BestFrom<[Dat; 5]> for Dat {} |
| 248 | impl BestFrom<[Dat; 6]> for Dat {} |
| 249 | impl BestFrom<[Dat; 7]> for Dat {} |
| 250 | impl BestFrom<[Dat; 8]> for Dat {} |
| 251 | impl BestFrom<[Dat; 9]> for Dat {} |
| 252 | impl BestFrom<[Dat; 10]> for Dat {} |
| 253 | // Homogenous |
| 254 | // Variable length bytes |
| 255 | impl BestFrom<Vec<u8>> for Dat {} |
| 256 | // Fixed length bytes |
| 257 | impl BestFrom<[u8; 2]> for Dat {} |
| 258 | impl BestFrom<[u8; 3]> for Dat {} |
| 259 | impl BestFrom<[u8; 4]> for Dat {} |
| 260 | impl BestFrom<[u8; 5]> for Dat {} |
| 261 | impl BestFrom<[u8; 6]> for Dat {} |
| 262 | impl BestFrom<[u8; 7]> for Dat {} |
| 263 | impl BestFrom<[u8; 8]> for Dat {} |
| 264 | impl BestFrom<[u8; 9]> for Dat {} |
| 265 | impl BestFrom<[u8; 10]> for Dat {} |
| 266 | impl BestFrom<[u8; 16]> for Dat {} |
| 267 | impl BestFrom<B32> for Dat {} |
| 268 | impl BestFrom<[u8; 32]> for Dat {} |
| 269 | // Fixed length numbers |
| 270 | impl BestFrom<[u16; 2]> for Dat {} |
| 271 | impl BestFrom<[u16; 3]> for Dat {} |
| 272 | impl BestFrom<[u16; 4]> for Dat {} |
| 273 | impl BestFrom<[u16; 5]> for Dat {} |
| 274 | impl BestFrom<[u16; 6]> for Dat {} |
| 275 | impl BestFrom<[u16; 7]> for Dat {} |
| 276 | impl BestFrom<[u16; 8]> for Dat {} |
| 277 | impl BestFrom<[u16; 9]> for Dat {} |
| 278 | impl BestFrom<[u16; 10]> for Dat {} |
| 279 | |
| 280 | impl BestFrom<[u32; 2]> for Dat {} |
| 281 | impl BestFrom<[u32; 3]> for Dat {} |
| 282 | impl BestFrom<[u32; 4]> for Dat {} |
| 283 | impl BestFrom<[u32; 5]> for Dat {} |
| 284 | impl BestFrom<[u32; 6]> for Dat {} |
| 285 | impl BestFrom<[u32; 7]> for Dat {} |
| 286 | impl BestFrom<[u32; 8]> for Dat {} |
| 287 | impl BestFrom<[u32; 9]> for Dat {} |
| 288 | impl BestFrom<[u32; 10]> for Dat {} |
| 289 | |
| 290 | impl BestFrom<[u64; 2]> for Dat {} |
| 291 | impl BestFrom<[u64; 3]> for Dat {} |
| 292 | impl BestFrom<[u64; 4]> for Dat {} |
| 293 | impl BestFrom<[u64; 5]> for Dat {} |
| 294 | impl BestFrom<[u64; 6]> for Dat {} |
| 295 | impl BestFrom<[u64; 7]> for Dat {} |
| 296 | impl BestFrom<[u64; 8]> for Dat {} |
| 297 | impl BestFrom<[u64; 9]> for Dat {} |
| 298 | impl BestFrom<[u64; 10]> for Dat {} |
| 299 | |
| 300 | impl From<()> for Dat { |
| 301 | fn from(_: ()) -> Self { |
| 302 | Self::Empty |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | impl BestFrom<()> for Dat {} |
| 307 | |
| 308 | impl TryFrom<usize> for Dat { |
| 309 | type Error = Error<ErrTag>; |
| 310 | |
| 311 | fn try_from(n: usize) -> std::result::Result<Self, Self::Error> { |
| 312 | Ok(match std::mem::size_of::<usize>() { |
| 313 | 1 => Self::U8(n as u8), |
| 314 | 2 => Self::U16(n as u16), |
| 315 | 4 => Self::U32(n as u32), |
| 316 | 8 => Self::U64(n as u64), |
| 317 | 16 => Self::U128(n as u128), |
| 318 | s => return Err(err!( |
| 319 | "The usize for this machine is {}, which has not yet been \ |
| 320 | mapped to a daticle kind.", s; |
| 321 | System, Unimplemented)), |
| 322 | }) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | impl TryFrom<isize> for Dat { |
| 327 | type Error = Error<ErrTag>; |
| 328 | |
| 329 | fn try_from(n: isize) -> std::result::Result<Self, Self::Error> { |
| 330 | Ok(match std::mem::size_of::<isize>() { |
| 331 | 1 => Self::I8(n as i8), |
| 332 | 2 => Self::I16(n as i16), |
| 333 | 4 => Self::I32(n as i32), |
| 334 | 8 => Self::I64(n as i64), |
| 335 | 16 => Self::I128(n as i128), |
| 336 | s => return Err(err!( |
| 337 | "The isize for this machine is {}, which has not yet been \ |
| 338 | mapped to a daticle kind.", s; |
| 339 | System, Unimplemented)), |
| 340 | }) |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | impl From<f32> for Dat { |
| 345 | fn from(f: f32) -> Self { |
| 346 | Self::F32(Float32(f)) |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | impl BestFrom<f32> for Dat {} |
| 351 | |
| 352 | impl From<f64> for Dat { |
| 353 | fn from(f: f64) -> Self { |
| 354 | Self::F64(Float64(f)) |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | impl BestFrom<f64> for Dat {} |
| 359 | |
| 360 | impl<'a> From<&'a [u8]> for Dat { |
| 361 | fn from(v: &'a [u8]) -> Self { |
| 362 | Self::BU64(v.to_vec()) |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | impl<'a> BestFrom<&'a [u8]> for Dat {} |
| 367 | |
| 368 | impl<'a> From<&'a str> for Dat { |
| 369 | fn from(s: &'a str) -> Self { |
| 370 | Self::Str(s.to_string()) |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | impl<'a> BestFrom<&'a str> for Dat {} |
| 375 | |
| 376 | impl<D: Into<Dat>> From<Box<D>> for Dat { |
| 377 | fn from(v: Box<D>) -> Self { |
| 378 | Self::Box(Box::new((*v).into())) |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | impl<D: Into<Dat>> BestFrom<Box<D>> for Dat {} |
| 383 | |
| 384 | impl<D: Into<Dat>> From<Option<D>> for Dat { |
| 385 | fn from(v: Option<D>) -> Self { |
| 386 | match v { |
| 387 | Some(d) => Self::Opt(Box::new(Some(d.into()))), |
| 388 | None => Self::Opt(Box::new(None)), |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | impl<D: Into<Dat>> BestFrom<Option<D>> for Dat {} |
| 394 | |
| 395 | impl TryFrom<Dat> for Vec<String> { |
| 396 | type Error = Error<ErrTag>; |
| 397 | |
| 398 | fn try_from(dat: Dat) -> Result<Self, Self::Error> { |
| 399 | dat.get_string_list().ok_or(err!( |
| 400 | "Daticle '{:?}' is not a list or vek of strings.", dat; |
| 401 | Conversion, String)) |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | impl<'a> TryFrom<&'a Dat> for Vec<String> { |
| 406 | type Error = Error<ErrTag>; |
| 407 | |
| 408 | fn try_from(dat: &'a Dat) -> Result<Self, Self::Error> { |
| 409 | dat.get_string_list().ok_or(err!( |
| 410 | "Daticle '{:?}' is not a list or vek of strings.", dat; |
| 411 | Conversion, String)) |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | impl TryFrom<(UsrKindId, Option<Dat>)> for Dat { |
| 416 | type Error = Error<ErrTag>; |
| 417 | |
| 418 | fn try_from((ukid, optd): (UsrKindId, Option<Dat>)) -> std::result::Result<Self, Self::Error> { |
| 419 | let ok = match &optd { |
| 420 | Some(dat) => match ukid.kind() { |
| 421 | Some(kind) => if dat.kind() == **kind { true } else { false }, |
| 422 | None => false, |
| 423 | }, |
| 424 | None => match ukid.kind() { |
| 425 | Some(_kind) => false, |
| 426 | None => true, |
| 427 | }, |
| 428 | }; |
| 429 | if !ok { |
| 430 | return Err(err!( |
| 431 | "Usr daticle requires kind {:?} but {:?} received.", |
| 432 | ukid.kind(), optd; |
| 433 | Input, Invalid, Mismatch)); |
| 434 | } |
| 435 | Ok(Self::Usr(ukid, match optd { |
| 436 | None => None, |
| 437 | Some(dat) => Some(Box::new(dat)), |
| 438 | })) |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | impl TryFrom<Vec<Dat>> for Vek { |
| 443 | type Error = Error<ErrTag>; |
| 444 | |
| 445 | fn try_from(v: Vec<Dat>) -> std::result::Result<Self, Self::Error> { |
| 446 | if v.len() > 1 { |
| 447 | let kind = v[0].kind(); |
| 448 | let mut count: usize = 2; |
| 449 | for d in v.iter().skip(1) { |
| 450 | if !d.kind().equals(&kind) { |
| 451 | return Err(err!( |
| 452 | "Cannot construct a Vek from the given Vec because the \ |
| 453 | kind of item {}, {:?} differs from the kind, {:?} of the \ |
| 454 | first item.", count, d.kind(), kind; |
| 455 | Input, Invalid, Mismatch)); |
| 456 | } |
| 457 | count += 1; |
| 458 | } |
| 459 | } |
| 460 | Ok(Self(v)) |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | impl< |
| 465 | K: Into<Dat>, |
| 466 | V: Into<Dat>, |
| 467 | > |
| 468 | From<BTreeMap<K, V>> for Dat |
| 469 | { |
| 470 | fn from(v: BTreeMap<K, V>) -> Self { |
| 471 | let mut map = DaticleMap::new(); |
| 472 | for (key, val) in v { |
| 473 | map.insert(key.into(), val.into()); |
| 474 | } |
| 475 | Self::Map(map) |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | impl Dat { |
| 480 | |
| 481 | // Used in FromDatMap |
| 482 | enum_getter! { get_bool, bool, Bool } |
| 483 | enum_getter! { get_bigint, BigInt, Aint } |
| 484 | enum_getter! { get_bigdecimal, BigDecimal, Adec } |
| 485 | enum_getter! { get_string, String, Str } |
| 486 | enum_getter! { get_bytes, Vec<u8>, BU64 } |
| 487 | // TODO B256?? |
| 488 | enum_getter! { get_list, Vec<Dat>, List } |
| 489 | enum_getter! { get_map, DaticleMap, Map } |
| 490 | enum_getter! { get_box, Box<Dat>, Box } |
| 491 | enum_getter! { get_box_opt, Box<Option<Dat>>, Opt } |
| 492 | |
| 493 | enum_getter_numeric! { get_u8, u8 } |
| 494 | enum_getter_numeric! { get_u16, u16 } |
| 495 | enum_getter_numeric! { get_u32, u32 } |
| 496 | enum_getter_numeric! { get_u64, u64 } |
| 497 | enum_getter_numeric! { get_u128, u128 } |
| 498 | enum_getter_numeric! { get_i8, i8 } |
| 499 | enum_getter_numeric! { get_i16, i16 } |
| 500 | enum_getter_numeric! { get_i32, i32 } |
| 501 | enum_getter_numeric! { get_i64, i64 } |
| 502 | enum_getter_numeric! { get_i128, i128 } |
| 503 | enum_getter_numeric! { get_float32, Float32 } |
| 504 | enum_getter_numeric! { get_float64, Float64 } |
| 505 | } |
| 506 | |
| 507 |