Gets or creates the root value as an object, returns `Some` if successful or `None` if the root value already exists and is not an object. Note: Use `.array_value_or_set()` to overwrite the root value when it's not an array.
(&self)
| 1253 | /// Note: Use `.array_value_or_set()` to overwrite the root value when |
| 1254 | /// it's not an array. |
| 1255 | pub fn array_value_or_create(&self) -> Option<CstArray> { |
| 1256 | match self.value() { |
| 1257 | Some(CstNode::Container(CstContainerNode::Array(node))) => Some(node), |
| 1258 | Some(_) => None, |
| 1259 | None => { |
| 1260 | self.set_value(CstInputValue::Array(Vec::new())); |
| 1261 | self.array_value() |
| 1262 | } |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | /// Gets the root value if it's an object or sets the root value as an object. |
| 1267 | /// |