Scru128Generator::with_rand08()
to make integration withrand
explicit
- Blanket implementation of
Scru128Rng
forrand::RngCore
- Name of
gen
module back togenerator
to avoid forthcominggen
keywordgen
remains as an alias togenerator
for backward compatibility
- Updated dev dependencies
- Name of
generator
module togen
generator
remains as an alias togen
for backward compatibility
- Improved documentation about generator's clock rollback behavior
Most notably, v3 switches the letter case of generated IDs from uppercase (e.g., "036Z951MHJIKZIK2GSL81GR7L") to lowercase (e.g., "036z951mhjikzik2gsl81gr7l"), though it is technically not supposed to break existing code because SCRU128 is a case-insensitive scheme. Other changes include the removal of deprecated APIs and reorganization of crate feature flags.
- Deprecated items:
scru128()
andscru128_string()
Scru128Id::encode_buf()
Scru128Generator#generate_core()
Scru128Generator#last_status()
andgenerator::Status
- Dependency on
once_cell
crateglobal_gen
feature now usesstd::sync::OnceLock
(stable since Rust 1.70)
- Letter case of generated IDs from uppercase to lowercase
Scru128Generator
's prerequisite fromrand::RngCore
toScru128Rng
to relax hard dependency onrand
crate- Internal representation of
Scru128Id
fromu128
to big-endian byte array representation - Edge case behavior of generator functions' rollback allowance handling
rand
feature flag to opt out dependency onrand
cratedefault_rng
feature flag to opt out defaultDefaultRng
global_gen
feature flag to opt out default global generatorconst
qualifier toScru128Id::encode()
Scru128Id::as_bytes()
andimpl AsRef<[u8]>
forScru128Id
- Internal representation and error messages of
ParseError
- Internal representation and error messages of
ParseError
Scru128Id::from_bytes()
Scru128Id::try_from_str()
- Updated dev dependencies
- Disabled unnecessary features of dev dependencies
- Minor documentation updates
- Minor refactoring and documentation updates
fmt::Display
implementation ofScru128Id
; it now supports width, fill/align, and precision flags (e.g.,{:32}
,{:^9.5}
), which used to be ignored
generate_or_abort()
andgenerate_or_abort_core()
toScru128Generator
(formerly named asgenerate_no_rewind()
andgenerate_core_no_rewind()
)Scru128Generator#generate_or_reset_core()
Scru128Generator#generate_core()
Scru128Generator#last_status()
andgenerator::Status
generate_no_rewind()
andgenerate_core_no_rewind()
toScru128Generator
(experimental)
- Improved documentation about generator method flavors
serde
deserializer behavior:- Now it tries to parse byte slice also as textual representation, not only as 128-bit byte array
- Now it deserializes
u128
values
ParseError
structure to embed debug information
- Iterator implementation to
Scru128Generator
to make it work as infinite iterator
Scru128Id::encode()
Scru128Id::encode_buf()
- Updated dev dependencies
new()
andnew_string()
scru128()
andscru128_string()
to promotescru128::new()
syntax overuse scru128::scru128;
- Updated dev dependencies
const
qualifier toScru128Generator::with_rng()
to allow const initialization with e.g.rand::rngs::OsRng
- Reverted change to
scru128()
andscru128_string()
in v2.1.2 (process fork protection) on systems other than Unix
scru128()
andscru128_string()
to reset state when process ID changesgenerate_core()
to updatecounter_hi
whentimestamp
passed < 1000
- Updated
once_cell
to 1.12
generate_core()
to reject zero astimestamp
value
generate_core()
andlast_status()
toScru128Generator
- Experimental
no_std
support
- Textual representation: 26-digit Base32 -> 25-digit Base36
- Field structure: {
timestamp
: 44 bits,counter
: 28 bits,per_sec_random
: 24 bits,per_gen_random
: 32 bits } -> {timestamp
: 48 bits,counter_hi
: 24 bits,counter_lo
: 24 bits,entropy
: 32 bits } - Timestamp epoch: 2020-01-01 00:00:00.000 UTC -> 1970-01-01 00:00:00.000 UTC
- Counter overflow handling: stall generator -> increment timestamp
- Default RNG type: rand::rngs::StdRng -> newtype that wraps concrete RNG
- Rust edition: 2018 -> 2021
log
feature as counter overflow is no longer likely to occurTIMESTAMP_BIAS
Scru128Id#counter()
,Scru128Id#per_sec_random()
,Scru128Id#per_gen_random()
Scru128Id#as_u128()
Scru128Id#counter_hi()
,Scru128Id#counter_lo()
,Scru128Id#entropy()
Scru128Id#to_u128()
,Scru128Id#to_bytes()
- Compact binary serde format
- Initial stable release