Function server

Source
pub async fn server<Address, Data, Handler>(
    address: Address,
    this: Arc<Data>,
    handler: Arc<Handler>,
) -> Result<(), Error>
where Address: ToSocketAddrs + Display + Send + Sync + Clone + 'static, Data: Send + Sync + 'static, Handler: Send + Sync + 'static + Fn(Request, Arc<Data>) -> Response,
Expand description

Creates a Future to start a Hyper Text Transfer Protocol Server.

ยงArguments

  • address โ€“ server binds to this address,
  • this โ€“ some data, that will be passed to handler everytime, someone connects,
  • handler โ€“ handler for Hyper Text Transfer Protocol Requests.