Closed jac18281828 closed 8 months ago
Attention: 3 lines
in your changes are missing coverage. Please review.
Comparison is base (
a30b4da
) 95.81% compared to head (64b6ca7
) 96.67%.
Files | Patch % | Lines |
---|---|---|
lib/src/types/ethr.rs | 89.28% | 3 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🧹 url
🧹
nice! I like the contextual errors for parsing, I hope it will make it easier on users if they get the DID wrong
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.
The test of immutability should be guaranteed by rust ownership rules, but I will add a check for sanity.
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:
closes #34
general cleanup, make DidUrl immutable by removing setter
fix rustdoc