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

Locid extensions tofromstr #4934

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

zbraniecki
Copy link
Member

Second part of #1833.

This one cleans up from/to str for locid extensions. This prepares ground for reuse of Subtag in Value API which will be introduced in the next PR.

@zbraniecki zbraniecki requested a review from sffc May 23, 2024 14:54
@zbraniecki zbraniecki requested a review from nciric as a code owner May 23, 2024 14:54
Self::try_from_bytes(source.as_bytes())
}
}

writeable::impl_display_with_writeable!(Unicode);

impl writeable::Writeable for Unicode {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems somewhat risky to change the Writeable to not include the u- as it has been doing since 1.0. It's easy for me to imagine code that depended on that behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we haven't thought it through sufficiently and I consider 2.0 a chance to normalize that. Stringification of a struct doesn't contain the extension key of the struct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we can start landing 2.0 changes now. However, I'm not fully convinced. In the case of Other especially, it seems like printing out the extension key is very much the job of the extension struct. But, if you want to make this change (impl Writeable does not include u), please do so consistently across Private, Other, and Transform.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. I'm convinced by the compatibility with Other. I normalized the behavior across all extension types to require extension key for parsing and print it in response

components/locid/src/extensions/other/mod.rs Outdated Show resolved Hide resolved
@zbraniecki zbraniecki force-pushed the locid-extensions-tofromstr branch from b46e464 to 441426c Compare May 29, 2024 06:19
@zbraniecki zbraniecki requested review from sffc and removed request for nciric May 29, 2024 06:20
Self::try_from_bytes(source.as_bytes())
}
}

writeable::impl_display_with_writeable!(Unicode);

impl writeable::Writeable for Unicode {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we can start landing 2.0 changes now. However, I'm not fully convinced. In the case of Other especially, it seems like printing out the extension key is very much the job of the extension struct. But, if you want to make this change (impl Writeable does not include u), please do so consistently across Private, Other, and Transform.

@zbraniecki zbraniecki force-pushed the locid-extensions-tofromstr branch from 441426c to 8a5f8d5 Compare May 30, 2024 18:23
@zbraniecki zbraniecki requested a review from a team as a code owner May 30, 2024 18:23
@zbraniecki zbraniecki force-pushed the locid-extensions-tofromstr branch from 8a5f8d5 to 615825f Compare May 30, 2024 18:26
@zbraniecki zbraniecki requested a review from sffc May 30, 2024 18:26
@zbraniecki zbraniecki force-pushed the locid-extensions-tofromstr branch 2 times, most recently from fb72fdb to 4f0f713 Compare May 31, 2024 21:48
@zbraniecki zbraniecki force-pushed the locid-extensions-tofromstr branch from 4f0f713 to cc45a10 Compare May 31, 2024 21:51
@zbraniecki zbraniecki removed the request for review from a team May 31, 2024 22:04
@zbraniecki zbraniecki merged commit 77da96b into unicode-org:main Jun 1, 2024
28 checks passed
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.

2 participants