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
use std::collections::HashMap; use crate::json::JsValue; use super::SchemaNode; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ArrayNode { pub items: Box<SchemaNode>, #[serde(flatten)] pub extra: HashMap<String, JsValue>, } impl ArrayNode { pub fn new<S: Into<SchemaNode>>(items: S) -> Self { let items = Box::new(items.into()); Self { items, extra: hashmap! {}, } } } impl_extra_props!(ArrayNode, extra);