youki-dev / oci-spec-rs

OCI Runtime, Image and Distribution Spec in Rust
https://crates.io/crates/oci-spec
Apache License 2.0
218 stars 52 forks source link

digest: Add TryFrom<&str + String> #222

Closed cgwalters closed 2 months ago

cgwalters commented 2 months ago

Originally I only implemented FromStr but having TryFrom for both &str and String too seems also idiomatic. Notably it's done by Reference, also in this crate.

That said there was a lot of debate in e.g. https://users.rust-lang.org/t/is-there-actually-a-semantic-difference-between-fromstr-and-tryfrom-str/92765/15

But...these things are strings more than they're not, so arguably indeed TryFrom<string type> makes sense.

codecov-commenter commented 2 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 70.71%. Comparing base (57570dd) to head (6f7eefb). Report is 37 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #222 +/- ## =========================================== + Coverage 26.61% 70.71% +44.10% =========================================== Files 24 26 +2 Lines 2788 3159 +371 Branches 1516 1678 +162 =========================================== + Hits 742 2234 +1492 + Misses 948 925 -23 + Partials 1098 0 -1098 ```