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 parent.
(
self,
f: F,
)
| 762 | /// current [`TreeNodeRecursion`] value and the fact that `f` is changing the current |
| 763 | /// node's parent. |
| 764 | pub fn transform_parent<F: FnOnce(T) -> Result<Transformed<T>>>( |
| 765 | self, |
| 766 | f: F, |
| 767 | ) -> Result<Transformed<T>> { |
| 768 | match self.tnr { |
| 769 | TreeNodeRecursion::Continue => f(self.data).map(|mut t| { |
| 770 | t.transformed |= self.transformed; |
| 771 | t |
| 772 | }), |
| 773 | TreeNodeRecursion::Jump | TreeNodeRecursion::Stop => Ok(self), |
| 774 | } |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | /// [`TreeNodeContainer`] contains elements that a function can be applied on or mapped. |
no test coverage detected