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
52
53
54
55
56
57
58
//! Facade-style ambient helpers.
//!
//! Inside a request task, these resolve the request-scoped `Container`
//! installed by `inject_container_mw` and hand you the underlying service.
//! Outside a request (e.g. in `main.rs` before the server starts) they
//! panic — use `Container` directly in that case.
//!
//! Laravel's `Cache::put()`, `Mail::to()`, `DB::connection()` etc. work this
//! way: an ambient container resolves the right concrete implementation
//! without each call site having to plumb a `$container` reference.
//! Anvilforge's version is opt-in — handlers that take `State<Container>`
//! work just as well, and the explicit signature is recommended in
//! library code.
use crate;
/// The current request's container. Panics outside a request task.
/// Default DB driver pool. `let users = User::query().get(&db()).await?;`
///
/// Multi-driver friendly: returns the `cast::Pool` enum that the user's
/// `DATABASE_URL` resolved to.
/// Default cache store.
/// Default queue.
/// Default mailer.
/// Storage manager.
/// Event bus.
/// Application config (`APP_NAME`, `APP_ENV`, `APP_KEY`, `APP_URL`, …).