pub struct RunningServer { /* private fields */ }Expand description
A server that is serving.
Implementations§
Source§impl RunningServer
impl RunningServer
Sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
The address it is serving on.
Sourcepub async fn wait_until_ready(&self) -> Result<(), NativeError>
pub async fn wait_until_ready(&self) -> Result<(), NativeError>
Prove the port answers before anything is told to go there.
Not strictly required — see the module note on binding before serving — but a host that would rather check than reason gets a check, and one that finds this failing has a real problem to report rather than a blank window.
Sourcepub async fn shutdown(self, grace: Duration) -> Result<(), NativeError>
pub async fn shutdown(self, grace: Duration) -> Result<(), NativeError>
Stop accepting, let open work finish, and end.
The host must first signal its application’s framework shutdown broadcast, which closes long-lived responses such as the dev event stream and WebSockets. This method then tells Axum to stop accepting and waits for what is left. Keeping the framework signal in the host makes it use the application’s Rahti version rather than a second copy linked by this platform-neutral crate.
grace bounds that wait. Whatever is still open when it expires is
abandoned, because a window the user closed must not leave a process
behind.
Trait Implementations§
Source§impl Drop for RunningServer
impl Drop for RunningServer
Source§fn drop(&mut self)
fn drop(&mut self)
A host that drops this without calling
shutdown still stops the server.
Which is the Android case: the operating system can destroy the process without giving anything a chance to run a shutdown, and a serve task that outlived its handle would keep a socket open into the next launch.