[][src]Struct jsonrpc_v2::ServerBuilder

pub struct ServerBuilder<S> { /* fields omitted */ }

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]

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

impl<S> Sync for ServerBuilder<S> where
    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]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T