Skip to content

HugrMut: add new insertion method(s) #2500

@acl-cqc

Description

@acl-cqc

parallels insert_hugr_nodes but we'd want two trait methods, one for Hugr one for View, to handle copying-vs-moving node weights/data.

In fact the reroot callback could be a HashMap<Node, Self::Node>: the method is inserting a forest, and the map contains one entry per root of the inserted forest, so not many entries.

These methods would then be implemented for Hugr by each calling the existing insert_hugr_nodes plus its own bit for copying/moving node weights/data.

insert_hugr and insert_region etc. can then all be trait-default-implemented on top of that (using entry_descendants and a single mapping from inserted entrypoint to parent to preserve current behaviour).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions