#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

#1028 in Encoding

Download history 6/week @ 2024-07-29 141/week @ 2024-08-05 22/week @ 2024-08-12 30/week @ 2024-08-26 8/week @ 2024-09-02 123/week @ 2024-09-09 121/week @ 2024-09-16 116/week @ 2024-09-23 93/week @ 2024-09-30 10/week @ 2024-10-07 55/week @ 2024-10-14 21/week @ 2024-10-21 19/week @ 2024-10-28 7/week @ 2024-11-04

102 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
~64K SLoC