Property by name. Returns `None` if the property doesn't exist.
(&self, name: &str)
| 1723 | /// |
| 1724 | /// Returns `None` if the property doesn't exist. |
| 1725 | pub fn get(&self, name: &str) -> Option<CstObjectProp> { |
| 1726 | for child in &self.0.borrow().value { |
| 1727 | if let CstNode::Container(CstContainerNode::ObjectProp(prop)) = child { |
| 1728 | let Some(prop_name) = prop.name() else { |
| 1729 | continue; |
| 1730 | }; |
| 1731 | let Ok(prop_name_str) = prop_name.decoded_value() else { |
| 1732 | continue; |
| 1733 | }; |
| 1734 | if prop_name_str == name { |
| 1735 | return Some(prop.clone()); |
| 1736 | } |
| 1737 | } |
| 1738 | } |
| 1739 | None |
| 1740 | } |
| 1741 | |
| 1742 | /// Properties of the object. |
| 1743 | pub fn properties(&self) -> Vec<CstObjectProp> { |