mod components;
mod container;
mod error;
mod providers;
use crate::State;
use std::{
any::{Any, TypeId},
sync::Arc,
};
pub use components::{Component, ComponentRegistry};
pub use container::DependencyContainer;
pub use error::DependencyInjectionError;
pub use providers::{Provider, ProviderRegistry};
pub trait Build: Clone + Send + Sync + 'static {
fn build(state: &State) -> Result<Self, DependencyInjectionError>
where
Self: Sized;
}
pub trait HasDeps: Build {
fn deps() -> Vec<TypeId> {
Vec::new()
}
}
pub(crate) type Injectable = Arc<dyn Any + Send + Sync>;