Skip to content

Conversation

asmello
Copy link
Collaborator

@asmello asmello commented Feb 23, 2025

Non-breaking change. Accept owned or borrowed strings as input in Token::from_encoded.

@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

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%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chanced
Copy link
Owner

chanced commented Jun 2, 2025

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);
}

playground link

If memory serves, we have breaking changes in main already so I'm pulling it in.

@asmello
Copy link
Collaborator Author

asmello commented Jun 8, 2025

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.

@asmello
Copy link
Collaborator Author

asmello commented Jun 8, 2025

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.

@asmello asmello merged commit 6f11cb6 into main Jun 8, 2025
18 of 19 checks passed
@asmello asmello deleted the token-from-encoded branch June 8, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants