Crate light_id

Source
Expand description

§light_id

light_id is a Rust crate for generating and manipulating light-weight IDs. It provides a flexible and customizable way to generate and switch between different bases for IDs.

§Features

  • Lightweight and customizable ID generation.
  • Switching IDs between different bases.
  • Skipping and iterating through IDs.

§Example

use light_id::{LightId, IdSwitcher};

let mut generator = LightId::new();
println!("Current ID: {}", generator.next());

let switcher = IdSwitcher::new("0123456789", "abcdef");
let switched_id = switcher.switch("2");
println!("Switched ID: {}", switched_id);

§Installation

Add the following lines to your Cargo.toml file:

[dependencies]
light-id = "0.1.0"

§Usage

§LightId

The LightId struct allows you to generate and manipulate IDs with various options.

use light_id::LightId;

let mut generator = LightId::new();
generator.increment();
println!("Current ID: {}", generator.current());

§IdSwitcher

The IdSwitcher struct facilitates switching IDs between different bases.

use light_id::IdSwitcher;

let switcher = IdSwitcher::new("0123456789", "abcdef");
let switched_id = switcher.switch("2");
println!("Switched ID: {}", switched_id);

§API Documentation

See the detailed documentation for each struct, including methods and usage examples.

§License

This crate is licensed under the MIT License.

§Changelog

  • 0.1.0 (2023-12-14): Initial release

Structs§

IdSwitcher
LightId

Constants§

DEFAULT_CHARACTERS