MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / elements

Method elements

src/cst/mod.rs:2096–2117  ·  view source on GitHub ↗

Elements of the array.

(&self)

Source from the content-addressed store, hash-verified

2094
2095 /// Elements of the array.
2096 pub fn elements(&self) -> Vec<CstNode> {
2097 self
2098 .0
2099 .borrow()
2100 .value
2101 .iter()
2102 .filter(|child| match child {
2103 CstNode::Container(_) => true,
2104 CstNode::Leaf(leaf) => match leaf {
2105 CstLeafNode::BooleanLit(_)
2106 | CstLeafNode::NullKeyword(_)
2107 | CstLeafNode::NumberLit(_)
2108 | CstLeafNode::StringLit(_)
2109 | CstLeafNode::WordLit(_) => true,
2110 CstLeafNode::Token(_) | CstLeafNode::Whitespace(_) | CstLeafNode::Newline(_) | CstLeafNode::Comment(_) => {
2111 false
2112 }
2113 },
2114 })
2115 .cloned()
2116 .collect()
2117 }
2118
2119 /// Appends an element to the end of the array.
2120 ///

Callers 8

element_indexMethod · 0.80
set_trailing_commasMethod · 0.80
insert_or_appendMethod · 0.80
to_serde_valueMethod · 0.80
uses_trailing_commasFunction · 0.80
run_testFunction · 0.80
element_indexFunction · 0.80

Calls 1

iterMethod · 0.80