rainier-container 1.0.0

Rainier's IoC container, service providers, application lifecycle and facade machinery.
Documentation
rainier-container-1.0.0 has been yanked.

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 — Laravel's Illuminate\Container + Foundation\Application + Support\Facades — 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(()) }