pub struct TicketSender(/* private fields */);
Expand description
Channel sender to send response ratelimit information to the ratelimiter.
This is used by the ratelimiter consumer (such as an API client) once a
request has been granted via TicketReceiver
.
If a response results in available ratelimit headers, send them via
headers
to the ratelimiter backend. If a response results in an
error - such as a server error or request cancellation - send None
.
Implementations§
source§impl TicketSender
impl TicketSender
sourcepub fn headers(
self,
headers: Option<RatelimitHeaders>,
) -> Result<(), Option<RatelimitHeaders>>
pub fn headers( self, headers: Option<RatelimitHeaders>, ) -> Result<(), Option<RatelimitHeaders>>
Send the response’s ratelimit headers to the ratelimiter.
This will allow the ratelimiter to complete the cycle and acknowledge that the request has been completed. This must be done so that the ratelimiter can process information such as whether there’s a global ratelimit.
§Errors
Returns the input headers if the ratelimiter has dropped the receiver half. This may happen if the ratelimiter is dropped or if a timeout has occurred.