1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! `UserLoader<S>` — how to load a user from a session ID + state (A9).
//!
//! The application implements this for its `User` type to tell the framework
//! how to load a user from the session-stored ID and the application state
//! (which typically carries a `Db` handle). This is the loading seam between
//! the session and the database.
//!
//! # Example
//!
//! ```ignore
//! impl arcature::UserLoader<AppState> for User {
//! type Error = sea_orm::DbErr;
//! async fn load_user(id: &Uuid, state: &AppState) -> Result<Option<User>, DbErr> {
//! // load from DB via state.db
//! }
//! }
//! ```
use Future;
use crateAuthUser;
/// How to load a [`AuthUser`] from its session ID and application state.
///
/// The app implements this for its user type. `Auth<U>` and
/// `OptionalAuth<U>` call `U::load_user(id, state)` to resolve the
/// authenticated user from the session.