[package]
name = "sfid"
version = "0.1.4"
edition = "2024"
license = "MulanPSL-2.0"
repository = "https://github.com/js0-site/rust.git"
homepage = "https://github.com/js0-site/rust/tree/main/sfid"
description = "Distributed Snowflake ID generator with Redis-based auto machine ID allocation / 基于 Redis 自动分配机器号的分布式雪花 ID 生成器"
keywords = ["snowflake", "id-generator", "distributed", "redis", "unique-id"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = [ "--cfg", "docsrs" ]

[features]
default = ["snowflake", "auto_pid"]
snowflake = ["dep:coarsetime"]
auto_pid = ["snowflake", "dep:fred", "dep:xkv", "dep:uuid", "dep:tokio", "dep:xbin", "dep:rand", "dep:log"]
parse = []

[dependencies]
coarsetime = { version = "0.1.36", optional = true }
fred = { version = "10.1.0", optional = true }
fs4 = { version = "0.13.1", features = ["tokio"] }
log = { version = "0.4", optional = true }
machine-uid = "0.5.4"
rand = { version = "0.9", optional = true }
thiserror = "2.0.17"
tokio = { version = "1.48.0", features = ["rt", "time"], optional = true }
tracing = "0.1.44"
uuid = { version = "1", features = ["v4"], optional = true }
xbin = { version = "0.1.9", optional = true }
xkv = { version = "0.1", features = ["r"], optional = true }

[dev-dependencies]
aok = "0.1.18"
log_init = "0.1.34"
xboot = "0.1.35"

[dev-dependencies.static_init]
version = "1.0.4"
features = [ "parking_lot" ]

[dev-dependencies.tokio]
version = "1.48.0"
features = [ "macros", "rt", "rt-multi-thread", "time", "sync" ]