wd_sonyflake 0.0.1

unique id generator by sonyflake
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 21.92 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • woshihaoren4

Sonyflake 雪花算法

Overview

|--0--|--timestamp--|--node_id--|--count--|

|-- 1 --|---- 41 -----|-- 10 --|--12 --|

Example

use wd_sonyflake::SonyFlakeEntity;

fn main() {
    let sfe = SonyFlakeEntity::new_default();
    let start = std::time::Instant::now();
    for i in 0..1000000{
        let id = sfe.get_id();
        // println!("生成一条id:{:x}",id)
    }
    println!("一百万条id需要:{:?}s", start.elapsed().as_secs());
}