pub struct RateLimitResponse {
pub status_code: u16,
pub headers: RateLimitHeaders,
pub body: Value,
}Expand description
Rate limit response
Encapsulates the complete response information when rate limited, including status code, headers, and response body.
Fields§
§status_code: u16HTTP status code
headers: RateLimitHeadersResponse headers
body: ValueJSON response body
Implementations§
Source§impl RateLimitResponse
impl RateLimitResponse
Sourcepub fn rejected(
result: &RateLimitResult,
limit: u64,
strategy: RateLimitResponseStrategy,
) -> Self
pub fn rejected( result: &RateLimitResult, limit: u64, strategy: RateLimitResponseStrategy, ) -> Self
Creates a rate-limited response
result: rate limit result (must be rejected)limit: maximum number of requests within the windowstrategy: response strategy
Sourcepub fn allowed(result: &RateLimitResult, limit: u64) -> Self
pub fn allowed(result: &RateLimitResult, limit: u64) -> Self
Creates an allowed response (contains only headers, no body)
Trait Implementations§
Source§impl Clone for RateLimitResponse
impl Clone for RateLimitResponse
Source§fn clone(&self) -> RateLimitResponse
fn clone(&self) -> RateLimitResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RateLimitResponse
impl RefUnwindSafe for RateLimitResponse
impl Send for RateLimitResponse
impl Sync for RateLimitResponse
impl Unpin for RateLimitResponse
impl UnsafeUnpin for RateLimitResponse
impl UnwindSafe for RateLimitResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more