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
use super::*;
impl From<String> for JssType {
fn from(s: String) -> Self {
JssType::from(s.as_str())
}
}
impl From<&str> for JssType {
fn from(s: &str) -> Self {
match s {
"object" => JssType::Object,
"integer" => JssType::Integer,
"number" => JssType::Number,
"string" => JssType::String,
"array" => JssType::Array,
_ => JssType::Reference(s.to_string()),
}
}
}
impl Default for JssComplexType {
fn default() -> Self {
Self { pattern: JssValue::string("") }
}
}
impl From<JssComplexType> for JssType {
fn from(v: JssComplexType) -> Self {
Self::Complex(Box::new(v))
}
}