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
use std::{collections::HashMap, convert::TryFrom, error::Error};
use crate::object::Object;
#[derive(Clone, Debug)]
pub enum Value {
Bool(bool),
UInt8(u8),
Int8(i8),
UInt16(u16),
Int16(i16),
UInt32(u32),
Int32(i32),
UInt64(u64),
Int64(i64),
Float(f32),
Double(f64),
Str(String),
Obj(Object),
Array(Vec<Value>),
Dict(HashMap<Value, Value>),
}
impl TryFrom<Object> for Value {
type Error = Box<dyn Error>;
fn try_from(object: Object) -> Result<Self, Self::Error> {
Ok(Value::Bool(false))
}
}