Skip to content

Implement PartialEq<str> on Namespace, Prefix and LocalName - #1011

Open
Tpt wants to merge 1 commit into
tafia:masterfrom
Tpt:tpt/str-eq
Open

Implement PartialEq<str> on Namespace, Prefix and LocalName#1011
Tpt wants to merge 1 commit into
tafia:masterfrom
Tpt:tpt/str-eq

Conversation

@Tpt

@Tpt Tpt commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Allows to easily write comparisons on both

@Tpt
Tpt force-pushed the tpt/str-eq branch 2 times, most recently from 7c22696 to 1e4f093 Compare August 23, 2026 17:20
@dralley
dralley marked this pull request as draft August 23, 2026 17:35
@dralley

dralley commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Once you've fixed the test failures, please add a changelog entry also.

Allows to easily write comparisons on both
@Tpt Tpt changed the title Implement PartialEq<str> on Namespace and LocalName Implement PartialEq<str> on Namespace, Prefix and LocalName Aug 23, 2026
@codecov-commenter

Copy link
Copy Markdown

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

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.11%. Comparing base (e00ae5c) to head (ffb7a97).
⚠️ Report is 74 commits behind head on master.

Files with missing lines Patch % Lines
src/name.rs 0.00% 18 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1011      +/-   ##
==========================================
- Coverage   57.31%   55.11%   -2.20%     
==========================================
  Files          46       51       +5     
  Lines       18197    18809     +612     
==========================================
- Hits        10429    10366      -63     
- Misses       7768     8443     +675     
Flag Coverage Δ
unittests 55.11% <0.00%> (-2.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tpt

Tpt commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

@dralley Thank you! Done. I have also added a changelog line for the previous MR you merged (thank you for it)

@Tpt
Tpt marked this pull request as ready for review August 23, 2026 19:28
@Mingun

Mingun commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Not sure about it. Wouldn't it defeat the idea to have distinct types for different things? Now you may compare local name with something with colon, which is definitely will be false.

@dralley

dralley commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Not sure about it. Wouldn't it defeat the idea to have distinct types for different things? Now you may compare local name with something with colon, which is definitely will be false.

You could, but it feels like the same class of error as, say, calling .into_inner() or Deref or format!() on a BytesText without normalizing / unescaping first. Or passing escaped text into a constructor that does escaping (again). Things that could happen, but is prevention really worth the cost? (and thus we don't really try to prevent it)

I see your point though. I think you can make reasonable arguments either way.. I guess I fall slightly on the side of the ergonomic argument personally given it's documented and most novice users would pick .name() over .local_name() if they were being lazy. But I don't feel strongly about it.

If we were to not change it, the examples should at least be using LocalName("tag1"), which is slightly cleaner and shorter than QName("tag1").into()

The internal field is only pub(crate), so I guess not. That would have the same issue anyway, if it were public - being able to pass myns:tag1

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.

4 participants