Skip to content

condy0919/uuid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Latest Version Minimum rustc version

yauuid

The uuid crate generates and parse UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.

Documentation

Usage

Add this to your Cargo.toml:

[denpendencies]
yauuid = "0.2"

and this to your crate root:

extern crate yauuid;

Examples

To parse a simple UUID, then print the version and variant:

extern crate yauuid;

use yauuid::Uuid;
use std::str::FromStr;

fn main() {
    let u = Uuid::from_str("urn:uuid:123e4567-e89b-12d3-a456-426655440000").unwrap();
    println!("version = {}, variant = {}", u.version(), u.variant());
}

The library supports 5 versions of UUID:

Name Version
Mac Version 1: Mac address
Dce Version 2: DCE Security
Md5 Version 3: Md5 hash
Random Version 4: Random
Sha1 Version 5: Sha1 hash

Benchmarks

Lower is better.

benchmark uuid-rs (ns) yauuid (ns)
parse_str 70.240 33.176
to_string 107.48 75.387
new_v1 6.1016 6.1530
new_v3 211.16 174.33
new_v4 29.946 30.557
new_v5 209.24 212.94

The parse_str benchmark is 2x, and to_string is 1.5x.

The new_v1 costs are similar, but yauuid's version is easy to use. No time parameters required. It has been included in yauuid::Context struct.

The new_v3, new_v4, new_v5 benchmark md5, RNG, sha1 performance instead.

Run cargo bench to get the benchmark result.

See benches/bench.rs for benchmark cases detail.

References

About

Yet another UUID library for Rust

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages