Recursively rewrite the node using `f` in a bottom-up (post-order) fashion. `f` is applied to the node's children first, and then to the node itself. # See Also [`Self::transform_down`] top-down (pre-order) traversal. [Self::transform_down_up] for a combined traversal with closures [`Self::rewrite`] for a combined traversal with a visitor
(
self,
mut f: F,
)
| 253 | /// * [Self::transform_down_up] for a combined traversal with closures |
| 254 | /// * [`Self::rewrite`] for a combined traversal with a visitor |
| 255 | fn transform_up<F: FnMut(Self) -> Result<Transformed<Self>>>( |
| 256 | self, |
| 257 | mut f: F, |
| 258 | ) -> Result<Transformed<Self>> { |
| 259 | #[cfg_attr(feature = "recursive_protection", recursive::recursive)] |
| 260 | fn transform_up_impl<N: TreeNode, F: FnMut(N) -> Result<Transformed<N>>>( |
| 261 | node: N, |
| 262 | f: &mut F, |
| 263 | ) -> Result<Transformed<N>> { |
| 264 | node.map_children(|c| transform_up_impl(c, f))? |
| 265 | .transform_parent(f) |
| 266 | } |
| 267 | |
| 268 | transform_up_impl(self, &mut f) |
| 269 | } |
| 270 | |
| 271 | /// Transforms the node using `f_down` while traversing the tree top-down |
| 272 | /// (pre-order), and using `f_up` while traversing the tree bottom-up |
no outgoing calls