nano-id

Crates.ionano-id
lib.rsnano-id
version0.4.0
sourcesrc
created_at2021-04-06 18:33:04.312411
updated_at2024-06-02 22:29:57.341488
descriptionA tiny, secure, URL-friendly, unique string ID generator for Rust
homepage
repositoryhttps://github.com/viz-rs/nano-id
max_upload_size
id379953
size20,190
Fangdun Tsai (fundon)

documentation

https://docs.rs/nano-id

README

nano-id

A tiny, secure, URL-friendly, unique string ID generator for Rust

Inspired by nanoid

Docs.rs docs Crates.io version Download

Features

  • Base58: ModueSymbhaswnPr123456789ABCDEFGHNRVfgctiUvzKqYTJkLxpZXjQW, (123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz)
  • Base62: ModuleSymbhasOwnPr0123456789ABCDEFGHNRVfgctiUvzKqYTJkLxpZXIjQW, (A-Za-z0-9)
  • Base64: ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW, (A-Za-z0-9_-)
  • Random: data by getrandom
  • Alphabet: custom with gen!(uid, 64, b"_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

Installation

cargo add nano-id

Usage

nano_id::base64::<21>();

// Custom ALPHABET
nano_id::gen!(
    uid,
    64,
    b"_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
);

uid::<21>();

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 28

cargo fmt