Struct arc_reactor::ArcReactor
[−]
[src]
pub struct ArcReactor { /* fields omitted */ }The main server, the ArcReactor is where you mount your routes, middlewares and initiate the server.
#Examples
ⓘThis example is not tested
extern crate arc_reactor; use arc_reactor::ArcReactor; fn main() { ArcReactor::new().routes(..).port(1234).initiate().unwrap() }
Methods
impl ArcReactor[src]
pub fn new() -> ArcReactor[src]
Creates an instance of the server.
with a default port of 8080
and No routes. Note that calling initiate on an ArcReactor without routes
will cause your program to panic.
pub fn port(self, port: i16) -> Self[src]
sets the port for the server to listen on and returns the instance.
pub fn routes(self, routes: Router) -> Self[src]
mount the Router on the ArcReactor
pub fn initiate(self) -> Result<()>[src]
Binds the listener and blocks the main thread while listening for incoming connections.
Panics
Calling this function will panic if: no routes are supplied, or it cannot start the main event loop.