beryl 0.1.1

64-bit unique identifier format
Documentation
  • Coverage
  • 73.08%
    19 out of 26 items documented2 out of 15 items with examples
  • Size
  • Source code size: 19.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.55 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • max-niederman/beryl
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • max-niederman

Beryl

Crates.io Documentation Build Tests Test Coverage License

Beryl is a format for unique identifiers. This crate implements utilities for generating these identifiers and splitting them into their component parts.

Crystals

Beryl identifiers, or Crystals, are encoded into 64 bits as follows:

  • Generator ID: 14-bit unsigned integer identifying the Crystal's generator. Further segmentation is left to the application, as conflicts will not occur unless the scheme is changed unevenly over less than a millisecond.
  • Generator Counter: 8-bit unsigned integer incremented for every Crystal generated and reset each millisecond. This allows each generator to operate at up to 256,000 Crystals/sec.
  • Timestamp: 42-bit unsigned integer number of milliseconds since an application-defined epoch.

Epochs

Beryl defines no standard epoch which a timestamp should be measured from, as the limited timestamp size (242 milliseconds is about 140 years) may call for non-standard epochs. For ease of use, the UNIX Epoch should be best.