setzer22 / egui_node_graph

Build your node graph applications in Rust, using egui
MIT License
715 stars 134 forks source link

Reverse order of id's in `iter_connections` #31

Open gmorenz opened 2 years ago

gmorenz commented 2 years ago

iter_connections current returns an iterator of (InputId, OutputId). I believe it would be more consistent to return (OutputId, InputId), and it matches the direction of connections in the graph.

On the other hand it's a bit of an unnecessary breaking change, but it's caught by the type system, and I think this library is young enough that it's worth it.

This was inspired by @philpax 's comment here. I did this here 32aa8d3f00c309e50de407b8c726f8e13785a281, but it will conflict with #30, so waiting on that to make a PR.

Sorry about how inter-connected all my proposed changes are :laughing:

setzer22 commented 2 years ago

Indeed, my original idea was to always go Output -> Input, which is the natural order you'd fetch dependencies from, so iter_connections is kind of backwards.

Since InputId and OutputId are typed, this change is breaking but not silently, users will get a clear error and know what to do, so I don't see any issues with it. It's very early for this library so we can afford breaking some APIs for consistency :smile:

setzer22 commented 2 years ago

Feel free to include this as part of #30 if that helps avoid the conflicts