jss_core/schema/typing/
mod.rs1use super::*;
2
3impl From<String> for JssType {
4 fn from(s: String) -> Self {
5 JssType::from(s.as_str())
6 }
7}
8
9impl From<&str> for JssType {
10 fn from(s: &str) -> Self {
11 match s {
12 "object" => JssType::Object,
13 "integer" => JssType::Integer,
14 "number" => JssType::Number,
15 "string" => JssType::String,
16 "array" => JssType::Array,
17 _ => JssType::Reference(s.to_string()),
18 }
19 }
20}
21
22impl Default for JssComplexType {
23 fn default() -> Self {
24 Self { pattern: JssValue::string("") }
25 }
26}
27
28impl From<JssComplexType> for JssType {
29 fn from(v: JssComplexType) -> Self {
30 Self::Complex(Box::new(v))
31 }
32}