pub struct Host {
pub options: AppOptions,
/* private fields */
}Fields§
§options: AppOptionsImplementations§
Source§impl Host
impl Host
pub fn builder() -> HostBuilder
pub fn options(&self) -> &AppOptions
Sourcepub fn provider(&self) -> &Arc<ServiceProvider> ⓘ
pub fn provider(&self) -> &Arc<ServiceProvider> ⓘ
Root DI container for this host instance.
Sourcepub fn dispatch_runtime(&self) -> &Arc<DispatchRuntime> ⓘ
pub fn dispatch_runtime(&self) -> &Arc<DispatchRuntime> ⓘ
Instance-scoped dispatch runtime (provider + handler cache).
Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
Start the server on all URLs configured in AppOptions.app.Urls.
Automatically detects http:// and https:// URLs from the array. Starts a plain TCP listener for each http:// URL and a TLS listener for each https:// URL. All listeners run concurrently.
Supports graceful shutdown on Ctrl+C/SIGTERM with 30s connection drain.
§Example
{ "App": { "Urls": ["http://localhost:5000", "https://localhost:5030"] } }Sourcepub async fn run_at(&self, addr: &str) -> Result<()>
pub async fn run_at(&self, addr: &str) -> Result<()>
Start the server at a single explicit address (convenience wrapper).
Sourcepub fn server_handle(&self) -> ServerHandle
pub fn server_handle(&self) -> ServerHandle
Return a ServerHandle that can be used to signal graceful shutdown
from application code (e.g., integration tests, health checks).
let host = Host::builder().build();
let handle = host.server_handle();
tokio::spawn(async move { host.run().await });
// ... later:
handle.shutdown();Sourcepub fn into_server(self) -> Server
pub fn into_server(self) -> Server
Consume the host and return a Server that owns the runtime lifecycle.
The returned Server can be .run().await-ed and provides a
handle for graceful shutdown.