Skip to content

Commit 1942a7a

Browse files
committed
auto merge of #8053 : gavinb/rust/uuid_std, r=alexcrichton
Addresses part of #7104 This module adds the ability to generate UUIDs (on all Rust-supported platforms). I reviewed the existing UUID support in libraries for a range of languages; Go, D, C#, Java and Boost++. The features were all very similar, and this patch essentially covers the union. The implmentation is quite straightforward, and uses the underlying rng support which is assumed to be sufficiently strong for this purpose. This patch is not complete, however I have put this up for review to gather feedback before finalising. It has tests for most features and documentation for most functions. Outstanding issues: * Only generates V4 (Random) UUIDs. Do we want to support the SHA-1 hash based flavour as well? * Is it worth having the field-based struct public as well as the byte array? * Formatting the string with '-' between groups not done yet. * Parsing full string not done as there appears to be no regexp support yet. I can write a simple manual parser for now? * D has a generator as well. This would be easy to add. However, given the simple interface for creating a new one, and the presence of the macro, is this useful? * Is it worth having a separate UUID trait and specific implementation? Or should it just have a struct+impl with the same name? Currently it feels weird to have the trait (which can't be named UUID so as to conflict) a separate thing. * Should the macro be visible at the top level scope? As this is a first attempt, some code may not be idiomatic. Please comment below... Thanks for all feedback!
2 parents 8ac1773 + 328261a commit 1942a7a

File tree

2 files changed

+795
-0
lines changed

2 files changed

+795
-0
lines changed

src/libextra/extra.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ pub mod semver;
103103
pub mod fileinput;
104104
pub mod flate;
105105
pub mod hex;
106+
pub mod uuid;
107+
106108

107109
#[cfg(unicode)]
108110
mod unicode;

0 commit comments

Comments
 (0)