Skip to main content

CallClient

Trait CallClient 

Source
pub trait CallClient: Send {
    // Required methods
    fn resolve_endpoint<'life0, 'life1, 'async_trait>(
        &'life0 self,
        endpoint: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<EndpointMeta>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        endpoint: &'life1 str,
        request: CallRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<CallStreamItem, CallError>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Protocol-agnostic call client trait.

Each protocol (gRPC, HTTP) implements this trait. The runner uses this trait instead of directly creating a gRPC client.

Required Methods§

Source

fn resolve_endpoint<'life0, 'life1, 'async_trait>( &'life0 self, endpoint: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<EndpointMeta>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve endpoint metadata (RPC mode, input/output types).

Source

fn call<'life0, 'life1, 'async_trait>( &'life0 mut self, endpoint: &'life1 str, request: CallRequest, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<CallStreamItem, CallError>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Make a call and return a stream of response items.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§