#unique-identifier #identifier #generator #sortable

tsid

A Rust library for generating Time-Sorted Unique Identifiers

9 unstable releases (3 breaking)

0.3.1 Aug 6, 2024
0.2.0 Nov 5, 2023
0.1.2 Oct 21, 2023
0.0.6 Oct 2, 2023
0.0.3 Sep 16, 2023

#1049 in Encoding

Download history 119/week @ 2024-09-22 115/week @ 2024-09-29 13/week @ 2024-10-06 52/week @ 2024-10-13 22/week @ 2024-10-20 21/week @ 2024-10-27 6/week @ 2024-11-03 7/week @ 2024-11-10 38/week @ 2024-11-17 25/week @ 2024-11-24 102/week @ 2024-12-01 117/week @ 2024-12-08 70/week @ 2024-12-15 36/week @ 2024-12-22 20/week @ 2024-12-29 32/week @ 2025-01-05

162 downloads per month
Used in 4 crates

MIT license

26KB
651 lines

tsid

TSID generator for rust, this library is reimplementation of java tsid-creator created by Fabio Lima

example workflow

Implementation status:

  • Generate TSID with simple, naive implementation
  • Add basic tests to check compatibility
  • Benchmarks (compare the speed to java library)
  • Publish first usable version to crates.io
  • GitHub actions workflow to CI
  • Serde serialization
  • Thread safety

Rust GitHub Actions

How to use it?

use tsid::create_tsid;

fn main() {
    let tsid = create_tsid();
}

Crate features:

  • bson_as_string - the same as for serde
  • bson - adds From bson conversion
  • chrono - Allow extracting DateTime from TDIS
  • debug - adds debug trait to TSID
  • display - add Display trait to TSID
  • serde_as_string - tells serde to serialize TSID as string (disabling this feature means that serde will serialize to string for human readable formats ant tu u64 otherwise)
  • serde - adds serde dependency and serialization/deserialization

Dependencies

~1.6–3.5MB
~67K SLoC