CallableParam

Trait CallableParam 

Source
pub trait CallableParam<Ctx, Init>:
    Send
    + Sync
    + Sized {
    type Error: Error + Send;

    // Required method
    fn extract(
        ctx: &mut Ctx,
        init: &Init,
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync;
}
Expand description

A parameter that could appear in a callable function (e.g. rpc or on_connect).

This trait is used to extract the parameter from the context and/or initialize it from parameters used to create the callable function.

Required Associated Types§

Required Methods§

Source

fn extract( ctx: &mut Ctx, init: &Init, ) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync

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<Ctx, Init> CallableParam<Ctx, Init> for Users
where Ctx: CallableFetch<App>, Init: Send + Sync,

Source§

impl<Ctx: CallableFetch<App>, Init: Send + Sync> CallableParam<Ctx, Init> for App

Source§

impl<Ctx: CallableFetch<User>, Init: Send + Sync> CallableParam<Ctx, Init> for User

Source§

impl<T: StoreData, Ctx: CallableFetch<App> + Send + Sync, Init: Send + Sync> CallableParam<Ctx, Init> for Store<T>

Implement CallableParam for Store<T> to allow it to be used as a parameter in async AND sync callables (e.g. crate::rpc methods, crate::AppBuilder::on_connect handlers, etc).

Source§

impl<T: StoreData, Ctx: CallableFetch<App>, Init: Send + Sync> CallableParam<Ctx, Init> for StoreMut<T>

Source§

impl<T: StoreData, Ctx: CallableFetch<App>, Init: Send + Sync> CallableParam<Ctx, Init> for StoreRef<T>

Source§

impl<T: Send + Sync + 'static, Ctx: CallableFetch<App> + Send + Sync, Init: Send + Sync> CallableParam<Ctx, Init> for Local<T>

Source§

type Error = LocalStateError

Source§

impl<T: DeserializeOwned + Send + Sync> CallableParam<RpcRequestContext, RpcRequestInit> for Params<T>