From fba9a90cfc6aca2a26cce72f55fb261789139781 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 16 Oct 2026 14:01:01 +0800 Subject: new start Now I tested and discussed with claude, and had a working version of this project. The rest is to port the claude version to my own writings. So this serves as the starting point before that attempt. In the new attempt the design is better, and a number of bugs were found and supposedly fixed, so let us see how this goes at the end. --- chain/src/item/default/mod.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'chain/src/item/default/mod.rs') diff --git a/chain/src/item/default/mod.rs b/chain/src/item/default/mod.rs index f532805..eef7def 100644 --- a/chain/src/item/default/mod.rs +++ b/chain/src/item/default/mod.rs @@ -535,7 +535,7 @@ impl Forest for DefaultForest> { builder.add_edge(f_node, f_child, node_label)?; } } - } else if !children_match_p(&builder, f_node, fragment.borrow(), node)? { + } else if !children_match_p(&builder, f_node, fragment, node)? { let cloned = self.clone_node(f_node, 0, false)?; let mut builder = PLGBuilderMut::from_graph_mut(&mut self.graph); @@ -594,8 +594,7 @@ impl Forest for DefaultForest> { for cloned_child in fragment.children_of(node)? { let builder = PLGBuilderMut::from_graph_mut(&mut self.graph); - if !children_match_p(&builder, f_node, fragment.borrow(), cloned_child)? - { + if !children_match_p(&builder, f_node, fragment, cloned_child)? { let cloned = self.clone_node(f_node, 0, false)?; let mut builder = PLGBuilderMut::from_graph_mut(&mut self.graph); @@ -652,7 +651,7 @@ impl Forest for DefaultForest> { continue 'node_loop; } - if children_match_p(&builder, f_node_clone, fragment.borrow(), node)? { + if children_match_p(&builder, f_node_clone, fragment, node)? { continue 'node_loop; } } @@ -720,12 +719,8 @@ impl Forest for DefaultForest> { continue 'node_loop; } - if children_match_p( - &builder, - f_node_clone, - fragment.borrow(), - cloned_child, - )? { + if children_match_p(&builder, f_node_clone, fragment, cloned_child)? + { continue 'cloned_loop; } } @@ -1187,6 +1182,7 @@ impl DefaultForest> { let mut file = std::fs::File::options() .write(true) .create(true) + .truncate(true) .open(&filename)?; use std::io::Write; -- cgit v1.2.3-18-g5258