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

Make ctors that accept slices infallible using arrays and other breaking changes #536

Merged
merged 8 commits into from
Oct 30, 2021
Merged

Make ctors that accept slices infallible using arrays and other breaking changes #536

merged 8 commits into from
Oct 30, 2021

Conversation

KodrAus
Copy link
Member

@KodrAus KodrAus commented Oct 29, 2021

Closes #150 #459 #329 #533

Infallible array inputs

This is a breaking change that changes &[u8] inputs to Uuid methods to &[u8; N]. This lets us make these methods infallible so they can be used in other const functions. If a caller only has a &[u8] to pass in, they can use try_into to convert it into a &[u8; N].

Infallible variant

It's not possible for the variant to ever return None, so we don't need to return an Option for it.

Compact serializer by default

We now serialize a 16 element tuple instead of a slice of bytes in non-human-readable formats.

@KodrAus
Copy link
Member Author

KodrAus commented Oct 29, 2021

While working on this I've also catalogued our unstable dependencies. I think the only public one left is winapi, which is unlikely to change in a hurry, but we should consider shifting it out into an external library that just offers two functions:

pub fn uuid_from_guid(guid: Guid) -> Uuid;

pub fn guid_from_uuid(uuid: Uuid) -> Guid;

@KodrAus KodrAus added the breaking This causes a breaking change and will be merged to breaking branch. label Oct 29, 2021
@KodrAus KodrAus changed the title Make ctors that accept slices infallible using arrays Make ctors that accept slices infallible using arrays and other breaking changes Oct 29, 2021
@KodrAus KodrAus marked this pull request as ready for review October 29, 2021 10:07
@KodrAus KodrAus mentioned this pull request Oct 29, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This causes a breaking change and will be merged to breaking branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a version of Uuid::from_fields that can't fail
1 participant