pub async fn register<T, F, Fut>(&self, uri: T, func_ptr: F) -> Result<WampId, WampError>
    where
        T: AsRef<str>,
        F: Fn(Option<WampArgs>, Option<WampKwArgs>) -> Fut + Send + Sync + 'a,
        Fut: Future<Output = Result<(Option<WampArgs>, Option<WampKwArgs>), WampError>> + Send + 'a,
    {
        // Send the request
        let (res, result) = oneshot::channel();
        if let Err(e) = self.ctl_channel.send(Request::Register {
            uri: uri.as_ref().to_string(),
            res,
            func_ptr: Box::new(move |a, k| Box::pin(func_ptr(a, k))),
        }) {
            return Err(From::from(format!(
                "Core never received our request : {}",
                e
            )));
        }

        // Wait for the result
        let rpc_id = match result.await {
            Ok(r) => r?,
            Err(e) => {
                return Err(From::from(format!(
                    "Core never returned a response : {}",
                    e
                )))
            }
        };

        Ok(rpc_id)
    }
/// Register an RPC endpoint. Upon succesful registration, a registration ID is returned (used to unregister)
/// and calls received from the server will generate a future which will be sent on the rpc event channel
/// returned by the call to [event_loop()](struct.Client.html#method.event_loop)
Register an RPC endpoint. Upon succesful registration, a registration ID is returned (used to unregister)
and calls received from the server will generate a future which will be sent on the rpc event channel
returned by the call to [event_loop()](struct.Client.html#method.event_loop)
Register an RPC endpoint . Upon succesful registration a registration ID is returned ( used to unregister ) and calls received from the server will generate a future which will be sent on the rpc event channel returned by the call to [ event_loop () ] ( struct . Client . html#method . event_loop )
pub async fn register<T, F, Fut>(&self, uri: T, func_ptr: F) -> Result<WampId, WampError>
    where
        T: AsRef<str>,
        F: Fn(Option<WampArgs>, Option<WampKwArgs>) -> Fut + Send + Sync + 'a,
        Fut: Future<Output = Result<(Option<WampArgs>, Option<WampKwArgs>), WampError>> + Send + 'a,
    {
        // Send the request
        let (res, result) = oneshot::channel();
        if let Err(e) = self.ctl_channel.send(Request::Register {
            uri: uri.as_ref().to_string(),
            res,
            func_ptr: Box::new(move |a, k| Box::pin(func_ptr(a, k))),
        }) {
            return Err(From::from(format!(
                "Core never received our request : {}",
                e
            )));
        }
        // Wait for the result
        let rpc_id = match result.await {
            Ok(r) => r?,
            Err(e) => {
                return Err(From::from(format!(
                    "Core never returned a response : {}",
                    e
                )))
            }
        };
        Ok(rpc_id)
    }
pub async fn register < T , F , Fut > ( & self , uri : T , func_ptr : F ) -> Result < WampId , WampError > where T : AsRef < str > , F : Fn ( Option < WampArgs > , Option < WampKwArgs > ) -> Fut + Send + Sync + ' a , Fut : Future < Output = Result < ( Option < WampArgs > , Option < WampKwArgs > ) , WampError > > + Send + ' a , { // Send the request let ( res , result ) = oneshot :: channel ( ) ; if let Err ( e ) = self . ctl_channel . send ( Request :: Register { uri : uri . as_ref ( ) . to_string ( ) , res , func_ptr : Box :: new ( move | a , k | Box :: pin ( func_ptr ( a , k ) ) ) , } ) { return Err ( From :: from ( format ! ( " " e ) ) ) ; } // Wait for the result let rpc_id = match result . await { Ok ( r ) => r ? , Err ( e ) => { return Err ( From :: from ( format ! ( " " e ) ) ) } } ; Ok ( rpc_id ) }
Register an RPC endpoint.
Register an RPC endpoint .
&self
uri
T
func_ptr
F