Adding NonNilUuid::new_v* and NonNilUuid::now_v* #901
Labels
No labels
breaking
bug
dependencies
good first issue
help wanted
unstable
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-uuid-rs/uuid#901
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
NonNilUuiddocs say thatUuid::new_v*methods (v1, v3, v4, v5, v6, v7, v8) andUuid::now_v*methods (v1, v6, v7) are guaranteed to create non-nil UUIDs.However, those methods return
Uuidand converting those values toNonNilUuidviaNonNilUuid::new()performs an unneeded runtime check (and one has to assert that the resultingOptionis actually neverNone). Therefore, I'm currently generating UUIDs (v4) with the following code:I was thinking a
NonNilUuid::new_v4()convenience method (same for v1, v3,now_*etc.) with essentially this implementation could be useful.I think it shouldn't be a complex change and I might be able to submit a PR for the implementation of these methods, if desired.