//! Tower middleware for rate limiting.
//!
//! This module provides the core Tower middleware components used to
//! enforce rate limiting in a framework-agnostic way.
//!
//! The middleware is composed of:
//! - [`RateLimitLayer`] — a middleware factory
//! - [`RateLimitService`] — per-request logic
//! - [`KeyExtractor`] — request-to-key mapping
//!
//! Framework-specific adapters (e.g. Axum) are built on top of this module.
/// Extracts a rate-limiting key from a request.
///
/// Implementations of this trait define how a request is mapped to a
/// logical identity (e.g. IP address, user ID, API key).
///
/// Returning `None` indicates that the request should not be rate-limited.