Maps the [`Transformed`] object to the result of the given `f` depending on the current [`TreeNodeRecursion`] value and the fact that `f` is changing the current node's children.
(
mut self,
f: F,
)
| 722 | /// current [`TreeNodeRecursion`] value and the fact that `f` is changing the current |
| 723 | /// node's children. |
| 724 | pub fn transform_children<F: FnOnce(T) -> Result<Transformed<T>>>( |
| 725 | mut self, |
| 726 | f: F, |
| 727 | ) -> Result<Transformed<T>> { |
| 728 | match self.tnr { |
| 729 | TreeNodeRecursion::Continue => { |
| 730 | return f(self.data).map(|mut t| { |
| 731 | t.transformed |= self.transformed; |
| 732 | t |
| 733 | }); |
| 734 | } |
| 735 | TreeNodeRecursion::Jump => { |
| 736 | self.tnr = TreeNodeRecursion::Continue; |
| 737 | } |
| 738 | TreeNodeRecursion::Stop => {} |
| 739 | } |
| 740 | Ok(self) |
| 741 | } |
| 742 | |
| 743 | /// Maps the [`Transformed`] object to the result of the given `f` depending on the |
| 744 | /// current [`TreeNodeRecursion`] value and the fact that `f` is changing the current |
no test coverage detected