Skip to content

Commit

Permalink
auto merge of #11912 : poiru/rust/8784-libuuid, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Feb 4, 2014
2 parents 346d378 + f8afc9a commit e99fe7e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
3 changes: 2 additions & 1 deletion mk/crates.mk
Expand Up @@ -49,7 +49,7 @@
# automatically generated for all stage/host/target combinations.
################################################################################

TARGET_CRATES := std extra green rustuv native flate arena glob term semver
TARGET_CRATES := std extra green rustuv native flate arena glob term semver uuid
HOST_CRATES := syntax rustc rustdoc
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc
Expand All @@ -67,6 +67,7 @@ DEPS_arena := std extra
DEPS_glob := std
DEPS_term := std
DEPS_semver := std
DEPS_uuid := std extra

TOOL_DEPS_compiletest := extra green rustuv
TOOL_DEPS_rustdoc := rustdoc green rustuv
Expand Down
1 change: 1 addition & 0 deletions src/doc/index.md
Expand Up @@ -42,6 +42,7 @@ li {list-style-type: none; }
* [The `glob` file path matching library](glob/index.html)
* [The `semver` version collation library](semver/index.html)
* [The `term` terminal-handling library](term/index.html)
* [The UUID library](uuid/index.html)

# Tooling

Expand Down
2 changes: 0 additions & 2 deletions src/libextra/lib.rs
Expand Up @@ -84,8 +84,6 @@ pub mod rational;
pub mod complex;
pub mod stats;
pub mod hex;
pub mod uuid;


#[cfg(unicode)]
mod unicode;
Expand Down
26 changes: 18 additions & 8 deletions src/libextra/uuid.rs → src/libuuid/lib.rs
Expand Up @@ -29,8 +29,7 @@ unlikely.
To create a new random (V4) UUID and print it out in hexadecimal form:
```rust
extern mod extra;
use extra::uuid::Uuid;
use uuid::Uuid;
fn main() {
let uuid1 = Uuid::new_v4();
Expand All @@ -55,6 +54,13 @@ Examples of string representations:
*/

#[crate_id = "uuid#0.10-pre"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];

extern mod extra;

use std::str;
use std::vec;
use std::num::FromStrRadix;
Expand All @@ -67,7 +73,7 @@ use std::cmp::Eq;
use std::cast::{transmute,transmute_copy};
use std::to_bytes::{IterBytes, Cb};

use serialize::{Encoder, Encodable, Decoder, Decodable};
use extra::serialize::{Encoder, Encodable, Decoder, Decodable};

/// A 128-bit (16 byte) buffer containing the ID
pub type UuidBytes = [u8, ..16];
Expand Down Expand Up @@ -510,7 +516,9 @@ impl rand::Rand for Uuid {

#[cfg(test)]
mod test {
use super::*;
use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122,
Version1Mac, Version2Dce, Version3Md5, Version4Random,
Version5Sha1};
use std::str;
use std::rand;
use std::io::MemWriter;
Expand Down Expand Up @@ -575,6 +583,8 @@ mod test {

#[test]
fn test_parse_uuid_v4() {
use super::{ErrorInvalidCharacter, ErrorInvalidGroups,
ErrorInvalidGroupLength, ErrorInvalidLength};

// Invalid
assert!(Uuid::parse_string("").is_err());
Expand Down Expand Up @@ -774,8 +784,8 @@ mod test {

#[test]
fn test_serialize_round_trip() {
use ebml;
use serialize::{Encodable, Decodable};
use extra::ebml;
use extra::serialize::{Encodable, Decodable};

let u = Uuid::new_v4();
let mut wr = MemWriter::new();
Expand All @@ -799,8 +809,8 @@ mod test {

#[cfg(test)]
mod bench {
use super::*;
use test::BenchHarness;
use super::Uuid;
use extra::test::BenchHarness;

#[bench]
pub fn create_uuids(bh: &mut BenchHarness) {
Expand Down

0 comments on commit e99fe7e

Please sign in to comment.