Trait mas_storage::user::UserEmailRepository

source ·
pub trait UserEmailRepository: Send + Sync {
    type Error;

Show 13 methods // Required methods fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 User, email: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_primary<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn all<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<Vec<UserEmail>, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list<'life0, 'life1, 'async_trait>( &'life0 mut self, filter: UserEmailFilter<'life1>, pagination: Pagination, ) -> Pin<Box<dyn Future<Output = Result<Page<UserEmail>, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn count<'life0, 'life1, 'async_trait>( &'life0 mut self, filter: UserEmailFilter<'life1>, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, user: &'life3 User, email: String, ) -> Pin<Box<dyn Future<Output = Result<UserEmail, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn remove<'life0, 'async_trait>( &'life0 mut self, user_email: UserEmail, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn mark_as_verified<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, user_email: UserEmail, ) -> Pin<Box<dyn Future<Output = Result<UserEmail, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_as_primary<'life0, 'life1, 'async_trait>( &'life0 mut self, user_email: &'life1 UserEmail, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_verification_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, user_email: &'life3 UserEmail, max_age: Duration, code: String, ) -> Pin<Box<dyn Future<Output = Result<UserEmailVerification, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn find_verification_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, user_email: &'life2 UserEmail, code: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmailVerification>, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn consume_verification_code<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, verification: UserEmailVerification, ) -> Pin<Box<dyn Future<Output = Result<UserEmailVerification, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait;
}
Expand description

A UserEmailRepository helps interacting with UserEmail 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<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lookup an UserEmail by its ID

Returns None if no UserEmail was found

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

source

fn find<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 User, email: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Lookup an UserEmail by its email address for a User

Returns None if no matching UserEmail was found

§Parameters
  • user: The User for whom to lookup the UserEmail
  • email: The email address to lookup
§Errors

Returns Self::Error if the underlying repository fails

source

fn get_primary<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the primary UserEmail of a User

Returns None if no the user has no primary UserEmail

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

source

fn all<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<Vec<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all UserEmail of a User

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

source

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

List UserEmail with the given filter and pagination

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

Returns Self::Error if the underlying repository fails

source

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

Count the UserEmail with the given filter

§Parameters
  • filter: The filter parameters
§Errors

Returns Self::Error if the underlying repository fails

source

fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, user: &'life3 User, email: String, ) -> Pin<Box<dyn Future<Output = Result<UserEmail, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a new UserEmail for a User

Returns the newly created UserEmail

§Parameters
  • rng: The random number generator to use
  • clock: The clock to use
  • user: The User for whom to create the UserEmail
  • email: The email address of the UserEmail
§Errors

Returns Self::Error if the underlying repository fails

source

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

Delete a UserEmail

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

source

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

Mark a UserEmail as verified

Returns the updated UserEmail

§Parameters
  • clock: The clock to use
  • user_email: The UserEmail to mark as verified
§Errors

Returns Self::Error if the underlying repository fails

source

fn set_as_primary<'life0, 'life1, 'async_trait>( &'life0 mut self, user_email: &'life1 UserEmail, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a UserEmail as primary

§Parameters
  • user_email: The UserEmail to mark as primary
§Errors

Returns Self::Error if the underlying repository fails

source

fn add_verification_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, user_email: &'life3 UserEmail, max_age: Duration, code: String, ) -> Pin<Box<dyn Future<Output = Result<UserEmailVerification, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add a UserEmailVerification for a UserEmail

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

source

fn find_verification_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, user_email: &'life2 UserEmail, code: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmailVerification>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Find a UserEmailVerification for a UserEmail by its code

Returns None if no matching UserEmailVerification was found

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

source

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

Consume a UserEmailVerification

Returns the consumed UserEmailVerification

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

Implementations on Foreign Types§

source§

impl<R> UserEmailRepository for Box<R>

source§

type Error = <R as UserEmailRepository>::Error

source§

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

source§

fn find<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 User, email: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn get_primary<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn all<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<Vec<UserEmail>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

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

source§

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

source§

fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, user: &'life3 User, email: String, ) -> Pin<Box<dyn Future<Output = Result<UserEmail, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

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

source§

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

source§

fn set_as_primary<'life0, 'life1, 'async_trait>( &'life0 mut self, user_email: &'life1 UserEmail, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn add_verification_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, user_email: &'life3 UserEmail, max_age: Duration, code: String, ) -> Pin<Box<dyn Future<Output = Result<UserEmailVerification, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

fn find_verification_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, user_email: &'life2 UserEmail, code: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserEmailVerification>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

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

Implementors§

source§

impl<R, F, E> UserEmailRepository for MapErr<R, F>

source§

type Error = E