ayun_core/traits/instance.rs
use crate::{app, errors::ContainerError, support::type_name, Container, Result};
pub trait InstanceTrait: std::any::Any + Send + Sync {
    fn name() -> String {
        type_name::<Self>()
    }
    fn register(container: &Container) -> Result<Self, ContainerError>
    where
        Self: Sized;
    fn boot() -> Result<(), ContainerError>
    where
        Self: Sized,
    {
        Ok(())
    }
    fn facade() -> &'static Self
    where
        Self: Sized,
    {
        app()
            .resolve::<Self>()
            .unwrap_or_else(|err| panic!("{err}"))
    }
}