jsonptr
jsonptr copied to clipboard
improve `Token::from_encoded`
Non-breaking change. Accept owned or borrowed strings as input in Token::from_encoded.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.8%. Comparing base (
29840e7) to head (7e5bf35).
Additional details and impacted files
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/token.rs | 98.7% <100.0%> (+<0.1%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This is breaking but probably pretty uncommon. A type could implement Deref<Target = str> but not Into<Cow<str>>
struct X;
impl std::ops::Deref for X {
type Target = str;
fn deref(&self) -> &Self::Target { "" }
}
fn ok(v: &str) {}
fn breaking<'a>(v: impl Into<std::borrow::Cow<'a, str>>) {}
fn main() {
ok(&X);
breaking(&X);
}
If memory serves, we have breaking changes in main already so I'm pulling it in.
Huh, fascinating! I honestly didn't know Deref worked like that! I thought the only type that satisfied a &str signature was, well, &str.
In that case, let's document this as breaking accordingly and make sure to include in the next minor release. Thanks for flagging.
Actually, I think the changelog is fine as is. Since we have harder unreleased breaks, I'll assume you're ok with this and will proceed with merging.