uuidx

uuidx is an R package for generating and working with modern UUIDs using a Rust backend. It focuses on a small, practical API and uses the Rust uuid crate through rextendr and extendr.

The package is developed by Thomas Bryce Kelly and published as part of Icy Seas Co-Laboratory, an applied research and engineering institute focused on practical computational tools, data systems, and scientific software and based in Fairbanks, AK.

About Icy Seas Co-Laboratory

Icy Seas Co-Laboratory is the home organization behind uuidx. If you are using this package in research, engineering, or production workflows and want more context on the broader work around it, the project site is the best place to start.

Why Rust?

Why version 7 by default?

Version 7 UUIDs combine time-ordering with strong uniqueness properties and are generally a practical default for new application identifiers. They sort more naturally than version 4 identifiers. Users should familiarize themselves with the structure and trade-offs associated with each version (e.g., Wikipedia).

Development setup

End users installing CRAN binaries on macOS or Windows typically do not need a local Rust toolchain. Rust is mainly needed for source installs and package development.

Install Rust first if it is not already available:

Then install the R-side development dependencies:

install.packages(c("rextendr", "testthat"), repos = "https://cloud.r-project.org")

From the package root:

Rscript -e 'rextendr::document()'
Rscript -e 'testthat::test_local()'
R CMD build .
R CMD check --as-cran uuidx_*.tar.gz

For quick local iteration:

rextendr::document()
testthat::test_local()

You can also use the included Makefile:

make deps
make document
make test
make build
make check

Examples

Generate version 7 UUIDs

uuid_v7()
uuid_v7(3)
uuid_generate()

Generate version 4 UUIDs

uuid_v4()
uuid_generate(5, version = "v4")

Generate deterministic version 5 UUIDs

uuid_v5("dns", "example.com")
uuid_v5("dns", c("alpha", "beta"))
uuid_generate(version = "v5", namespace = "dns", name = "example.com")

Validate UUIDs

x = c(uuid_v7(), "not-a-uuid")
uuid_validate(x)
uuid_version(x)

Parse to raw bytes

x = uuid_v7(2)
uuid_parse(x, output = "raw")
uuid_parse(x, output = "fields")
uuid_nil(output = "raw")

Notes