pub struct Controller<T: Store, B: MessageBody = BoxBody> { /* private fields */ }Implementations§
Source§impl<T: Store, B: MessageBody> Controller<T, B>
 
impl<T: Store, B: MessageBody> Controller<T, B>
Sourcepub fn with_do_rate_limit(self, f: fn(&HttpRequest) -> bool) -> Self
 
pub fn with_do_rate_limit(self, f: fn(&HttpRequest) -> bool) -> Self
Determine if a request needs to be checked for rate limiting. If not set, all requests will be checked.
Sourcepub fn with_find_identifier(self, f: fn(&HttpRequest) -> T::Key) -> Self
 
pub fn with_find_identifier(self, f: fn(&HttpRequest) -> T::Key) -> Self
Extract the identifier from the request, such as the IP address or other information.
Sourcepub fn on_rate_limit_error(
    self,
    f: fn(&HttpRequest, Error) -> HttpResponse<B>,
) -> Self
 
pub fn on_rate_limit_error( self, f: fn(&HttpRequest, Error) -> HttpResponse<B>, ) -> Self
Set the HttpResponse<B> to be returned when a rate-limit error occurs.
Sourcepub fn on_store_error(
    self,
    f: fn(&HttpRequest, <T as Store>::Error) -> HttpResponse<B>,
) -> Self
 
pub fn on_store_error( self, f: fn(&HttpRequest, <T as Store>::Error) -> HttpResponse<B>, ) -> Self
Set the HttpResponse<B> to be returned when an error occurs in the Store
(such as Redis or other storage structures).
Sourcepub fn on_success(self, f: fn(&HttpRequest, &T, Option<&T::Value>)) -> Self
 
pub fn on_success(self, f: fn(&HttpRequest, &T, Option<&T::Value>)) -> Self
Execute this function whenever a request successfully passes (including those skipped by Self::fn_do_rate_limit).
Trait Implementations§
Source§impl<T: Clone + Store, B: Clone + MessageBody> Clone for Controller<T, B>
 
impl<T: Clone + Store, B: Clone + MessageBody> Clone for Controller<T, B>
Source§fn clone(&self) -> Controller<T, B>
 
fn clone(&self) -> Controller<T, B>
Returns a duplicate of the value. Read more
1.0.0 · 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<T, B> Freeze for Controller<T, B>
impl<T, B> RefUnwindSafe for Controller<T, B>
impl<T, B> Send for Controller<T, B>
impl<T, B> Sync for Controller<T, B>
impl<T, B> Unpin for Controller<T, B>
impl<T, B> UnwindSafe for Controller<T, B>
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