Crate ferroid

Source

Macros§

define_snowflake_id
Field Ordering Semantics

Structs§

AtomicSnowflakeGenerator
A lock-free Snowflake ID generator suitable for multi-threaded environments.
BasicSnowflakeGenerator
A non-concurrent Snowflake ID generator suitable for single-threaded environments.
GeneratorFuture
A future that polls a SnowflakeGenerator until it is ready to produce an ID.
LockSnowflakeGenerator
A lock-based Snowflake ID generator suitable for multi-threaded environments.
MonotonicClock
A monotonic time source that returns elapsed time since process start, offset from a user-defined epoch.
SmolSleep
An implementation of SleepProvider using Smol’s timer.
SmolSleepFuture
Internal future returned by SmolSleep::sleep_for.
SnowflakeDiscordId
A 64-bit Snowflake ID using the Discord layout
SnowflakeInstagramId
A 64-bit Snowflake ID using the Instagram layout
SnowflakeLongId
A 128-bit Snowflake ID using a hybrid layout.
SnowflakeMastodonId
A 64-bit Snowflake ID using the Mastodon layout
SnowflakeTwitterId
A 64-bit Snowflake ID using the Twitter layout
TokioSleep
An implementation of SleepProvider using Tokio’s timer.

Enums§

Error
IdGenStatus
Represents the result of attempting to generate a new Snowflake ID.

Constants§

CUSTOM_EPOCH
Custom epoch: Wednesday, January 1, 2025 00:00:00 UTC
DISCORD_EPOCH
Discord epoch: Thursday, January 1, 2015 00:00:00 UTC
INSTAGRAM_EPOCH
Instagram epoch: Saturday, January 1, 2011 00:00:00 UTC
MASTODON_EPOCH
Mastodon epoch: Thursday, January 1, 1970 00:00:00 UTC
TWITTER_EPOCH
Twitter epoch: Thursday, November 4, 2010 1:42:54.657 UTC

Traits§

BeBytes
A trait for types that can be encoded to and decoded from big-endian bytes.
SleepProvider
A trait that abstracts over how to sleep for a given Duration in async contexts.
Snowflake
A trait representing a layout-compatible Snowflake ID generator.
SnowflakeBase32Ext
A trait for types that can be encoded to and decoded from base32 (crockford) strings.
SnowflakeGenerator
A minimal interface for generating Snowflake IDs
SnowflakeGeneratorAsyncExt
Extension trait for asynchronously generating Snowflake IDs.
SnowflakeGeneratorAsyncSmolExt
Extension trait for asynchronously generating Snowflake IDs using the smol async runtime.
SnowflakeGeneratorAsyncTokioExt
Extension trait for asynchronously generating Snowflake IDs using the tokio async runtime.
TimeSource
A trait for time sources that return a monotonic or wall-clock timestamp.
ToU64
Trait for converting numeric-like values into a u64.

Type Aliases§

Result