pub type HandlerType = MetaIoHandler<RpcMeta>;
Expand description

Type of Messagehandler

Aliased Type§

struct HandlerType { /* private fields */ }

Implementations§

§

impl<T> MetaIoHandler<T, Noop>where T: Metadata,

pub fn with_compatibility( compatibility: Compatibility ) -> MetaIoHandler<T, Noop>

Creates new MetaIoHandler compatible with specified protocol version.

§

impl<T, S> MetaIoHandler<T, S>where T: Metadata, S: Middleware<T>,

pub fn new(compatibility: Compatibility, middleware: S) -> MetaIoHandler<T, S>

Creates new MetaIoHandler

pub fn with_middleware(middleware: S) -> MetaIoHandler<T, S>

Creates new MetaIoHandler with specified middleware.

pub fn add_alias(&mut self, alias: &str, other: &str)

Adds an alias to a method.

pub fn add_sync_method<F>(&mut self, name: &str, method: F)where F: RpcMethodSync,

Adds new supported synchronous method.

A backward-compatible wrapper.

pub fn add_method<F>(&mut self, name: &str, method: F)where F: RpcMethodSimple,

Adds new supported asynchronous method.

pub fn add_notification<F>(&mut self, name: &str, notification: F)where F: RpcNotificationSimple,

Adds new supported notification

pub fn add_method_with_meta<F>(&mut self, name: &str, method: F)where F: RpcMethod<T>,

Adds new supported asynchronous method with metadata support.

pub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F)where F: RpcNotification<T>,

Adds new supported notification with metadata support.

pub fn extend_with<F>(&mut self, methods: F)where F: IntoIterator<Item = (String, RemoteProcedure<T>)>,

Extend this MetaIoHandler with methods defined elsewhere.

pub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>

Handle given request synchronously - will block until response is available. If you have any asynchronous methods in your RPC it is much wiser to use handle_request instead and deal with asynchronous requests in a non-blocking fashion.

pub fn handle_request( &self, request: &str, meta: T ) -> Map<Either<Ready<Option<Response>>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>, fn(_: Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>>, fn(_: Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(_: Option<Response>) -> Option<String>>

Handle given request asynchronously.

pub fn handle_rpc_request( &self, request: Request, meta: T ) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>, fn(_: Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>>, fn(_: Vec<Option<Output>, Global>) -> Option<Response>>>>

Handle deserialized RPC request.

pub fn handle_call( &self, call: Call, meta: T ) -> Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>

Handle single call asynchronously.

pub fn iter(&self) -> impl Iterator<Item = (&String, &RemoteProcedure<T>)>

Returns an iterator visiting all methods in arbitrary order.

Trait Implementations§

§

impl<T, S> Clone for MetaIoHandler<T, S>where T: Clone + Metadata, S: Clone + Middleware<T>,

§

fn clone(&self) -> MetaIoHandler<T, S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T, S> Debug for MetaIoHandler<T, S>where T: Debug + Metadata, S: Debug + Middleware<T>,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Default for MetaIoHandler<T, Noop>where T: Metadata,

§

fn default() -> MetaIoHandler<T, Noop>

Returns the “default value” for a type. Read more
§

impl<T, S> IntoIterator for MetaIoHandler<T, S>where T: Metadata, S: Middleware<T>,

§

type Item = (String, RemoteProcedure<T>)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<String, RemoteProcedure<T>>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <MetaIoHandler<T, S> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<M, S2> IoHandlerExtension<M> for MetaIoHandler<M, S2>where M: Metadata, S2: Middleware<M>,

§

fn augment<S>(self, handler: &mut MetaIoHandler<M, S>)where S: Middleware<M>,

Extend given handler with additional methods.