atomic-snowflake 11.1.0

Zero-dependency lock-free monotonic 64-bit Snowflake ID, 128-bit ULID, and RFC 9562 UUIDv7 generators with stack-buffered Crockford Base32 and hyphenated hex codecs.
Documentation
use super::*;

/// Formats [`IdError`] as a human-readable diagnostic message.
impl fmt::Display for IdError {
    /// Writes the error description to `f`.
    ///
    /// # Arguments
    ///
    /// - `&mut fmt::Formatter<'_>` - The destination formatter.
    ///
    /// # Returns
    ///
    /// - `fmt::Result` - Formatting outcome.
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let message: &str = match self {
            Self::NodeIdOutOfRange => ERR_NODE_ID_OUT_OF_RANGE,
            Self::InvalidUlidLength => ERR_INVALID_ULID_LENGTH,
            Self::InvalidUlidCharacter => ERR_INVALID_ULID_CHAR,
            Self::UlidOverflow => ERR_ULID_OVERFLOW,
            Self::InvalidUuidFormat => ERR_INVALID_UUID_FORMAT,
            Self::InvalidSnowflakeString => ERR_INVALID_SNOWFLAKE_STR,
        };
        f.write_str(message)
    }
}

/// Marks [`IdError`] as a standard error type.
impl Error for IdError {}