pub struct ShutdownHandle { /* private fields */ }Available on crate feature
std only.Expand description
Stops a running Server::serve from another thread.
§Examples
let server = http_net::blocking::Server::bind("127.0.0.1:0")?;
let stop = server.shutdown_handle();
let t = std::thread::spawn(move || server.serve(|_, _| http_net::Response::new(204)));
stop.shutdown();
t.join().unwrap()?;Implementations§
Source§impl ShutdownHandle
impl ShutdownHandle
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Asks the server to stop: it accepts no new connections, lets each
open connection finish its current exchange, waits for them, and
returns from serve.
§Examples
See ShutdownHandle.
Trait Implementations§
Source§impl Clone for ShutdownHandle
impl Clone for ShutdownHandle
Auto Trait Implementations§
impl Freeze for ShutdownHandle
impl RefUnwindSafe for ShutdownHandle
impl Send for ShutdownHandle
impl Sync for ShutdownHandle
impl Unpin for ShutdownHandle
impl UnsafeUnpin for ShutdownHandle
impl UnwindSafe for ShutdownHandle
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