pub fn bind_with_graceful_shutdown(
        self,
        addr: impl Into<SocketAddr> + 'static,
        signal: impl Future<Output = ()> + Send + 'static,
    ) -> (SocketAddr, impl Future<Output = ()> + 'static) {
        let (addr, srv) = bind!(self, addr);
        let fut = srv
            .with_graceful_shutdown(signal)
            .map(|result| {
                if let Err(err) = result {
                    log::error!("server error: {}", err)
                }
            });
        (addr, fut)
    }
/// Create a server with graceful shutdown signal.
///
/// When the signal completes, the server will start the graceful shutdown
/// process.
///
/// Returns the bound address and a `Future` that can be executed on
/// any runtime.
///
/// # Example
///
/// ```no_run
/// use warp::Filter;
/// use futures::future::TryFutureExt;
/// use tokio::sync::oneshot;
///
/// # fn main() {
/// let routes = warp::any()
///     .map(|| "Hello, World!");
///
/// let (tx, rx) = oneshot::channel();
///
/// let (addr, server) = warp::serve(routes)
///     .bind_with_graceful_shutdown(([127, 0, 0, 1], 3030), async {
///          rx.await.ok();
///     });
///
/// // Spawn the server into a runtime
/// tokio::task::spawn(server);
///
/// // Later, start the shutdown...
/// let _ = tx.send(());
/// # }
/// ```
Create a server with graceful shutdown signal.
When the signal completes, the server will start the graceful shutdown
process.

Returns the bound address and a `Future` that can be executed on
any runtime.
Create a server with graceful shutdown signal . When the signal completes the server will start the graceful shutdown process . Returns the bound address and a ` Future ` that can be executed on any runtime .
pub fn bind_with_graceful_shutdown(
        self,
        addr: impl Into<SocketAddr> + 'static,
        signal: impl Future<Output = ()> + Send + 'static,
    ) -> (SocketAddr, impl Future<Output = ()> + 'static) {
        let (addr, srv) = bind!(self, addr);
        let fut = srv
            .with_graceful_shutdown(signal)
            .map(|result| {
                if let Err(err) = result {
                    log::error!("server error: {}", err)
                }
            });
        (addr, fut)
    }
pub fn bind_with_graceful_shutdown ( self , addr : impl Into < SocketAddr > + ' static , signal : impl Future < Output = ( ) > + Send + ' static , ) -> ( SocketAddr , impl Future < Output = ( ) > + ' static ) { let ( addr , srv ) = bind ! ( self addr ) ; let fut = srv . with_graceful_shutdown ( signal ) . map ( | result | { if let Err ( err ) = result { log :: error ! ( " " err ) } } ) ; ( addr , fut ) }
Create a server with graceful shutdown signal.
Create a server with graceful shutdown signal .
self
addr
impl Into<SocketAddr> + 'static
signal
impl Future<Output = ()> + Send + 'static
example
```no_run
use warp::Filter;
use futures::future::TryFutureExt;
use tokio::sync::oneshot.
` ` ` no_run use warp :: Filter ; use futures :: future :: TryFutureExt ; use tokio :: sync :: oneshot .
fn main() {
let routes = warp::any()
.map(|| "Hello, World!").

let (tx, rx) = oneshot::channel().



Spawn the server into a runtime
tokio::task::spawn(server).

Later, start the shutdown
let _ = tx.send(()).
let routes = warp :: any () . map ( || " Hello World! " ) . let ( tx rx ) = oneshot :: channel () . Spawn the server into a runtime tokio :: task :: spawn ( server ) . Later start the shutdown let _ = tx . send (( )) .
}
None