Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viz-rs/nano-id
Nano ID
https://github.com/viz-rs/nano-id
Last synced: about 1 month ago
JSON representation
Nano ID
- Host: GitHub
- URL: https://github.com/viz-rs/nano-id
- Owner: viz-rs
- License: apache-2.0
- Created: 2021-04-06T18:28:07.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-02T22:28:26.000Z (7 months ago)
- Last Synced: 2024-11-07T03:07:54.739Z (2 months ago)
- Language: Rust
- Size: 37.1 KB
- Stars: 12
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
nano-id
## 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
```shell
cargo add nano-id
```## Usage
```rust
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.[getrandom]: https://github.com/rust-random/getrandom