[−][src]Struct jsonrpc_v2::ServerBuilder
Builder used to add methods to a server
Created with Server::new
or Server::with_state
Methods
impl<S: 'static + Send + Sync> ServerBuilder<S>
[src]
pub fn with_method<N, R, E, F, T>(self, name: N, handler: F) -> Self where
N: Into<String>,
F: Factory<S, R, E, T> + Send + Sync + 'static,
R: Serialize + Send + 'static,
Error: From<E>,
E: 'static,
T: FromRequest<S> + Send + 'static,
[src]
N: Into<String>,
F: Factory<S, R, E, T> + Send + Sync + 'static,
R: Serialize + Send + 'static,
Error: From<E>,
E: 'static,
T: FromRequest<S> + Send + 'static,
Add a method and handler to the server
The method can be a function that takes up to 3 FromRequest
items
and returns a value that can be resolved to a future of a serializable object, e.g.:
fn handle(params: Params<(i32, String)>, state: State<HashMap<String, String>>) -> Result<String, Error> { /* ... */ }
pub fn finish(self) -> Arc<Server<S>>
[src]
Convert the server builder into the finished struct, wrapped in an Arc
pub fn finish_direct(self) -> Server<S>
[src]
Convert the server builder into the finished struct
Auto Trait Implementations
impl<S> Send for ServerBuilder<S> where
S: Send + Sync,
S: Send + Sync,
impl<S> Sync for ServerBuilder<S> where
S: Send + Sync,
S: Send + Sync,
impl<S> Unpin for ServerBuilder<S>
impl<S> !UnwindSafe for ServerBuilder<S>
impl<S> !RefUnwindSafe for ServerBuilder<S>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,