Struct actix_governor::Governor
source · pub struct Governor<K: KeyExtractor, M: RateLimitingMiddleware<QuantaInstant>> { /* private fields */ }
Expand description
Governor middleware factory.
Implementations§
source§impl<K: KeyExtractor, M: RateLimitingMiddleware<QuantaInstant>> Governor<K, M>
impl<K: KeyExtractor, M: RateLimitingMiddleware<QuantaInstant>> Governor<K, M>
sourcepub fn new(config: &GovernorConfig<K, M>) -> Self
pub fn new(config: &GovernorConfig<K, M>) -> Self
Create new governor middleware factory from configuration.
Trait Implementations§
source§impl<S, B, K> Transform<S, ServiceRequest> for Governor<K, NoOpMiddleware>where
K: KeyExtractor,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
impl<S, B, K> Transform<S, ServiceRequest> for Governor<K, NoOpMiddleware>where K: KeyExtractor, S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>, B: MessageBody,
§type Response = ServiceResponse<EitherBody<B>>
type Response = ServiceResponse<EitherBody<B>>
Responses produced by the service.
§type Transform = GovernorMiddleware<S, K, NoOpMiddleware>
type Transform = GovernorMiddleware<S, K, NoOpMiddleware>
The
TransformService
value created by this factory§type Future = Ready<Result<<Governor<K, NoOpMiddleware> as Transform<S, ServiceRequest>>::Transform, <Governor<K, NoOpMiddleware> as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<Governor<K, NoOpMiddleware> as Transform<S, ServiceRequest>>::Transform, <Governor<K, NoOpMiddleware> as Transform<S, ServiceRequest>>::InitError>>
The future response value.
source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
source§impl<S, B, K> Transform<S, ServiceRequest> for Governor<K, StateInformationMiddleware>where
K: KeyExtractor,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
<S as Service<ServiceRequest>>::Future: Unpin,
impl<S, B, K> Transform<S, ServiceRequest> for Governor<K, StateInformationMiddleware>where K: KeyExtractor, S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>, B: MessageBody, <S as Service<ServiceRequest>>::Future: Unpin,
§type Response = ServiceResponse<EitherBody<B>>
type Response = ServiceResponse<EitherBody<B>>
Responses produced by the service.
§type Transform = GovernorMiddleware<S, K, StateInformationMiddleware>
type Transform = GovernorMiddleware<S, K, StateInformationMiddleware>
The
TransformService
value created by this factory§type Future = Ready<Result<<Governor<K, StateInformationMiddleware> as Transform<S, ServiceRequest>>::Transform, <Governor<K, StateInformationMiddleware> as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<Governor<K, StateInformationMiddleware> as Transform<S, ServiceRequest>>::Transform, <Governor<K, StateInformationMiddleware> as Transform<S, ServiceRequest>>::InitError>>
The future response value.
source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl<K, M> !RefUnwindSafe for Governor<K, M>
impl<K, M> Send for Governor<K, M>where K: Send, M: Send + Sync, <K as KeyExtractor>::Key: Send + Sync,
impl<K, M> Sync for Governor<K, M>where K: Sync, M: Send + Sync, <K as KeyExtractor>::Key: Send + Sync,
impl<K, M> Unpin for Governor<K, M>where K: Unpin,
impl<K, M> !UnwindSafe for Governor<K, M>
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