Struct nickel::ListeningServer [] [src]

pub struct ListeningServer(_);

A server listeing on a socket


impl ListeningServer

fn socket(&self) -> SocketAddr

Gets the SocketAddr which the server is currently listening on.

fn detach(self)

Detaches the server thread.

This doesn't actually kill the server, it just stops the current thread from blocking due to the server running. In the case where main returns due to this unblocking, then the server will be killed due to process death.

The required use of this is when writing unit tests which spawn servers and do not want to block the test-runner by waiting on the server to stop because it probably never will.

See this hyper issue for more information.