use crate::container::InjectionContainer;
use serde::Serialize;
use std::any::Any;
pub trait Component: Any + Send + Sync {
fn component_name() -> &'static str;
fn from_container() -> impl Future<Output = &'static Self> + Send;
fn destroy(&self) -> impl Future<Output = ()> + Send{
async{}
}
}
#[cfg(feature = "config")]
pub trait Configure: serde::de::DeserializeOwned+ Serialize + Default + Send + Sync + 'static {
fn prefix() -> &'static str;
fn from_container() -> Self {
InjectionContainer::get_config()
}
}