Update Rust crate uuid to v1 #7

Merged
pierre merged 1 commits from renovate/uuid-1.x into master 2022-04-23 18:48:28 +00:00
Owner

This PR contains the following updates:

Package Type Update Change
uuid dependencies major 0.8.2 -> 1.0.0

Release Notes

uuid-rs/uuid

v1.0.0

Compare Source

This release includes a huge amount of work from a lot of contributors. These notes are duplicated from 1.0.0-alpha.1 since they're relevant for anybody moving from 0.8.2 to 1.0.0.

Changes since the last release

Contributions since the last release

@​Gaelan @​hecsalazarf @​Expyron @​saiintbrisson @​tshepang @​Tehnix @​Takashiidobe @​A248 @​clehner

With a special thanks to:

@​kinggoesgaming @​QnnOkabayashi @​Nugine

Highlights

Parsing and formatting methods are now much faster, and work in const too! On my i9 9900K Windows desktop, the difference looks something like this:

Case | 1.0.0-alpha.1 | 0.8.3
----------------------- | ------------------ | ------------------
parse_invalid_character | 40 ns/iter (+/- 0) | 39 ns/iter (+/- 1)
parse_invalid_group_len | 47 ns/iter (+/- 1) | 52 ns/iter (+/- 5)
parse_invalid_groups | 58 ns/iter (+/- 1) | 58 ns/iter (+/- 0)
parse_invalid_len | 57 ns/iter (+/- 2) | 6 ns/iter (+/- 0)
parse_nil | 16 ns/iter (+/- 0) | 50 ns/iter (+/- 4)
parse_nil_hyphenated | 17 ns/iter (+/- 0) | 59 ns/iter (+/- 2)
parse_random | 16 ns/iter (+/- 0) | 42 ns/iter (+/- 1)
parse_random_hyphenated | 18 ns/iter (+/- 0) | 51 ns/iter (+/- 2)
parse_urn | 18 ns/iter (+/- 0) | 51 ns/iter (+/- 1)

You can go one step further and look at the uuid-simd library for vectorized UUID parsing. It's fast!

You can create UUIDs at compile time using the uuid! macro:

#[macro_use]
extern crate uuid;

use uuid::Uuid;

const ID: Uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8");

Enable the macro-diagnostics crate feature to get better diagnostics from uuid! using a procedural macro.

Breaking changes

Relocation of adapter::compact

This module can now be found in serde::compact. It can be combined with #[serde(with)] to serialize a Uuid using a more compact representation. We originally moved to this representation directly, but discovered it comes with its own drawbacks that aren't suitable for all formats.

Infallible constructors

The following methods have been changed to accept a &[u8; N] instead of a &[u8], making them infallible instead of returning a Result:

  • Uuid::from_fields
  • Uuid::from_fields_le
  • Uuid::new_v1
  • Builder::from_fields
  • Builder::from_fields_le

Infallible get_variant

The Uuid::get_variant method now returns a Variant instead of an Option<Varaint>, because it's not actually possible for it to ever be None.

Uuid::to_timestamp is now Uuid::get_timestamp

The Uuid::to_timestamp method has been renamed to Uuid::get_timestamp to make it more consistent with Uuid::get_version and Uuid::get_variant.

Changes to formatting methods

The following methods that produce formatting adapters have been renamed:

  • Uuid::to_hyphenated -> Uuid::hyphenated
  • Uuid::to_simple -> Uuid::simple
  • Uuid::to_urn -> Uuid::urn

The following types have been removed:

  • HyphenatedRef
  • SimpleRef
  • UrnRef

The following methods have been changed to return a &<AdapterType> instead of an <AtapterType>Ref:

  • Uuid::to_hyphenated_ref -> Uuid::as_hyphenated
  • Uuid::to_simple_ref -> Uuid::as_simple
  • Uuid::to_urn_ref -> Uuid::as_urn

Builder method consistency

The Builder::build method has been renamed to Builder::into_uuid, to complement the <AdapterType>::into_uuid methods. It also gets an equivalent Builder::as_uuid method.

Version and Variant are non-exhaustive

The #[non_exhaustive] attribute has been added to Version and Variant. There are already active proposals for new UUID versions, so these are likely to continue evolving in the future.

Removed winapi support

The Uuid::to_guid and Uuid::from_guid methods have been removed. This was done for two reasons:

  • We need to avoid unstable winapi types in the stable uuid public API.
  • Whether or not GUID fields need to be flipped to convert into a UUID depends on the source of the GUID, so we can't really offer a single pair of methods to convert a GUID into a UUID.

There are some examples in the repository root that demonstrate how to convert GUIDs into UUIDs as a replacement.

Building with --all-features

Now that uuid includes unstable features, if you're building with --all-features (such as in package manager scenarios), you'll also need to pass RUSTFLAGS="--cfg uuid_unstable", or you'll end up with compilation errors. If this strategy becomes problematic for users we can change unstable features to silently no-op instead of cause compilation failures if the corresponding cfg is not also supplied. Please reach out if that affects you!

Stability commitment

With uuid 1.0 we'll try to stay on that version "forever". There won't be a 2.0 unless there's a very compelling need for it. That means you should feel safe depending on Uuid in the public API of your libraries if you want to.


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://github.com/uuid-rs/uuid) | dependencies | major | `0.8.2` -> `1.0.0` | --- ### Release Notes <details> <summary>uuid-rs/uuid</summary> ### [`v1.0.0`](https://github.com/uuid-rs/uuid/releases/1.0.0) [Compare Source](https://github.com/uuid-rs/uuid/compare/0.8.2...1.0.0) This release includes a *huge* amount of work from a lot of contributors. These notes are duplicated from `1.0.0-alpha.1` since they're relevant for anybody moving from `0.8.2` to `1.0.0`. ### Changes since the last release ### Contributions since the last release - [#&#8203;510](https://github.com/uuid-rs/uuid/issues/510) - [#&#8203;482](https://github.com/uuid-rs/uuid/issues/482) - [#&#8203;511](https://github.com/uuid-rs/uuid/issues/511) - [#&#8203;507](https://github.com/uuid-rs/uuid/issues/507) - [#&#8203;518](https://github.com/uuid-rs/uuid/issues/518) - [#&#8203;519](https://github.com/uuid-rs/uuid/issues/519) - [#&#8203;512](https://github.com/uuid-rs/uuid/issues/512) - [#&#8203;520](https://github.com/uuid-rs/uuid/issues/520) - [#&#8203;521](https://github.com/uuid-rs/uuid/issues/521) - [#&#8203;525](https://github.com/uuid-rs/uuid/issues/525) - [#&#8203;526](https://github.com/uuid-rs/uuid/issues/526) - [#&#8203;527](https://github.com/uuid-rs/uuid/issues/527) - [#&#8203;528](https://github.com/uuid-rs/uuid/issues/528) - [#&#8203;535](https://github.com/uuid-rs/uuid/issues/535) - [#&#8203;536](https://github.com/uuid-rs/uuid/issues/536) - [#&#8203;539](https://github.com/uuid-rs/uuid/issues/539) - [#&#8203;538](https://github.com/uuid-rs/uuid/issues/538) - [#&#8203;540](https://github.com/uuid-rs/uuid/issues/540) - [#&#8203;541](https://github.com/uuid-rs/uuid/issues/541) - [#&#8203;542](https://github.com/uuid-rs/uuid/issues/542) - [#&#8203;544](https://github.com/uuid-rs/uuid/issues/544) - [#&#8203;545](https://github.com/uuid-rs/uuid/issues/545) - [#&#8203;546](https://github.com/uuid-rs/uuid/issues/546) - [#&#8203;543](https://github.com/uuid-rs/uuid/issues/543) - [#&#8203;547](https://github.com/uuid-rs/uuid/issues/547) - [#&#8203;548](https://github.com/uuid-rs/uuid/issues/548) - [#&#8203;549](https://github.com/uuid-rs/uuid/issues/549) - [#&#8203;550](https://github.com/uuid-rs/uuid/issues/550) - [#&#8203;552](https://github.com/uuid-rs/uuid/issues/552) - [#&#8203;554](https://github.com/uuid-rs/uuid/issues/554) - [#&#8203;558](https://github.com/uuid-rs/uuid/issues/558) - [#&#8203;560](https://github.com/uuid-rs/uuid/issues/560) - [#&#8203;562](https://github.com/uuid-rs/uuid/issues/562) - [#&#8203;563](https://github.com/uuid-rs/uuid/issues/563) - [#&#8203;564](https://github.com/uuid-rs/uuid/issues/564) - [#&#8203;565](https://github.com/uuid-rs/uuid/issues/565) - [#&#8203;566](https://github.com/uuid-rs/uuid/issues/566) - [#&#8203;579](https://github.com/uuid-rs/uuid/issues/579) - [#&#8203;584](https://github.com/uuid-rs/uuid/issues/584) - [#&#8203;587](https://github.com/uuid-rs/uuid/issues/587) - [#&#8203;595](https://github.com/uuid-rs/uuid/issues/595) [@&#8203;Gaelan](https://github.com/Gaelan) [@&#8203;hecsalazarf](https://github.com/hecsalazarf) [@&#8203;Expyron](https://github.com/Expyron) [@&#8203;saiintbrisson](https://github.com/saiintbrisson) [@&#8203;tshepang](https://github.com/tshepang) [@&#8203;Tehnix](https://github.com/Tehnix) [@&#8203;Takashiidobe](https://github.com/Takashiidobe) [@&#8203;A248](https://github.com/A248) [@&#8203;clehner](https://github.com/clehner) With a special thanks to: [@&#8203;kinggoesgaming](https://github.com/kinggoesgaming) [@&#8203;QnnOkabayashi](https://github.com/QnnOkabayashi) [@&#8203;Nugine](https://github.com/Nugine) ### Highlights Parsing and formatting methods are now much faster, and work in `const` too! On my i9 9900K Windows desktop, the difference looks something like this: Case | `1.0.0-alpha.1` | `0.8.3` \----------------------- | ------------------ | ------------------ parse_invalid_character | 40 ns/iter (+/- 0) | 39 ns/iter (+/- 1) parse_invalid_group_len | 47 ns/iter (+/- 1) | 52 ns/iter (+/- 5) parse_invalid_groups | 58 ns/iter (+/- 1) | 58 ns/iter (+/- 0) parse_invalid_len | 57 ns/iter (+/- 2) | 6 ns/iter (+/- 0) parse_nil | 16 ns/iter (+/- 0) | 50 ns/iter (+/- 4) parse_nil_hyphenated | 17 ns/iter (+/- 0) | 59 ns/iter (+/- 2) parse_random | 16 ns/iter (+/- 0) | 42 ns/iter (+/- 1) parse_random_hyphenated | 18 ns/iter (+/- 0) | 51 ns/iter (+/- 2) parse_urn | 18 ns/iter (+/- 0) | 51 ns/iter (+/- 1) You can go one step further and look at the [`uuid-simd`](https://github.com/Nugine/uuid-simd) library for vectorized UUID parsing. It's *fast*! You can create UUIDs at compile time using the `uuid!` macro: ```rust #[macro_use] extern crate uuid; use uuid::Uuid; const ID: Uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8"); ``` Enable the `macro-diagnostics` crate feature to get better diagnostics from `uuid!` using a procedural macro. ### Breaking changes #### Relocation of `adapter::compact` This module can now be found in `serde::compact`. It can be combined with `#[serde(with)]` to serialize a `Uuid` using a more compact representation. We originally moved to this representation directly, but discovered it comes with its own drawbacks that aren't suitable for all formats. #### Infallible constructors The following methods have been changed to accept a `&[u8; N]` instead of a `&[u8]`, making them infallible instead of returning a `Result`: - `Uuid::from_fields` - `Uuid::from_fields_le` - `Uuid::new_v1` - `Builder::from_fields` - `Builder::from_fields_le` #### Infallible `get_variant` The `Uuid::get_variant` method now returns a `Variant` instead of an `Option<Varaint>`, because it's not actually possible for it to ever be `None`. #### `Uuid::to_timestamp` is now `Uuid::get_timestamp` The `Uuid::to_timestamp` method has been renamed to `Uuid::get_timestamp` to make it more consistent with `Uuid::get_version` and `Uuid::get_variant`. #### Changes to formatting methods The following methods that produce formatting adapters have been renamed: - `Uuid::to_hyphenated` -> `Uuid::hyphenated` - `Uuid::to_simple` -> `Uuid::simple` - `Uuid::to_urn` -> `Uuid::urn` The following types have been removed: - `HyphenatedRef` - `SimpleRef` - `UrnRef` The following methods have been changed to return a `&<AdapterType>` instead of an `<AtapterType>Ref`: - `Uuid::to_hyphenated_ref` -> `Uuid::as_hyphenated` - `Uuid::to_simple_ref` -> `Uuid::as_simple` - `Uuid::to_urn_ref` -> `Uuid::as_urn` #### `Builder` method consistency The `Builder::build` method has been renamed to `Builder::into_uuid`, to complement the `<AdapterType>::into_uuid` methods. It also gets an equivalent `Builder::as_uuid` method. #### `Version` and `Variant` are non-exhaustive The `#[non_exhaustive]` attribute has been added to `Version` and `Variant`. There are already active proposals for new UUID versions, so these are likely to continue evolving in the future. #### Removed `winapi` support The `Uuid::to_guid` and `Uuid::from_guid` methods have been removed. This was done for two reasons: - We need to avoid unstable `winapi` types in the stable `uuid` public API. - Whether or not GUID fields need to be flipped to convert into a UUID depends on the source of the GUID, so we can't really offer a single pair of methods to convert a GUID into a UUID. There are some examples in the repository root that demonstrate how to convert GUIDs into UUIDs as a replacement. #### Building with `--all-features` Now that `uuid` includes unstable features, if you're building with `--all-features` (such as in package manager scenarios), you'll also need to pass `RUSTFLAGS="--cfg uuid_unstable"`, or you'll end up with compilation errors. If this strategy becomes problematic for users we can change unstable features to silently no-op instead of cause compilation failures if the corresponding cfg is not also supplied. Please reach out if that affects you! ### Stability commitment With `uuid` `1.0` we'll try to stay on that version "forever". There won't be a `2.0` unless there's a very compelling need for it. That means you should feel safe depending on `Uuid` in the public API of your libraries if you want to. </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
pierre added 1 commit 2022-04-23 00:12:08 +00:00
pierre merged commit b1ee7131d4 into master 2022-04-23 18:48:28 +00:00
pierre deleted branch renovate/uuid-1.x 2022-04-23 18:48:28 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pierre/BasicOIDC#7
No description provided.