#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

#1073 in Encoding

Download history 120/week @ 2024-08-03 40/week @ 2024-08-10 3/week @ 2024-08-17 26/week @ 2024-08-24 10/week @ 2024-08-31 100/week @ 2024-09-07 112/week @ 2024-09-14 122/week @ 2024-09-21 76/week @ 2024-09-28 54/week @ 2024-10-05 52/week @ 2024-10-12 19/week @ 2024-10-19 24/week @ 2024-10-26 6/week @ 2024-11-02 7/week @ 2024-11-09 34/week @ 2024-11-16

74 downloads per month
Used in 3 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
~65K SLoC