(&self, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's,'m>, mathml: Element<'c>)
| 863 | } |
| 864 | |
| 865 | pub fn replace_array_tree<'c, 's:'c, 'm:'c>(&self, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's,'m>, mathml: Element<'c>) -> Result<Element<'m>> { |
| 866 | // shortcut for common case (don't build a new tree node) |
| 867 | if self.replacements.len() == 1 { |
| 868 | return rules_with_context.replace::<Element<'m>>(&self.replacements[0], mathml); |
| 869 | } |
| 870 | |
| 871 | let new_element = create_mathml_element(&rules_with_context.doc, "Unknown"); // Hopefully set later (in Intent::Replace()) |
| 872 | let mut new_children = Vec::with_capacity(self.replacements.len()); |
| 873 | for child in self.replacements.iter() { |
| 874 | let child = rules_with_context.replace::<Element<'m>>(child, mathml)?; |
| 875 | new_children.push(ChildOfElement::Element(child)); |
| 876 | }; |
| 877 | new_element.append_children(new_children); |
| 878 | return Ok(new_element); |
| 879 | } |
| 880 | |
| 881 | |
| 882 | /// Return true if there are no replacements. |
no test coverage detected