ServiceConnector

Trait ServiceConnector 

Source
pub trait ServiceConnector: Default {
    // Required methods
    fn establish_connection<'async_trait>(
        self: Arc<Self>,
    ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn terminate_connection<'async_trait>(
        self: Arc<Self>,
    ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

An external service that can be connected to

In order to use the function-set from an external service, your application needs to include it’s client-lib (usually named <service>-sdk) which provides a strongly typed API that abstracts away the RPC protocol logic.

Any service that should be connectable needs to implement this trait. Any service API object also needs to implement the Default trait so that the sdk internally can create a default of it, then call establish_connection() to fully initialise it.

Required Methods§

Source

fn establish_connection<'async_trait>( self: Arc<Self>, ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Start a connection to the service backend

Source

fn terminate_connection<'async_trait>( self: Arc<Self>, ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Terminate the connection to the service backend

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§