Skip to main content

FnTryRemote

Trait FnTryRemote 

Source
pub trait FnTryRemote<Success, Error>: FnRemote<Output = Result<Success, Error>> {
    // Provided methods
    fn try_call<'life0, 'async_trait, C>(
        self,
        connection: &'life0 C,
    ) -> Pin<Box<dyn Future<Output = Result<Success, ErrorFrom<C::Error, Error>>> + 'async_trait>>
       where C: RpcClient + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn try_begin_call<'life0, 'async_trait, C>(
        self,
        connection: &'life0 C,
    ) -> Pin<Box<dyn Future<Output = Result<TryCall<Success, Error, C>, C::Error>> + 'async_trait>>
       where Self: Sized + 'async_trait,
             Success: DeserializeOwned,
             Error: DeserializeOwned,
             C: ConcurrentRpcClient + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Allow a fallible FnRemote to be called like a method.

A blanket implementation is provided for any T: FnRemote.

Provided Methods§

Source

fn try_call<'life0, 'async_trait, C>( self, connection: &'life0 C, ) -> Pin<Box<dyn Future<Output = Result<Success, ErrorFrom<C::Error, Error>>> + 'async_trait>>
where C: RpcClient + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Allow function.call(connection) instead of connection.call(function).

The default implementation defers to RpcClient::try_call. You shouldn’t need to implement this.

Source

fn try_begin_call<'life0, 'async_trait, C>( self, connection: &'life0 C, ) -> Pin<Box<dyn Future<Output = Result<TryCall<Success, Error, C>, C::Error>> + 'async_trait>>
where Self: Sized + 'async_trait, Success: DeserializeOwned, Error: DeserializeOwned, C: ConcurrentRpcClient + 'async_trait, 'life0: 'async_trait,

Allow function.call(connection) instead of connection.call(function).

The default implementation defers to ConcurrentRpcClient::try_begin_call. You shouldn’t need to implement this.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Success, Error, T> FnTryRemote<Success, Error> for T
where T: FnRemote<Output = Result<Success, Error>>,