Trait GenericProcedure

Source
pub trait GenericProcedure<Cx: Send + Sync> {
    // Required methods
    fn run<'life0, 'async_trait>(
        &'life0 self,
        cx: Cx,
        data: String,
    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn specta_type(
        &self,
        name: Cow<'static, str>,
        map: &mut TypeMap,
    ) -> FunctionDataType;
}
Expand description

A generic procedure. This is required to allow for any procedure to be used in a [rpc_rs::Module].

Required Methods§

Source

fn run<'life0, 'async_trait>( &'life0 self, cx: Cx, data: String, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run this procedure with the context and a JSON-encoded string representing the data required.

Source

fn specta_type( &self, name: Cow<'static, str>, map: &mut TypeMap, ) -> FunctionDataType

Get the FunctionDataType of this procedure.

Implementors§

Source§

impl<Cx: TripleS + Clone, Output: Send + Sync + Serialize + Type, Arg: Send + Sync + 'static + DeserializeOwned + Type> GenericProcedure<Cx> for WrappedProcedure<Cx, Output, Arg>