gr::http::throttle

Trait ThrottleStrategy

Source
pub trait ThrottleStrategy {
    // Required methods
    fn throttle(&self, flow_control_headers: Option<&FlowControlHeaders>);
    fn strategy(&self) -> ThrottleStrategyType;

    // Provided method
    fn throttle_for(&self, delay: Milliseconds) { ... }
}
Expand description

Throttle strategy

Required Methods§

Source

fn throttle(&self, flow_control_headers: Option<&FlowControlHeaders>)

Throttle the request based on optional flow control headers. Implementors might use the headers to adjust the throttling or ignore them altogether. Ex. strategies could be a fixed delay, random, or based on rate limiting headers.

Source

fn strategy(&self) -> ThrottleStrategyType

Return strategy type

Provided Methods§

Source

fn throttle_for(&self, delay: Milliseconds)

Throttle for specific amount of time.

Implementors§