Struct Serve

struct Serve<L, M, S> { ... }

Future returned by serve.

Implementations

impl<L, M, S> Serve<L, M, S>

fn with_graceful_shutdown<F>(self: Self, signal: F) -> WithGracefulShutdown<L, M, S, F>
where
    F: Future<Output = ()> + Send + 'static

Prepares a server to handle graceful shutdown when the provided future completes.

Example

use axum::{Router, routing::get};

# async {
let router = Router::new().route("/", get(|| async { "Hello, World!" }));

let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, router)
    .with_graceful_shutdown(shutdown_signal())
    .await
    .unwrap();
# };

async fn shutdown_signal() {
    // ...
}

Return Value

Similarly to serve, although this future resolves to io::Result<()>, it will never error. It returns Ok(()) only after the signal future completes.

fn local_addr(self: &Self) -> io::Result<<L as >::Addr>

Returns the local address this server is bound to.

impl<L, M, S> Debug for Serve<L, M, S>

fn fmt(self: &Self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result

impl<L, M, S> Freeze for Serve<L, M, S>

impl<L, M, S> IntoFuture for Serve<L, M, S>

fn into_future(self: Self) -> <Self as >::IntoFuture

impl<L, M, S> RefUnwindSafe for Serve<L, M, S>

impl<L, M, S> Send for Serve<L, M, S>

impl<L, M, S> Sync for Serve<L, M, S>

impl<L, M, S> Unpin for Serve<L, M, S>

impl<L, M, S> UnwindSafe for Serve<L, M, S>

impl<T> Any for Serve<L, M, S>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Serve<L, M, S>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Serve<L, M, S>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for Serve<L, M, S>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Serve<L, M, S>

impl<T> Same for Serve<L, M, S>

impl<T> WithSubscriber for Serve<L, M, S>

impl<T, U> Into for Serve<L, M, S>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Serve<L, M, S>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Serve<L, M, S>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<V, T> VZip for Serve<L, M, S>

fn vzip(self: Self) -> V