#[non_exhaustive]pub struct Captcha<S, F>where
S: CaptchaStorage,
F: CaptchaFinder,{ /* private fields */ }Expand description
The captcha middleware
The captcha middleware is used to check the captcha token and answer from
the request. You can use the CaptchaBuilder to create a new captcha
middleware.
§Note
You need to generate the captcha token and answer before, then the captcha
middleware will check the token and answer from the request using the finder
and storage you provided. The captcha middleware will insert the
CaptchaState into the depot, you can get the captcha state from the
depot using the CaptchaDepotExt::get_captcha_state trait, which is
implemented for the Depot.
Check the examples for more information.
Trait Implementations§
Source§impl<S, F> Handler for Captcha<S, F>where
S: CaptchaStorage,
F: CaptchaFinder,
impl<S, F> Handler for Captcha<S, F>where
S: CaptchaStorage,
F: CaptchaFinder,
Source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
_: &'life3 mut Response,
_: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
_: &'life3 mut Response,
_: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Source§fn arc(self) -> ArcHandlerwhere
Self: Sized,
fn arc(self) -> ArcHandlerwhere
Self: Sized,
Wrap to
ArcHandler.Source§fn hoop<H>(self, hoop: H) -> HoopedHandler
fn hoop<H>(self, hoop: H) -> HoopedHandler
Hoop this handler with middleware.
Auto Trait Implementations§
impl<S, F> Freeze for Captcha<S, F>where
F: Freeze,
impl<S, F> !RefUnwindSafe for Captcha<S, F>
impl<S, F> Send for Captcha<S, F>
impl<S, F> Sync for Captcha<S, F>
impl<S, F> Unpin for Captcha<S, F>where
F: Unpin,
impl<S, F> !UnwindSafe for Captcha<S, F>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more