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
use std::borrow::Cow;

/// The base store for [`Value`](crate::value::Value). All values must support storing and retrieving data as one of these types.
#[derive(PartialEq)]
pub enum BaseValue {
  String(String),
  Boolean(bool),
  Float(f64),
}

impl From<String> for BaseValue {
    fn from(s: String) -> Self {
      BaseValue::String(s)
    }
}

impl From<Cow<'static, str>> for BaseValue {
  fn from(s: Cow<'static, str>) -> Self {
    BaseValue::String(s.into_owned())
  }
}

impl From<bool> for BaseValue {
    fn from(b: bool) -> Self {
      BaseValue::Boolean(b)
    }
}

impl From<f64> for BaseValue {
    fn from(float: f64) -> Self {
      BaseValue::Float(float)
    }
}