(
self,
f: F,
)
| 1286 | } |
| 1287 | |
| 1288 | fn map_children<F: FnMut(Self) -> Result<Transformed<Self>>>( |
| 1289 | self, |
| 1290 | f: F, |
| 1291 | ) -> Result<Transformed<Self>> { |
| 1292 | let children = self.arc_children(); |
| 1293 | if !children.is_empty() { |
| 1294 | let new_children = children |
| 1295 | .into_iter() |
| 1296 | .cloned() |
| 1297 | .map_until_stop_and_collect(f)?; |
| 1298 | // Propagate up `new_children.transformed` and `new_children.tnr` |
| 1299 | // along with the node containing transformed children. |
| 1300 | if new_children.transformed { |
| 1301 | let arc_self = Arc::clone(&self); |
| 1302 | new_children.map_data(|new_children| { |
| 1303 | self.with_new_arc_children(arc_self, new_children) |
| 1304 | }) |
| 1305 | } else { |
| 1306 | Ok(Transformed::new(self, false, new_children.tnr)) |
| 1307 | } |
| 1308 | } else { |
| 1309 | Ok(Transformed::no(self)) |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | /// Instead of implementing [`TreeNode`], it's recommended to implement a [`ConcreteTreeNode`] for |
no test coverage detected