pub struct DynamicModule { /* private fields */ }Expand description
Runtime-built module for configuration-driven imports and providers.
Implementations§
Source§impl DynamicModule
impl DynamicModule
pub fn new(name: &'static str) -> Self
pub fn import<M>(self, module: M) -> Selfwhere
M: Module,
pub fn import_arc(self, module: Arc<dyn Module>) -> Self
pub fn provider(self, provider: ProviderDefinition) -> Self
pub fn export<T>(self) -> Self
pub fn export_named(self, token: impl Into<String>) -> Self
pub fn export_token(self, token: ProviderToken) -> Self
pub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn middleware_arc(self, middleware: Arc<dyn Middleware>) -> Self
pub fn controller(self, controller: ControllerDefinition) -> Self
pub fn route(self, route: RouteDefinition) -> Self
pub fn gateway(self, gateway: WebSocketGatewayDefinition) -> Self
pub fn message_pattern(self, pattern: MessagePatternDefinition) -> Self
pub fn global(self) -> Self
Trait Implementations§
Source§impl Clone for DynamicModule
impl Clone for DynamicModule
Source§fn clone(&self) -> DynamicModule
fn clone(&self) -> DynamicModule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Module for DynamicModule
impl Module for DynamicModule
Source§fn imports(&self) -> Vec<Arc<dyn Module>>
fn imports(&self) -> Vec<Arc<dyn Module>>
Imported modules that should be registered before this module.
Source§fn providers(&self) -> Result<Vec<ProviderDefinition>>
fn providers(&self) -> Result<Vec<ProviderDefinition>>
Providers exported into the application container.
Source§fn exports(&self) -> Result<Vec<ProviderToken>>
fn exports(&self) -> Result<Vec<ProviderToken>>
Providers this module exposes to importing modules.
Source§fn is_global(&self) -> bool
fn is_global(&self) -> bool
Whether exported providers should be visible to every module scope.
Source§fn middleware(&self) -> Vec<Arc<dyn Middleware>>
fn middleware(&self) -> Vec<Arc<dyn Middleware>>
Middleware applied to controllers and direct routes declared by this module.
Source§fn controllers(
&self,
_module_ref: &ModuleRef,
) -> Result<Vec<ControllerDefinition>>
fn controllers( &self, _module_ref: &ModuleRef, ) -> Result<Vec<ControllerDefinition>>
Controller route groups built with access to the provider container.
Source§fn routes(&self) -> Result<Vec<RouteDefinition>>
fn routes(&self) -> Result<Vec<RouteDefinition>>
Framework-neutral routes contributed directly by this module.
Source§fn gateways(
&self,
_module_ref: &ModuleRef,
) -> Result<Vec<WebSocketGatewayDefinition>>
fn gateways( &self, _module_ref: &ModuleRef, ) -> Result<Vec<WebSocketGatewayDefinition>>
WebSocket gateways contributed by this module.
Source§fn message_patterns(
&self,
_module_ref: &ModuleRef,
) -> Result<Vec<MessagePatternDefinition>>
fn message_patterns( &self, _module_ref: &ModuleRef, ) -> Result<Vec<MessagePatternDefinition>>
Microservice message patterns contributed by this module.
Source§fn on_application_bootstrap(
&self,
_module_ref: ModuleRef,
) -> BoxFuture<'static, Result<()>>
fn on_application_bootstrap( &self, _module_ref: ModuleRef, ) -> BoxFuture<'static, Result<()>>
Async lifecycle hook called by hosts that want startup work before serve.
Auto Trait Implementations§
impl !RefUnwindSafe for DynamicModule
impl !UnwindSafe for DynamicModule
impl Freeze for DynamicModule
impl Send for DynamicModule
impl Sync for DynamicModule
impl Unpin for DynamicModule
impl UnsafeUnpin for DynamicModule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more