-
Notifications
You must be signed in to change notification settings - Fork 1
34: replace url crate with peg parser based on RFC 3986 #39
Conversation
- adding path + query + fragment - test coveragee - parses query as a vec of string tuple general cleanup, make DidUrl immutable by removing setter fix rustdoc
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #39 +/- ##
==========================================
+ Coverage 95.81% 96.67% +0.85%
==========================================
Files 13 13
Lines 2153 2704 +551
==========================================
+ Hits 2063 2614 +551
Misses 90 90 ☔ View full report in Codecov by Sentry. |
🧹 nice! I like the contextual errors for parsing, I hope it will make it easier on users if they get the DID wrong |
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.
Would it make sense to use map instead of an array for queries? It's more efficient to search keys.
Also, would it make sense to test immutability? i.e. checking that original object is not modified after calling with_[query/path/attribute/...]
?
It's a good idea to use the map but it will not work because the names and values are not distinct in the specification. A query could have a=a, a=a, a=a and be valid syntax its application dependent what the meaning of that is. Imagine the protocol is 'execute this instruction'. The performance of an array vs a map for 2-3 elements is probably actually better for lookup in a typical application where every parameter will have meaning. Since we are using 1 at the moment we can probably ignore this issue. The test of immutability should be guaranteed by rust ownership rules, but I will add a check for sanity. |
…-keccak, code coverage, cleanup
In unit tests, imo it's crucial not to depend on implementation specifics. For functions with_*** functions, they should ideally return a new object rather than altering the original one. Our tests must verify this behavior directly, avoiding assumptions about Rust's clone() method or omitting such tests. Agreed with the query data structure, thanks for explaining. |
Please take a last look. I believe it's ready to go. I updated with some cleanup:
|
b316cdd
to
3caa186
Compare
- code is more rust-like using From and into
3caa186
to
64b6ca7
Compare
closes #34
general cleanup, make DidUrl immutable by removing setter
fix rustdoc