pub struct BootApplication { /* private fields */ }Expand description
Built application with a resolved module graph and framework-neutral routes.
Implementations§
Source§impl BootApplication
impl BootApplication
Sourcepub fn builder() -> BootApplicationBuilder
pub fn builder() -> BootApplicationBuilder
Create an application builder.
Sourcepub fn module_names(&self) -> &[String]
pub fn module_names(&self) -> &[String]
Names of modules included in the application, in registration order.
Sourcepub fn routes(&self) -> &[RouteDefinition]
pub fn routes(&self) -> &[RouteDefinition]
Routes exposed by the application.
Sourcepub fn api_versioning(&self) -> Option<&ApiVersioning>
pub fn api_versioning(&self) -> Option<&ApiVersioning>
API versioning configuration used for HTTP route matching, when enabled.
Sourcepub fn gateways(&self) -> &[WebSocketGatewayDefinition]
pub fn gateways(&self) -> &[WebSocketGatewayDefinition]
WebSocket gateways exposed by the application.
Sourcepub fn message_patterns(&self) -> &[MessagePatternDefinition]
pub fn message_patterns(&self) -> &[MessagePatternDefinition]
Microservice message patterns exposed by the application.
Sourcepub fn discovery(&self) -> Result<DiscoveryService>
pub fn discovery(&self) -> Result<DiscoveryService>
Build a discovery snapshot for modules, routes, gateways, and message patterns.
Sourcepub fn reflector(&self) -> Result<Reflector>
pub fn reflector(&self) -> Result<Reflector>
Build a discovery snapshot and metadata reflector.
Sourcepub fn openapi(&self, info: OpenApiInfo) -> OpenApiDocument
pub fn openapi(&self, info: OpenApiInfo) -> OpenApiDocument
Generate an OpenAPI 3 document from the resolved route table.
Sourcepub fn route_for(
&self,
method: HttpMethod,
path: &str,
) -> Option<&RouteDefinition>
pub fn route_for( &self, method: HttpMethod, path: &str, ) -> Option<&RouteDefinition>
Route registered for a method and the most specific route shape matching a path.
Sourcepub fn route_match(
&self,
method: HttpMethod,
path: &str,
) -> Result<Option<RouteMatch<'_>>>
pub fn route_match( &self, method: HttpMethod, path: &str, ) -> Result<Option<RouteMatch<'_>>>
Route and decoded path parameters for a method and path, when one is registered.
pub fn gateway_for(&self, path: &str) -> Option<&WebSocketGatewayDefinition>
pub fn message_pattern_for( &self, pattern: &str, ) -> Option<&MessagePatternDefinition>
Sourcepub fn allowed_methods(&self, path: &str) -> Vec<HttpMethod>
pub fn allowed_methods(&self, path: &str) -> Vec<HttpMethod>
HTTP methods registered for the most specific route shape matching a path.
Sourcepub fn allowed_methods_header(&self, path: &str) -> Option<String>
pub fn allowed_methods_header(&self, path: &str) -> Option<String>
Comma-separated HTTP methods for an Allow header on the most specific matching path.
Sourcepub fn module_ref(&self) -> &ModuleRef
pub fn module_ref(&self) -> &ModuleRef
Provider container available to hosts and controllers.
Sourcepub fn lazy_module_loader(&self) -> Result<Arc<LazyModuleLoader>>
pub fn lazy_module_loader(&self) -> Result<Arc<LazyModuleLoader>>
Lazy module loader available through the application provider graph.
Sourcepub fn get<T>(&self) -> Result<Arc<T>>
pub fn get<T>(&self) -> Result<Arc<T>>
Resolve a typed provider from the application container.
Sourcepub fn get_named<T>(&self, token: &str) -> Result<Arc<T>>
pub fn get_named<T>(&self, token: &str) -> Result<Arc<T>>
Resolve a named provider from the application container.
Sourcepub fn get_optional<T>(&self) -> Result<Option<Arc<T>>>
pub fn get_optional<T>(&self) -> Result<Option<Arc<T>>>
Resolve a typed provider when it is present.
Sourcepub fn get_optional_named<T>(&self, token: &str) -> Result<Option<Arc<T>>>
pub fn get_optional_named<T>(&self, token: &str) -> Result<Option<Arc<T>>>
Resolve a named provider when it is present.
Sourcepub async fn call(&self, request: BootRequest) -> Result<BootResponse>
pub async fn call(&self, request: BootRequest) -> Result<BootResponse>
Dispatch a framework-neutral request through the resolved route table.
Sourcepub async fn handle(&self, request: BootRequest) -> BootResponse
pub async fn handle(&self, request: BootRequest) -> BootResponse
Dispatch a request and convert unhandled errors into Boot HTTP responses.
Sourcepub async fn dispatch_message(
&self,
message: TransportMessage,
) -> Result<Option<TransportReply>>
pub async fn dispatch_message( &self, message: TransportMessage, ) -> Result<Option<TransportReply>>
Dispatch a microservice transport message through the resolved pattern table.
Sourcepub async fn emit_message(&self, message: TransportMessage) -> Result<()>
pub async fn emit_message(&self, message: TransportMessage) -> Result<()>
Dispatch an event-only transport message and ignore any handler reply.
Sourcepub async fn bootstrap(&self) -> Result<()>
pub async fn bootstrap(&self) -> Result<()>
Run async startup hooks before serving, when the host needs them.
Sourcepub async fn shutdown(&self) -> Result<()>
pub async fn shutdown(&self) -> Result<()>
Run async shutdown hooks in reverse registration order.
Sourcepub async fn shutdown_with_signal(
&self,
signal: impl Into<String>,
) -> Result<()>
pub async fn shutdown_with_signal( &self, signal: impl Into<String>, ) -> Result<()>
Run async shutdown hooks with a signal label visible to signal-aware hooks.
Sourcepub fn into_adapter<A>(self, adapter: &A) -> Result<A::Output>where
A: HttpAdapter,
pub fn into_adapter<A>(self, adapter: &A) -> Result<A::Output>where
A: HttpAdapter,
Build this application through a concrete HTTP adapter.
Sourcepub fn into_message_transport<T>(self, transport: &T) -> Result<T::Output>where
T: MessageTransport,
pub fn into_message_transport<T>(self, transport: &T) -> Result<T::Output>where
T: MessageTransport,
Build this application through a concrete message transport.
Sourcepub async fn serve_with<A>(self, adapter: &A, addr: SocketAddr) -> Result<()>where
A: HttpAdapter,
pub async fn serve_with<A>(self, adapter: &A, addr: SocketAddr) -> Result<()>where
A: HttpAdapter,
Serve this application through a concrete HTTP adapter.
Trait Implementations§
Source§impl Clone for BootApplication
impl Clone for BootApplication
Source§fn clone(&self) -> BootApplication
fn clone(&self) -> BootApplication
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more