Trait HandlerFor

Source
pub trait HandlerFor<Context: Context>:
    HandlerTypes
    + Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn handle_async(
        &self,
        handle_args: HandlerArgsFor<Context, Self>,
    ) -> impl Future<Output = Result<Self::Ok, Self::Err>> + Send;

    // Provided methods
    fn handle_sync(
        &self,
        handle_args: HandlerArgsFor<Context, Self>,
    ) -> Result<Self::Ok, Self::Err> { ... }
    fn handle_async_with_sync<'a>(
        &'a self,
        handle_args: HandlerArgsFor<Context, Self>,
    ) -> impl Future<Output = Result<Self::Ok, Self::Err>> + Send + 'a { ... }
    fn handle_async_with_sync_blocking<'a>(
        &'a self,
        handle_args: HandlerArgsFor<Context, Self>,
    ) -> impl Future<Output = Result<Self::Ok, Self::Err>> + Send + 'a { ... }
    fn metadata(
        &self,
        method: VecDeque<&'static str>,
    ) -> OrdMap<&'static str, Value> { ... }
    fn method_from_dots(&self, method: &str) -> Option<VecDeque<&'static str>> { ... }
}

Required Methods§

Source

fn handle_async( &self, handle_args: HandlerArgsFor<Context, Self>, ) -> impl Future<Output = Result<Self::Ok, Self::Err>> + Send

Provided Methods§

Source

fn handle_sync( &self, handle_args: HandlerArgsFor<Context, Self>, ) -> Result<Self::Ok, Self::Err>

Source

fn handle_async_with_sync<'a>( &'a self, handle_args: HandlerArgsFor<Context, Self>, ) -> impl Future<Output = Result<Self::Ok, Self::Err>> + Send + 'a

Source

fn handle_async_with_sync_blocking<'a>( &'a self, handle_args: HandlerArgsFor<Context, Self>, ) -> impl Future<Output = Result<Self::Ok, Self::Err>> + Send + 'a

Source

fn metadata( &self, method: VecDeque<&'static str>, ) -> OrdMap<&'static str, Value>

Source

fn method_from_dots(&self, method: &str) -> Option<VecDeque<&'static str>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Context, F, Fut, T, E> HandlerFor<Context> for FromFnAsync<F, Fut, T, E, (Context,)>
where Context: Context, F: Fn(Context) -> Fut + Send + Sync + Clone + 'static, Fut: Future<Output = Result<T, E>> + Send + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, Fut, T, E> HandlerFor<Context> for FromFnAsync<F, Fut, T, E, ()>
where Context: Context, F: Fn() -> Fut + Send + Sync + Clone + 'static, Fut: Future<Output = Result<T, E>> + Send + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, Fut, T, E, Params> HandlerFor<Context> for FromFnAsync<F, Fut, T, E, (Context, Params)>
where Context: Context, F: Fn(Context, Params) -> Fut + Send + Sync + Clone + 'static, Fut: Future<Output = Result<T, E>> + Send + 'static, Params: DeserializeOwned + Send + Sync + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, Fut, T, E, Params, InheritedParams> HandlerFor<Context> for FromFnAsync<F, Fut, T, E, (Context, Params, InheritedParams)>
where Context: Context, F: Fn(Context, Params, InheritedParams) -> Fut + Send + Sync + Clone + 'static, Fut: Future<Output = Result<T, E>> + Send + 'static, Params: DeserializeOwned + Send + Sync + 'static, InheritedParams: Send + Sync + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, H, C> HandlerFor<Context> for CustomDisplayFn<F, H, C>
where Context: Context, C: 'static, H: HandlerFor<Context>, F: Send + Sync + Clone + 'static,

Source§

impl<Context, F, T, E> HandlerFor<Context> for FromFn<F, T, E, (Context,)>
where Context: Context, F: Fn(Context) -> Result<T, E> + Send + Sync + Clone + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, T, E> HandlerFor<Context> for FromFn<F, T, E, ()>
where Context: Context, F: Fn() -> Result<T, E> + Send + Sync + Clone + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, T, E, Params> HandlerFor<Context> for FromFn<F, T, E, (Context, Params)>
where Context: Context, F: Fn(Context, Params) -> Result<T, E> + Send + Sync + Clone + 'static, Params: DeserializeOwned + Send + Sync + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, F, T, E, Params, InheritedParams> HandlerFor<Context> for FromFn<F, T, E, (Context, Params, InheritedParams)>
where Context: Context, F: Fn(Context, Params, InheritedParams) -> Result<T, E> + Send + Sync + Clone + 'static, Params: DeserializeOwned + Send + Sync + 'static, InheritedParams: Send + Sync + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

impl<Context, H> HandlerFor<Context> for NoCli<H>
where Context: Context, H: HandlerFor<Context>,

Source§

impl<Context, H> HandlerFor<Context> for NoDisplay<H>
where Context: Context, H: HandlerFor<Context>,

Source§

impl<Context, M, H> HandlerFor<Context> for WithAbout<M, H>
where Context: Context, H: HandlerFor<Context>, M: Clone + Send + Sync + 'static,

Source§

impl<Context, P, H> HandlerFor<Context> for CustomDisplay<P, H>
where Context: Context, H: HandlerFor<Context>, P: Send + Sync + Clone + 'static,

Source§

impl<Context, Params, InheritedParams> HandlerFor<Context> for ParentHandler<Context, Params, InheritedParams>
where Context: Context, Params: Send + Sync + 'static, InheritedParams: Send + Sync + 'static,

Source§

impl<Context, Params, InheritedParams, H, F> HandlerFor<Context> for InheritanceHandler<Params, InheritedParams, H, F>
where Context: Context, Params: Send + Sync + 'static, InheritedParams: Send + Sync + 'static, H: HandlerFor<Context>, F: Fn(Params, InheritedParams) -> H::InheritedParams + Send + Sync + Clone + 'static,

Source§

impl<Context, RemoteContext, RemoteHandler, Extra> HandlerFor<Context> for CallRemoteHandler<Context, RemoteContext, RemoteHandler, Extra>
where Context: CallRemote<RemoteContext, Extra>, RemoteContext: Context, RemoteHandler: HandlerFor<RemoteContext>, RemoteHandler::Params: Serialize, RemoteHandler::Ok: DeserializeOwned, RemoteHandler::Err: From<RpcError>, Extra: Serialize + Send + Sync + 'static,

Source§

impl<F, Fut, T, E, Context, Params, InheritedParams> HandlerFor<Context> for FromFnAsync<F, Fut, T, E, HandlerArgs<Context, Params, InheritedParams>>
where F: Fn(HandlerArgs<Context, Params, InheritedParams>) -> Fut + Send + Sync + Clone + 'static, Fut: Future<Output = Result<T, E>> + Send + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static, Context: Context, Params: Send + Sync + 'static, InheritedParams: Send + Sync + 'static,

Source§

impl<F, T, E, Context, Params, InheritedParams> HandlerFor<Context> for FromFn<F, T, E, HandlerArgs<Context, Params, InheritedParams>>
where F: Fn(HandlerArgs<Context, Params, InheritedParams>) -> Result<T, E> + Send + Sync + Clone + 'static, T: Send + Sync + 'static, E: Send + Sync + 'static, Context: Context, Params: Send + Sync + 'static, InheritedParams: Send + Sync + 'static,