Gets the root value if it's an object or sets the root value as an object. Note: Use `.array_value_or_create()` to not overwrite the root value when it's not an object.
(&self)
| 1268 | /// Note: Use `.array_value_or_create()` to not overwrite the root value |
| 1269 | /// when it's not an object. |
| 1270 | pub fn array_value_or_set(&self) -> CstArray { |
| 1271 | match self.value() { |
| 1272 | Some(CstNode::Container(CstContainerNode::Array(node))) => node, |
| 1273 | _ => { |
| 1274 | self.set_value(CstInputValue::Array(Vec::new())); |
| 1275 | self.array_value().unwrap() |
| 1276 | } |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | /// Ensures this object's values use trailing commas. |
| 1281 | /// |