Skip to content
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

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

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

cgwalters
Copy link
Contributor

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.

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.

Signed-off-by: Colin Walters <walters@verbum.org>
@codecov-commenter
Copy link

⚠️ 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 ✅

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

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

Additional details and impacted files
@@             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     

@cgwalters cgwalters merged commit c41489a into youki-dev:main Sep 17, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants