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

Breaking API features and refactoring for 0.8 #427

Merged
merged 9 commits into from
Oct 4, 2019
Merged

Conversation

KodrAus
Copy link
Member

@KodrAus KodrAus commented Oct 2, 2019

I'm submitting a(n) (|feature|refactor|)

Description

Modules and Errors

This PR is a broad refactoring of our error types and module layout. The general pattern I've gone for is:

  • Define specific error types in submodules. These are currently private.
  • Collect these specific error types in an opaque root Error. All methods return this single Error type so it's easier for consumers to carry uuid::Errors in their own code.

It'll also include some implementations for open PRs as we've been discussing. I imagine we'll want to spend time working through these changes :)

I've hidden our prelude module for now, because I'm not sure it's something we'll want to stabilize with (it's only got a few bits in it afterall).

128bit support

Re-enables support for 128-bit numbers in the form of constructors on Uuid, following the pattern that method names without an endian suffix are BE.

No-std

Refactors our no-std support so we always mark the crate as no-std so our std imports are always the same. This simplifies our std/core support so we need fewer modules.

Timestamps

Includes the design proposed in #405 for timestamp support originally implemented by @jonathanstrong.

Related Issue(s)

Related PR(s)

@KodrAus KodrAus added the breaking This causes a breaking change and will be merged to breaking branch. label Oct 2, 2019
@KodrAus KodrAus changed the title Feat/api cleanup Breaking API features and refactoring for 0.8 Oct 2, 2019
@KodrAus
Copy link
Member Author

KodrAus commented Oct 2, 2019

Since this is a pretty big PR I'm trying to keep the individual commits clean so it should be easier to follow along.

@KodrAus
Copy link
Member Author

KodrAus commented Oct 2, 2019

This TODO bot is a bit of a nuisance...

@KodrAus KodrAus added this to the 0.8.0 milestone Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
@uuid-rs uuid-rs deleted a comment from todo bot Oct 2, 2019
jonathanstrong and others added 2 commits October 2, 2019 14:11
Draft implementation of improved timestamp api discussed in github issue #405.

Establishes new `Timestamp` struct in v1 mod that stores the (timestamp, counter) values that had been used previously. The core rationale/improvement is that `Timestamp` offers several conversion routines to/from RFC4122 and unix timestamp formats. The RFC4122 timestamp format in V1 UUIDs is relatively obscure -- this provides ready access to unix timestamp formats instead. The design also prevents possible confusion/misuse by use of clearly named constructors and ample documentation about the various formats in play.

Tests covering previously existing functionality updated to reflect new api and passing. New functionality untested.

Moved `Uuid::to_timestamp` from impl in src/lib.rs to v1 mod as it requires access to the new `Timestamp` struct defined in v1. Noting as this places `to_timestamp` behind the v1 feature gate, unlike prior to the change.
@kinggoesgaming
Copy link
Member

kinggoesgaming commented Oct 3, 2019

(about the todo bot)
I think we should keep until 1.0, at which point we just remove it. The reason to keep it until then so that we have no overlooked bits. I am ok with the currently deleted comments from the bot

@kinggoesgaming
Copy link
Member

Also @KodrAus this is still a WIP right?

@KodrAus
Copy link
Member Author

KodrAus commented Oct 3, 2019

@kinggoesgaming I think this is ready for a review now 👍

There’s definitely more docs work to do and we can consider how to expose richer info out of our errors but I don’t think that needs to block a review or possible merge.

@kinggoesgaming
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Oct 4, 2019
427: Breaking API features and refactoring for `0.8` r=kinggoesgaming a=KodrAus

**I'm submitting a(n)** (|feature|refactor|)

# Description

## Modules and Errors

This PR is a broad refactoring of our error types and module layout. The general pattern I've gone for is:

- Define specific error types in submodules. These are currently private.
- Collect these specific error types in an opaque root `Error`. All methods return this single `Error` type so it's easier for consumers to carry `uuid::Error`s in their own code.

It'll also include some implementations for open PRs as we've been discussing. I imagine we'll want to spend time working through these changes :)

I've hidden our `prelude` module for now, because I'm not sure it's something we'll want to stabilize with (it's only got a few bits in it afterall).

## 128bit support

Re-enables support for 128-bit numbers in the form of constructors on `Uuid`, following the pattern that method names without an endian suffix are BE.

## No-std

Refactors our `no-std` support so we always mark the crate as `no-std` so our std imports are always the same. This simplifies our std/core support so we need fewer modules.

## Timestamps

Includes the design proposed in #405 for timestamp support originally implemented by @jonathanstrong.

# Related Issue(s)

- #406

# Related PR(s)

- #405 
- #416

Co-authored-by: Ashley Mannix <ashleymannix@live.com.au>
Co-authored-by: Jonathan Strong <jonathan.strong@gmail.com>
@bors
Copy link
Contributor

bors bot commented Oct 4, 2019

@bors bors bot merged commit 2497ac7 into master Oct 4, 2019
@delete-merged-branch delete-merged-branch bot deleted the feat/api-cleanup branch October 4, 2019 23:18
This was referenced Oct 17, 2019
bors bot added a commit that referenced this pull request Oct 17, 2019
433: Prepare for 0.8.0 release r=Dylan-DPC a=KodrAus

Closes #431 

[Changeset since the last release](0.7.4...master)

Includes:

- #427 
- #419 
- #424 
- #418 
- #413 
- #407 
- #404 
- #400 
- #399 
- #398 
- #397 
- #396 
- #394 
- #393 
- #390
- #389 
- #388 

I've also added some docs to the 128bit integer methods to clarify how they're different than `to_fields` (for consistency with other uuid libs in the wild).

Co-authored-by: Ashley Mannix <ashleymannix@live.com.au>
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.

4 participants