#[non_exhaustive]pub enum RenderableTreeNodes {
One(RenderableTreeNode),
Many(Vec<RenderableTreeNode>),
}Expand description
What a transform hook returns: one node, or a list of them.
Upstream’s RenderableTreeNodes = RenderableTreeNode | RenderableTreeNode[],
and the plural matters. A schema with no render transforms to its children
rather than to an element, so “this node became three nodes” has to be
expressible; and a slot rendered into an attribute is a list of nodes,
which the conformance corpus compares as a JSON array rather than as a
single value. Flattening the two would change the tree the corpus grades.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
One(RenderableTreeNode)
Exactly one node.
Many(Vec<RenderableTreeNode>)
Zero or more, in document order.
Implementations§
Source§impl RenderableTreeNodes
impl RenderableTreeNodes
Sourcepub fn into_vec(self) -> Vec<RenderableTreeNode>
pub fn into_vec(self) -> Vec<RenderableTreeNode>
The nodes as a list, whichever shape they arrived in.
This is upstream’s flatMap over a MaybeArray, which every consumer
that appends to a child list needs and which is easy to get wrong by
pushing a Many in as one child.
Trait Implementations§
Source§impl Clone for RenderableTreeNodes
impl Clone for RenderableTreeNodes
Source§fn clone(&self) -> RenderableTreeNodes
fn clone(&self) -> RenderableTreeNodes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more