feat: Add methods with recoverable errors for Graph and StableGraph#718
Merged
starovoid merged 10 commits intopetgraph:masterfrom Mar 31, 2025
Merged
feat: Add methods with recoverable errors for Graph and StableGraph#718starovoid merged 10 commits intopetgraph:masterfrom
Graph and StableGraph#718starovoid merged 10 commits intopetgraph:masterfrom
Conversation
c76d8b3 to
50db2dd
Compare
Graph and StableGraphGraph and StableGraph
notxvilka
approved these changes
Mar 29, 2025
notxvilka
left a comment
There was a problem hiding this comment.
In some future release we should make this behavior the default in add_edge(), not try_add_edge() in my opinion.
Collaborator
Author
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
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 5, 2025
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 <[email protected]>
This was referenced Apr 5, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: