-
Notifications
You must be signed in to change notification settings - Fork 5
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
Rjf/errors #260
Open
robfitzgerald
wants to merge
17
commits into
main
Choose a base branch
from
rjf/errors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rjf/errors #260
Conversation
This file contains 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.
this is the beginning of a refactor with the intention to address #133. i'm using the time to do housekeeping. creating a draft PR here so we can discuss the changes.
remove "property" module
before Graph was a struct, it was a trait object, with the idea that we might have different graph representations. we dropped that idea but still Vertex and Edge implementations were living in a separate module called "property" (for Graphs with properties). this PR moves Vertex and Edge into the module with the rest of the graph stuff, and that module has been renamed from road_network to network for simplicity.
pass EdgeId/VertexId/Direction by reference in Graph methods
we are passing these newtypes by value which i believe triggers a clone. i previously thought the compiler would recognize a built-in under-the-hood but i have heard otherwise on recent searches. this way the signatures match the general idiom of passing immutable values into functions in rust.
for example, a before-and-after:
Graph in/out/incident edges methods no longer fail
the in_edges, out_edges, and incident_edges methods previously failed if there wasn't an entry for their argument vertex in the forward or reverse adjacency lists, based on the assumption that we are always working with a strongly-connected graph. while that is sensible, it's not robust, for example if people are working with modified graphs or crowd-sourced datasets. if it truly should produce an error, that can be decided at the calling scope.
use eprintln! macro instead of println! macro for kdam::Bar
kdam writes the progress bar to stderr, not stdout.
about errors
i wanted to make things a little more consistent and to reduce fracturing, and so, for a lot of the system, i simplified things to Build, Runtime, and Internal errors, both single-String-parameter enum variants:
so:
?
is called on those resultswith these changes, CompassAppErrors should now have the right amount of context for most situations.
Closes #133.
Closes #183.