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
// License: see LICENSE file at root directory of `master` branch

//! # Implementations for `Value`

use crate::{Number, Value};

macro_rules! impl_from_primitives_for_value { ($($ty: ty, $code: tt,)+) => {
    $(
        impl From<$ty> for Value {

            fn from(n: $ty) -> Self {
                Value::Number(Number {
                    inner: super::super::Inner::$code(n),
                })
            }

        }
    )+
}}

impl_from_primitives_for_value! {
    i8, I8, i16, I16, i32, I32, i64, I64, i128, I128, isize, ISize,
    u8, U8, u16, U16, u32, U32, u64, U64, u128, U128, usize, USize,
    f32, F32, f64, F64,
}