Skip to content

split generic tree implementation

Paolo Borelli requested to merge pborelli/librsvg:tree_utils into master

@federico not sure if you want to go down this road or not, hence the WIP

The patch splits out a generic implementation of the tree data structure and related iterators. The idea is to make node.rs by separating concerns specific to svg from the the tree implementation.

Maybe later we could also swap out the data structure with a crate? I do not know if there is one with a tree data structure with the same properties... Also, I fear that with a Node defined in a separate crate we would not be able to have an impl for our Node type alias.

Also note that the branch does not compile and it is not clear to me why 😅 I get this error in the filter code

error[E0599]: no method named `clone` found for type `std::iter::Filter<std::iter::Rev<tree_utils::Children<node::NodeData>>, [closure@rsvg_internals/src/filters/component_transfer.rs:296:54: 302:10]>` in the current scope
   --> rsvg_internals/src/filters/component_transfer.rs:307:18
    |
307 |                 .clone()
    |                  ^^^^^
    |
    = note: the method `clone` exists but the following trait bounds were not satisfied:
            `std::iter::Filter<std::iter::Rev<tree_utils::Children<node::NodeData>>, [closure@rsvg_internals/src/filters/component_transfer.rs:296:54: 302:10]> : std::clone::Clone`
Edited by Federico Mena Quintero

Merge request reports