Trait UserRegistrationTokenRepository

Source
pub trait UserRegistrationTokenRepository: Send + Sync {
    type Error;

    // Required methods
    fn lookup<'life0, 'async_trait>(
        &'life0 mut self,
        id: Ulid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_token<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        token: String,
        usage_limit: Option<u32>,
        expires_at: Option<DateTime<Utc>>,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn use_token<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        token: UserRegistrationToken,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        token: UserRegistrationToken,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unrevoke<'life0, 'async_trait>(
        &'life0 mut self,
        token: UserRegistrationToken,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_expiry<'life0, 'async_trait>(
        &'life0 mut self,
        token: UserRegistrationToken,
        expires_at: Option<DateTime<Utc>>,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_usage_limit<'life0, 'async_trait>(
        &'life0 mut self,
        token: UserRegistrationToken,
        usage_limit: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 mut self,
        filter: UserRegistrationTokenFilter,
        pagination: Pagination,
    ) -> Pin<Box<dyn Future<Output = Result<Page<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 mut self,
        filter: UserRegistrationTokenFilter,
    ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A UserRegistrationTokenRepository helps interacting with UserRegistrationToken saved in the storage backend

Required Associated Types§

Source

type Error

The error type returned by the repository

Required Methods§

Source

fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lookup a UserRegistrationToken by its ID

Returns None if no UserRegistrationToken was found

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

Source

fn find_by_token<'life0, 'life1, 'async_trait>( &'life0 mut self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lookup a UserRegistrationToken by its token string

Returns None if no UserRegistrationToken was found

§Parameters
  • token: The token string to lookup
§Errors

Returns Self::Error if the underlying repository fails

Source

fn add<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, token: String, usage_limit: Option<u32>, expires_at: Option<DateTime<Utc>>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a new UserRegistrationToken

Returns the newly created UserRegistrationToken

§Parameters
  • rng: The random number generator to use
  • clock: The clock used to generate timestamps
  • token: The token string
  • usage_limit: Optional limit on how many times the token can be used
  • expires_at: Optional expiration time for the token
§Errors

Returns Self::Error if the underlying repository fails

Source

fn use_token<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, token: UserRegistrationToken, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Increment the usage count of a UserRegistrationToken

Returns the updated UserRegistrationToken

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

Source

fn revoke<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, token: UserRegistrationToken, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revoke a UserRegistrationToken

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

Source

fn unrevoke<'life0, 'async_trait>( &'life0 mut self, token: UserRegistrationToken, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unrevoke a previously revoked UserRegistrationToken

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

Source

fn set_expiry<'life0, 'async_trait>( &'life0 mut self, token: UserRegistrationToken, expires_at: Option<DateTime<Utc>>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the expiration time of a UserRegistrationToken

§Parameters
  • token: The UserRegistrationToken to update
  • expires_at: The new expiration time, or None to remove the expiration
§Errors

Returns Self::Error if the underlying repository fails

Source

fn set_usage_limit<'life0, 'async_trait>( &'life0 mut self, token: UserRegistrationToken, usage_limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the usage limit of a UserRegistrationToken

§Parameters
  • token: The UserRegistrationToken to update
  • usage_limit: The new usage limit, or None to remove the limit
§Errors

Returns Self::Error if the underlying repository fails

Source

fn list<'life0, 'async_trait>( &'life0 mut self, filter: UserRegistrationTokenFilter, pagination: Pagination, ) -> Pin<Box<dyn Future<Output = Result<Page<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List UserRegistrationTokens based on the provided filter

Returns a list of matching UserRegistrationTokens

§Parameters
  • filter: The filter to apply
  • pagination: The pagination parameters
§Errors

Returns Self::Error if the underlying repository fails

Source

fn count<'life0, 'async_trait>( &'life0 mut self, filter: UserRegistrationTokenFilter, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count UserRegistrationTokens based on the provided filter

Returns the number of matching UserRegistrationTokens

§Parameters
  • filter: The filter to apply
§Errors

Returns Self::Error if the underlying repository fails

Implementations on Foreign Types§

Source§

impl<R> UserRegistrationTokenRepository for Box<R>

Source§

type Error = <R as UserRegistrationTokenRepository>::Error

Source§

fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn find_by_token<'life0, 'life1, 'async_trait>( &'life0 mut self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn add<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, token: String, usage_limit: Option<u32>, expires_at: Option<DateTime<Utc>>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn use_token<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, token: UserRegistrationToken, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn revoke<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, token: UserRegistrationToken, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn unrevoke<'life0, 'async_trait>( &'life0 mut self, token: UserRegistrationToken, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn set_expiry<'life0, 'async_trait>( &'life0 mut self, token: UserRegistrationToken, expires_at: Option<DateTime<Utc>>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn set_usage_limit<'life0, 'async_trait>( &'life0 mut self, token: UserRegistrationToken, usage_limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistrationToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list<'life0, 'async_trait>( &'life0 mut self, filter: UserRegistrationTokenFilter, pagination: Pagination, ) -> Pin<Box<dyn Future<Output = Result<Page<UserRegistrationToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn count<'life0, 'async_trait>( &'life0 mut self, filter: UserRegistrationTokenFilter, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§