pub struct RequestHandlersBuilder(/* private fields */);
Expand description
A builder for RequestHandlers
.
Implementations§
Source§impl RequestHandlersBuilder
impl RequestHandlersBuilder
Sourcepub fn register_handler<Func, Fut, T>(
&mut self,
method: &'static str,
handler: Arc<Func>,
)
pub fn register_handler<Func, Fut, T>( &mut self, method: &'static str, handler: Arc<Func>, )
Adds a new request-handler which will be called to handle all JSON-RPC requests with the given “method” field.
The handler should be an async closure or function with a signature like:
ⓘ
async fn handle_it(params: Option<Params>) -> Result<T, Error>
where T
implements Serialize
and will be used as the JSON-RPC response’s “result” field.
Sourcepub fn build(self) -> RequestHandlers
pub fn build(self) -> RequestHandlers
Finalize building by converting self
to a RequestHandlers
.
Trait Implementations§
Source§impl Default for RequestHandlersBuilder
impl Default for RequestHandlersBuilder
Source§fn default() -> RequestHandlersBuilder
fn default() -> RequestHandlersBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RequestHandlersBuilder
impl !RefUnwindSafe for RequestHandlersBuilder
impl Send for RequestHandlersBuilder
impl Sync for RequestHandlersBuilder
impl Unpin for RequestHandlersBuilder
impl !UnwindSafe for RequestHandlersBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more