use crate::ModuleBuildContext;
use std::any::Any;
pub trait Module: ModuleInterface {
type Submodules;
fn build(context: ModuleBuildContext<Self>) -> Self
where
Self: Sized;
}
#[cfg(not(feature = "thread_safe"))]
trait_alias!(
/// Submodules must be `'static` in order to be stored in other modules
/// (hence the `Any` requirement).
///
/// The `thread_safe` feature is turned off, so submodules do not need to
/// implement `Send` or `Sync`.
pub ModuleInterface = Any
);
#[cfg(feature = "thread_safe")]
trait_alias!(
/// Submodules must be `'static` in order to be stored in other modules
/// (hence the `Any` requirement).
///
/// The `thread_safe` feature is turned on, which requires submodules to
/// also implement `Send` and `Sync`.
pub ModuleInterface = Any + Send + Sync
);