[−][src]Struct mini_async_http::ServerHandle
Clonable handle to a server. Can only be retrieved from a Server instance. Used to wait for the server to be ready or to shut it down.
Implementations
impl ServerHandle
[src]
pub fn shutdown(&self)
[src]
Send a shutdown signal to the server. The server wait for all the received request to be handled and the stop
Example
Creates a server and starts it. From another thread we send the shutdown signal causing the server to stop and the program to end.
let mut server = mini_async_http::AIOServer::new(3, "0.0.0.0:7880", move |request|{ mini_async_http::ResponseBuilder::empty_200() .body(b"Hello") .content_type("text/plain") .build() .unwrap() }); let handle = server.handle(); std::thread::spawn(move || { handle.shutdown(); }); server.start();
pub fn ready(&self)
[src]
Block untill the server is ready to receive requests
Example
Creates a server and starts it in a separate thread. The main thread waits for the server to be ready and then ends
let mut server = mini_async_http::AIOServer::new(3, "0.0.0.0:7880", move |request|{ mini_async_http::ResponseBuilder::empty_200() .body(b"Hello") .content_type("text/plain") .build() .unwrap() }); let handle = server.handle(); std::thread::spawn(move || { server.start(); }); handle.ready();
Trait Implementations
impl Clone for ServerHandle
[src]
fn clone(&self) -> ServerHandle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl !RefUnwindSafe for ServerHandle
impl Send for ServerHandle
impl !Sync for ServerHandle
impl Unpin for ServerHandle
impl !UnwindSafe for ServerHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,