Struct oe_rpc_servers::MetaIoHandler 
source · [−]pub struct MetaIoHandler<T, S = Noop> where
    T: Metadata,
    S: Middleware<T>,  { /* private fields */ }Expand description
Request handler
By default compatible only with jsonrpc v2
Implementations
sourceimpl<T> MetaIoHandler<T, Noop> where
    T: Metadata, 
 
impl<T> MetaIoHandler<T, Noop> where
    T: Metadata, 
sourcepub fn with_compatibility(
    compatibility: Compatibility
) -> MetaIoHandler<T, Noop>
 
pub fn with_compatibility(
    compatibility: Compatibility
) -> MetaIoHandler<T, Noop>
Creates new MetaIoHandler compatible with specified protocol version.
sourceimpl<T, S> MetaIoHandler<T, S> where
    T: Metadata,
    S: Middleware<T>, 
 
impl<T, S> MetaIoHandler<T, S> where
    T: Metadata,
    S: Middleware<T>, 
sourcepub fn new(compatibility: Compatibility, middleware: S) -> MetaIoHandler<T, S>
 
pub fn new(compatibility: Compatibility, middleware: S) -> MetaIoHandler<T, S>
Creates new MetaIoHandler
sourcepub fn with_middleware(middleware: S) -> MetaIoHandler<T, S>
 
pub fn with_middleware(middleware: S) -> MetaIoHandler<T, S>
Creates new MetaIoHandler with specified middleware.
sourcepub fn add_method<F>(&mut self, name: &str, method: F) where
    F: RpcMethodSimple, 
 
pub fn add_method<F>(&mut self, name: &str, method: F) where
    F: RpcMethodSimple, 
Adds new supported asynchronous method
sourcepub fn add_notification<F>(&mut self, name: &str, notification: F) where
    F: RpcNotificationSimple, 
 
pub fn add_notification<F>(&mut self, name: &str, notification: F) where
    F: RpcNotificationSimple, 
Adds new supported notification
sourcepub fn add_method_with_meta<F>(&mut self, name: &str, method: F) where
    F: RpcMethod<T>, 
 
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.
sourcepub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F) where
    F: RpcNotification<T>, 
 
pub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F) where
    F: RpcNotification<T>, 
Adds new supported notification with metadata support.
sourcepub fn extend_with<F>(&mut self, methods: F) where
    F: IntoIterator<Item = (String, RemoteProcedure<T>)>, 
 
pub fn extend_with<F>(&mut self, methods: F) where
    F: IntoIterator<Item = (String, RemoteProcedure<T>)>, 
Extend this MetaIoHandler with methods defined elsewhere.
sourcepub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>
 
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.
sourcepub fn handle_request(
    &self, 
    request: &str, 
    meta: T
) -> Map<Either<FutureResult<Option<Response>, ()>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(Option<Response>) -> Option<String>>
 
pub fn handle_request(
    &self, 
    request: &str, 
    meta: T
) -> Map<Either<FutureResult<Option<Response>, ()>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(Option<Response>) -> Option<String>>
Handle given request asynchronously.
sourcepub fn handle_rpc_request(
    &self, 
    request: Request, 
    meta: T
) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>
 
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<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>
Handle deserialized RPC request.
sourcepub fn handle_call(
    &self, 
    call: Call, 
    meta: T
) -> Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>
 
pub fn handle_call(
    &self, 
    call: Call, 
    meta: T
) -> Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + Send + 'static, Global>, FutureResult<Option<Output>, ()>>>
Handle single call asynchronously.
Trait Implementations
sourceimpl<T, S> Clone for MetaIoHandler<T, S> where
    T: Clone + Metadata,
    S: Clone + Middleware<T>, 
 
impl<T, S> Clone for MetaIoHandler<T, S> where
    T: Clone + Metadata,
    S: Clone + Middleware<T>, 
sourcepub fn clone(&self) -> MetaIoHandler<T, S>
 
pub fn clone(&self) -> MetaIoHandler<T, S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<T, S> Debug for MetaIoHandler<T, S> where
    T: Debug + Metadata,
    S: Debug + Middleware<T>, 
 
impl<T, S> Debug for MetaIoHandler<T, S> where
    T: Debug + Metadata,
    S: Debug + Middleware<T>, 
sourceimpl<T> Default for MetaIoHandler<T, Noop> where
    T: Metadata, 
 
impl<T> Default for MetaIoHandler<T, Noop> where
    T: Metadata, 
sourcepub fn default() -> MetaIoHandler<T, Noop>
 
pub fn default() -> MetaIoHandler<T, Noop>
Returns the “default value” for a type. Read more
sourceimpl<'a, T, S> IntoIterator for &'a MetaIoHandler<T, S> where
    T: Metadata,
    S: Middleware<T>, 
 
impl<'a, T, S> IntoIterator for &'a MetaIoHandler<T, S> where
    T: Metadata,
    S: Middleware<T>, 
type Item = (&'a String, &'a RemoteProcedure<T>)
type Item = (&'a String, &'a RemoteProcedure<T>)
The type of the elements being iterated over.
type IntoIter = Iter<'a, String, RemoteProcedure<T>>
type IntoIter = Iter<'a, String, RemoteProcedure<T>>
Which kind of iterator are we turning this into?
sourcepub fn into_iter(self) -> <&'a MetaIoHandler<T, S> as IntoIterator>::IntoIter
 
pub fn into_iter(self) -> <&'a MetaIoHandler<T, S> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<T, S> IntoIterator for MetaIoHandler<T, S> where
    T: Metadata,
    S: Middleware<T>, 
 
impl<T, S> IntoIterator for MetaIoHandler<T, S> where
    T: Metadata,
    S: Middleware<T>, 
type Item = (String, RemoteProcedure<T>)
type Item = (String, RemoteProcedure<T>)
The type of the elements being iterated over.
type IntoIter = IntoIter<String, RemoteProcedure<T>>
type IntoIter = IntoIter<String, RemoteProcedure<T>>
Which kind of iterator are we turning this into?
sourcepub fn into_iter(self) -> <MetaIoHandler<T, S> as IntoIterator>::IntoIter
 
pub fn into_iter(self) -> <MetaIoHandler<T, S> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<M, S2> IoHandlerExtension<M> for MetaIoHandler<M, S2> where
    M: Metadata,
    S2: Middleware<M>, 
 
impl<M, S2> IoHandlerExtension<M> for MetaIoHandler<M, S2> where
    M: Metadata,
    S2: Middleware<M>, 
sourcepub fn augment<S>(self, handler: &mut MetaIoHandler<M, S>) where
    S: Middleware<M>, 
 
pub fn augment<S>(self, handler: &mut MetaIoHandler<M, S>) where
    S: Middleware<M>, 
Extend given handler with additional methods.
Auto Trait Implementations
impl<T, S = Noop> !RefUnwindSafe for MetaIoHandler<T, S>
impl<T, S> Send for MetaIoHandler<T, S>
impl<T, S> Sync for MetaIoHandler<T, S>
impl<T, S> Unpin for MetaIoHandler<T, S> where
    S: Unpin, 
impl<T, S = Noop> !UnwindSafe for MetaIoHandler<T, S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
 
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
    T: Clone, 
 
impl<T> ToOwned for T where
    T: Clone, 
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
 
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
 
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more