[−][src]Struct rs_jsonrpc_http_server::ServerBuilder
Convenient JSON-RPC HTTP Server builder.
Methods
impl<M: Metadata, S: Middleware<M>> ServerBuilder<M, S>
[src]
pub fn new<T>(handler: T) -> Self where
T: Into<MetaIoHandler<M, S>>,
[src]
T: Into<MetaIoHandler<M, S>>,
Creates new ServerBuilder
for given IoHandler
.
If you want to re-use the same handler in couple places
see with_remote
function.
By default:
- Server is not sending any CORS headers.
- Server is validating
Host
header.
pub fn event_loop_remote(self, remote: Remote) -> Self
[src]
Utilize existing event loop remote to poll RPC results. Applies only to 1 of the threads. Other threads will spawn their own Event Loops.
pub fn rest_api(self, rest_api: RestApi) -> Self
[src]
Enable the REST -> RPC converter. Allows you to invoke RPCs
by sending POST /<method>/<param1>/<param2>
requests
(with no body). Disabled by default.
pub fn keep_alive(self, val: bool) -> Self
[src]
Sets Enables or disables HTTP keep-alive. Default is true.
pub fn threads(self, threads: usize) -> Self
[src]
Sets number of threads of the server to run.
Panics when set to 0
.
pub fn cors(
self,
cors_domains: DomainsValidation<AccessControlAllowOrigin>
) -> Self
[src]
self,
cors_domains: DomainsValidation<AccessControlAllowOrigin>
) -> Self
Configures a list of allowed CORS origins.
pub fn request_middleware<T: RequestMiddleware>(self, middleware: T) -> Self
[src]
Configures request middleware
pub fn meta_extractor<T: MetaExtractor<M>>(self, extractor: T) -> Self
[src]
Configures metadata extractor
pub fn allow_only_bind_host(self) -> Self
[src]
Allow connections only with Host
header set to binding address.
pub fn allowed_hosts(self, allowed_hosts: DomainsValidation<Host>) -> Self
[src]
Specify a list of valid Host
headers. Binding address is allowed automatically.
pub fn start_http(self, addr: &SocketAddr) -> Result<Server>
[src]
Start this JSON-RPC HTTP server trying to bind to specified SocketAddr
.
Auto Trait Implementations
impl<M, S> Send for ServerBuilder<M, S>
impl<M, S> Sync for ServerBuilder<M, S>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,