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
//! # rainier-container
//!
//! Rainier's inversion-of-control layer: the [`Container`] every component
//! registers into, the [`ServiceProvider`] two-phase lifecycle that wires them
//! together, the [`Application`] that drives it, and the [`Facade`] machinery
//! that makes services reachable as static proxies.
//!
//! These four live in one crate because they are one idea,
//! and because splitting them would only produce three crates that always
//! travel together.
//!
//! ```
//! use rainier_container::{Application, Container, ServiceProvider};
//! use rainier_support::Result;
//!
//! struct Greeter { greeting: String }
//! struct GreeterProvider;
//!
//! impl ServiceProvider for GreeterProvider {
//! fn register(&self, app: &Application) -> Result<()> {
//! app.singleton(|_: &Container| Ok(Greeter { greeting: "hello".into() }));
//! Ok(())
//! }
//! }
//!
//! # #[tokio::main] async fn main() -> Result<()> {
//! let app = Application::new(".");
//! app.register(GreeterProvider)?;
//! app.boot().await?;
//!
//! assert_eq!(app.resolve::<Greeter>()?.greeting, "hello");
//! # Ok(()) }
//! ```
pub use ;
pub use Container;
pub use ;
pub use ServiceProvider;
/// Re-exports the `boot_provider!` macro expands to. Not a stable API.