wd_sonyflake

Crates.iowd_sonyflake
lib.rswd_sonyflake
version0.0.1
sourcesrc
created_at2020-12-07 08:04:07.522136
updated_at2020-12-07 08:04:07.522136
descriptionunique id generator by sonyflake
homepage
repository
max_upload_size
id320399
size14,717
teshin (woshihaoren4)

documentation

README

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());
}
Commit count: 0

cargo fmt