pub struct MemoryStorage(/* private fields */);Expand description
Captcha storage implementation using an in-memory HashMap.
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance of MemoryStorage.
Trait Implementations§
Source§impl CaptchaStorage for MemoryStorage
impl CaptchaStorage for MemoryStorage
Source§type Error = Infallible
type Error = Infallible
This storage does not return any error.
Source§async fn store_answer(&self, answer: String) -> Result<String, Self::Error>
async fn store_answer(&self, answer: String) -> Result<String, Self::Error>
Store the captcha token and answer.
Source§async fn get_answer(&self, token: &str) -> Result<Option<String>, Self::Error>
async fn get_answer(&self, token: &str) -> Result<Option<String>, Self::Error>
Returns the answer of the captcha token. This method will return None if the token is not exist.
Source§async fn clear_expired(
&self,
expired_after: Duration,
) -> Result<(), Self::Error>
async fn clear_expired( &self, expired_after: Duration, ) -> Result<(), Self::Error>
Clear the expired captcha.
Auto Trait Implementations§
impl !Freeze for MemoryStorage
impl !RefUnwindSafe for MemoryStorage
impl Send for MemoryStorage
impl Sync for MemoryStorage
impl Unpin for MemoryStorage
impl UnwindSafe for MemoryStorage
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