Struct tiny_http::Server [−][src]
pub struct Server { /* fields omitted */ }
Expand description
The main class of this library.
Destroying this object will immediatly close the listening socket and the reading
part of all the client’s connections. Requests that have already been returned by
the recv()
function will not close and the responses will be transferred to the client.
Implementations
impl Server
[src]
impl Server
[src]pub fn http<A>(
addr: A
) -> Result<Server, Box<dyn Error + Send + Sync + 'static>> where
A: ToSocketAddrs,
[src]
pub fn http<A>(
addr: A
) -> Result<Server, Box<dyn Error + Send + Sync + 'static>> where
A: ToSocketAddrs,
[src]Shortcut for a simple server on a specific address.
pub fn new<A>(
config: ServerConfig<A>
) -> Result<Server, Box<dyn Error + Send + Sync + 'static>> where
A: ToSocketAddrs,
[src]
pub fn new<A>(
config: ServerConfig<A>
) -> Result<Server, Box<dyn Error + Send + Sync + 'static>> where
A: ToSocketAddrs,
[src]Builds a new server that listens on the specified address.
pub fn incoming_requests(&self) -> IncomingRequests<'_>ⓘNotable traits for IncomingRequests<'a>
impl<'a> Iterator for IncomingRequests<'a> type Item = Request;
[src]
pub fn incoming_requests(&self) -> IncomingRequests<'_>ⓘNotable traits for IncomingRequests<'a>
impl<'a> Iterator for IncomingRequests<'a> type Item = Request;
[src]Returns an iterator for all the incoming requests.
The iterator will return None
if the server socket is shutdown.
pub fn server_addr(&self) -> SocketAddr
[src]
pub fn server_addr(&self) -> SocketAddr
[src]Returns the address the server is listening to.
pub fn num_connections(&self) -> usize
[src]
pub fn num_connections(&self) -> usize
[src]Returns the number of clients currently connected to the server.
pub fn recv(&self) -> IoResult<Request>
[src]
pub fn recv(&self) -> IoResult<Request>
[src]Blocks until an HTTP request has been submitted and returns it.