akai 0.1.0

Next-generation, functional and simple ID system
Documentation

A next-generation, customizable and simple ID system, built in Rust.


Crates.io Version GitHub License

Features

  • Simple. Akai generates beautiful, minimal IDs that are unique.
  • Customizable. You can personalize the prefix, the starting timestamp, and you can use a node ID.
  • Robust. Akai is built in Rust, the world's most loved programming language.
  • Safe. It is impossible to generate a duplicate ID, due to the uniqueness of Superflake combined with random characters.

Install

Put the desired version of the crate into the dependencies section of your Cargo.toml:

[dependencies]
akai = { version = "0.1.0" }

Example

use akai::{Akai, AkaiPrefix, AkaiOptions};

let prefix = AkaiPrefix {
    content: "user".to_string(),
    allows_lowercase: true
};
    
let akai = Akai::new(AkaiOptions {
    prefix,
    custom_bytes: Some(8),
    custom_timestamp: None
});
    
match akai.generate() {
    Ok(id) => println!("{}", id),
    Err(error) => eprintln!("Error: {}", error)
}