superflake 0.2.0

Ultra-safe identification technology
Documentation
  • Coverage
  • 0%
    0 out of 14 items documented0 out of 7 items with examples
  • Size
  • Source code size: 16.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.65 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • aidakdev

Crates.io Version Crates.io License Foundry Industries

Superflake is an ultra-safe identification technology inspired by Snowflake IDs.

Features

  • Simple. Minimal and beautiful IDs that are unique.
  • Customizable. You can customize the default epoch and the node ID.
  • Robust. Superflake is built in Rust, the world's most loved programming language.
  • Performant. A Superflake ID is only 8 bytes long, and it is a number, just like Snowflakes.

Structure

A Superflake is generated by concatenating:

  • a 42-bit timestamp,
  • a 10-bit node ID, and
  • a 12-bit incremental number.

Usage

use superflake::Superflake;

let mut superflake = 
    Superflake::new_with_node_id(1023, None); // Specify a custom epoch if you want

let id = superflake.gen(); // 392366571697205248

// Decode the Superflake
let decoded_id = superflake.decode(id);