Implement Csr::try_add_edge#719
Conversation
ABorgna
left a comment
There was a problem hiding this comment.
Nice.
I realize we don't do it anywhere else, but should we derive std::error::Error for CsrError. (And similarly in your other PRs).
Agreed. Mind adding a new issue, so we can track it in the milestone? |
Co-authored-by: Agustín Borgna <agustinborgna@gmail.com>
I think we shouldn't do this, since |
|
I don't think it is? let err: &dyn std::error::Error = &CsrError::IndicesOutBounds(0, 0);(btw, the tuple-struct error could use some named fields instead :) ) |
Oh, I'll add such blancked implementation: impl std::error::Error for CsrError {}
In this particular error, both tuple fields are equivalent, and the naming options |
The
Csr::try_add_edgefunction is implemented, which checks the given indexes and return possible error of typeIt is currently impractical to create checked counterparts of other
Csrmethods, as this will require significant code duplication. It's easier to make breaking changes in one of the further major releases, moving away from panic toErrorandOptionin the entireCsrAPI.