Struct pavex::server::ServerHandle
source · pub struct ServerHandle { /* private fields */ }
Expand description
A handle to a running Server
.
§Example: waiting for the server to shut down
You can just .await
the ServerHandle
to wait for the server to shut down:
use std::net::SocketAddr;
use pavex::server::Server;
let addr = SocketAddr::from(([127, 0, 0, 1], 8080));
let server_handle = Server::new()
.bind(addr)
.await?
.serve(router, application_state);
// Wait until the server shuts down.
server_handle.await;
Implementations§
source§impl ServerHandle
impl ServerHandle
sourcepub async fn shutdown(self, mode: ShutdownMode)
pub async fn shutdown(self, mode: ShutdownMode)
Instruct the Server
to stop accepting new connections.
Trait Implementations§
source§impl Clone for ServerHandle
impl Clone for ServerHandle
source§fn clone(&self) -> ServerHandle
fn clone(&self) -> ServerHandle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl IntoFuture for ServerHandle
impl IntoFuture for ServerHandle
Auto Trait Implementations§
impl Freeze for ServerHandle
impl RefUnwindSafe for ServerHandle
impl Send for ServerHandle
impl Sync for ServerHandle
impl Unpin for ServerHandle
impl UnwindSafe for ServerHandle
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)