jss_core/schema/traits/
debug.rs1use super::*;
2
3impl Debug for JssSchema {
4 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
5 let w = &mut match self.kind {
6 JssKind::Scheme => f.debug_struct("JssScheme"),
7 JssKind::Property | JssKind::PropertyTop => f.debug_struct("JssProperty"),
8 JssKind::Definition => f.debug_struct("JssDefinition"),
9 };
10 w.field("type", &self.typing);
11 if let JssKind::Scheme = &self.kind {
12 w.field("definitions", &self.definition);
13 }
14 w.field("attributes", &self.attribute);
15 w.field("properties", &self.property);
16 w.finish()
17 }
18}
19
20impl Debug for JssValue {
21 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
22 match self {
23 Self::Null => f.write_str("null"),
24 Self::Boolean(v) => Debug::fmt(v, f),
25 Self::Number(v) => Display::fmt(v, f),
26 Self::String(v) => Debug::fmt(v, f),
27 Self::Url(v) => f.write_str(v),
28 Self::Regex(v) => f.write_str(v),
29 Self::Array(v) => Debug::fmt(v, f),
30 Self::Object(v) => Debug::fmt(v, f),
31 }
32 }
33}
34
35impl Debug for JssComplexType {
36 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
37 let w = &mut f.debug_struct("string");
38 if !self.pattern.is_empty() {
39 w.field("pattern", &self.pattern);
40 }
41 w.finish()
42 }
43}