-
Notifications
You must be signed in to change notification settings - Fork 430
feat: Add methods with recoverable errors for Graph and StableGraph
#718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c76d8b3 to
50db2dd
Compare
Graph and StableGraphGraph and StableGraph
notxvilka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some future release we should make this behavior the default in add_edge(), not try_add_edge() in my opinion.
I think this will mostly resolve itself when switching to the |
I implemented Graph::add_node and Graph::add_edge through their `try` counterparts, saving the panic message "Graph::add_edge: node indexes out of bounds" and replacing the index asserts with `unwrap`s.
50db2dd to
3976903
Compare
A sufficient number of proposed changes have accumulated to combine them and publish a new major release numbered `0.8.0`. BREAKING CHANGE: This will require the user to provide extra type parameter in some APIs (Read more in #747). ## List of changes - [x] #747 The main innovation of the current release, the long-awaited feature that has become very relevant due to the transition of dependent projects to support `no_std`. - [x] #662 - [x] #611 - [x] #728 - [x] #686 - [x] #737 - [x] #720 - [x] #718 ## Note There are still a large number of PRs that we want to adopt in the near future, so we should expect at least a release of `0.8.1` soon after the completion of `0.8.0`. Thank you all for participating! --------- Co-authored-by: Agustin Borgna <agustinborgna@gmail.com>
Methods with recoverable errors
This PR provides
try_add_node,try_add_edgeandtry_update_edgeforGraphandStableGraph.The
GraphErrortype has been added to represent possible errors:To represent potential errors in
MatrixGraphand other storages some other Errors will be needed due to the significant differences in provided APIs.Rewrite fallible methods with its
trycounterpartsTo avoid code duplication, I rewrote
add_node,add_edgeandupdate_edgefor bothGraphandStableGraphusingtrycounterparts.This changed the set of possible panics, but I tried to keep the custom panic messages: