mod collections;
mod methods;
mod traits;
mod typing;
pub use self::{collections::*, typing::ValueType};
use crate::nodes::Literal;
use indexmap::{IndexMap, IndexSet};
use num::{BigInt, BigUint};
use rust_decimal::Decimal;
use std::collections::{BTreeMap, BTreeSet};
pub type OrderedSet = IndexSet<Literal<Value>>;
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Value {
Null,
Boolean(bool),
Integer(BigInt),
Decimal(Decimal),
String(String),
Set(OrderedSet),
Array(Box<SparseArray>),
Object(Box<OrderedMap>),
}
impl Default for Value {
fn default() -> Self {
Self::Null
}
}
impl Value {
pub fn integer(value: impl Into<BigInt>) -> Self {
Self::Integer(value.into())
}
pub fn decimal(value: impl Into<Decimal>) -> Self {
Self::Decimal(value.into())
}
pub fn string(value: impl Into<String>) -> Self {
Self::String(value.into())
}
}