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
40
41
42
43
44
45
46
47
48
49
50
51
//! `Model` - a thin, compile-time-only marker `#[derive(Model)]` (in
//! `larust-macros`) implements for every annotated struct, automatically.
//! Never written by hand.
//!
//! Exists so *generic* code (model factories first; later milestones add
//! more) can call `T::create(...)` without knowing the concrete struct -
//! the same "reach the real generated methods through a trait, nothing
//! resolved at runtime" shape `larust_repository::Repository` already
//! established, but for genericity over a single `#[derive(Model)]`
//! struct's own generated methods rather than storage-backend
//! abstraction. `Self::create` forwards to the struct's already-generated
//! *inherent* `create` - inherent methods take priority over trait
//! methods of the same name, so this doesn't recurse.
use AppError;
use Future;
/// Implemented automatically by `#[derive(Model)]`.
///
/// `-> impl Future<...> + Send` rather than a plain `async fn`, matching
/// `larust_repository::Repository`'s own established reasoning: trait
/// `async fn` doesn't propagate `Send` by default, and this needs to be
/// callable from axum handlers (and from generic code reached by them)
/// that require `Send` futures. The generated impl can still be written
/// as an ordinary `async fn` - its desugared return type already
/// satisfies `-> impl Future<...>`.