ids_service 0.1.5

Library that allows to generate unique Ids.
Documentation

Build status Bitbucket issues

ids_service

Library that allows generating unique ids. It loads ids in cache if the cache reaches a lower limit then a fill thread is started. If the cache is empty (the number of requests is too high) an id is calculated on the fly. This will slow down obtaining the id but there is no error when the cache is empty. To generate unique ids the library uses a random number generator and a SHA256 hash for the id as String type. For type u128 it's from the random number generator.

Quick Start

Use of cached service:

extern crate ids_service;
use ids_service::ids::*;

let mut ids: IdsService<String> = IdsService::new( ConfigIdsService::default());
println!("Get an id as String:"); ids.get_id();

// Use iterator
for id in ids.iter() {
     println!("Id: {}",id);
}

Use of helper function:

extern crate ids_service;
use ids_service::ids::*;

let id = create_id_as_string();

Run example

cargo run --example main

Links

Releases

  • 0.1.5 Update readme and comments
  • 0.1.4 Add two helper function to create on fly id create_id_as_u128 and create_id_as_string
  • 0.1.0 to 0.1.3 Non functional, some adaptation for crates.io and bitbucket pipelines