pub struct ServerBuilder<M: Metadata = (), S: Middleware<M> = Noop> { /* private fields */ }
Expand description

Convenient JSON-RPC HTTP Server builder.

Implementations

Creates new ServerBuilder for given IoHandler.

By default:

  1. Server is not sending any CORS headers.
  2. Server is validating Host header.

Creates new ServerBuilder for given IoHandler.

By default:

  1. Server is not sending any CORS headers.
  2. Server is validating Host header.

Utilize existing event loop executor to poll RPC results.

Applies only to 1 of the threads. Other threads will spawn their own Event Loops.

Enable the REST -> RPC converter.

Allows you to invoke RPCs by sending POST /<method>/<param1>/<param2> requests (with no body). Disabled by default.

Enable health endpoint.

Allows you to expose one of the methods under GET /<path> The method will be invoked with no parameters. Error returned from the method will be converted to status 500 response.

Expects a tuple with (<path>, <rpc-method-name>).

Enables or disables HTTP keep-alive.

Default is true.

Sets number of threads of the server to run.

Panics when set to 0. The first thread will use provided Executor instance and all other threads will use UninitializedExecutor to spawn a new runtime for futures. So it’s also possible to run a multi-threaded server by passing the default tokio::runtime executor to this builder and setting threads to 1.

Configures a list of allowed CORS origins.

Configure CORS AccessControlMaxAge header returned.

Informs the client that the CORS preflight request is not necessary for cors_max_age seconds. Disabled by default.

Configure the CORS AccessControlAllowHeaders header which are allowed.

Configures request middleware

Configures metadata extractor

Allow connections only with Host header set to binding address.

Specify a list of valid Host headers. Binding address is allowed automatically.

Sets the maximum size of a request body in bytes (default is 5 MiB).

Start this JSON-RPC HTTP server trying to bind to specified SocketAddr.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.