pub struct Schema {
pub render: Option<Value>,
pub children: Option<Value>,
pub attributes: Option<IndexMap<String, SchemaAttribute>>,
pub slots: Option<IndexMap<String, SchemaSlot>>,
pub self_closing: bool,
pub inline: Option<Value>,
pub transform: Option<TransformFn>,
pub validate: Option<ValidateFn>,
pub description: Option<String>,
}Expand description
Upstream’s Schema.
Fields§
§render: Option<Value>render: the name of the tag the node renders as (new Tag(schema.render, ...),
whatever value it is: a config read from JSON can give a number or an object); None
for none or a falsy one (the node renders its children).
children: Option<Value>children: what schema.children.includes(type) searches (an array’s items, a
string’s text: see Schema::allows_child); None for none or a falsy one.
attributes: Option<IndexMap<String, SchemaAttribute>>{...globalAttributes, ...schema.attributes}‘s part: the attributes’ schemas by name.
slots: Option<IndexMap<String, SchemaSlot>>§self_closing: bool§inline: Option<Value>inline: None is undefined or null (either placement is fine); any other value
is compared with the node’s by !== (so only true or false can ever match).
transform: Option<TransformFn>§validate: Option<ValidateFn>§description: Option<String>Implementations§
Source§impl Schema
impl Schema
Sourcepub fn allows_child(&self, child_type: &str) -> Option<Result<bool, String>>
pub fn allows_child(&self, child_type: &str) -> Option<Result<bool, String>>
schema.children.includes(type) (with schema.children truthy): an array’s
Array.prototype.includes (SameValueZero), a string’s String.prototype.includes (the
type a substring of it), V8’s TypeError: schema.children.includes is not a function
for any other value. None when the schema has no children.