Trait RpcClient

Source
pub trait RpcClient: Send + Sync {
    // Required method
    fn invoke_method<'life0, 'async_trait>(
        &'life0 self,
        method: UUri,
        call_options: CallOptions,
        payload: Option<UPayload>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A client for performing Remote Procedure Calls (RPC) on (other) uEntities.

Please refer to the Communication Layer API specification for details.

Required Methods§

Source

fn invoke_method<'life0, 'async_trait>( &'life0 self, method: UUri, call_options: CallOptions, payload: Option<UPayload>, ) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invokes a method on a service.

§Arguments
  • method - The URI representing the method to invoke.
  • call_options - Options to include in the request message.
  • payload - The (optional) payload to include in the request message.
§Returns

The payload returned by the service operation.

§Errors

Returns an error if invocation fails or the given arguments cannot be turned into a valid RPC Request message.

Implementations§

Source§

impl dyn RpcClient

Source

pub async fn invoke_proto_method<T, R>( &self, method: UUri, call_options: CallOptions, request_message: T, ) -> Result<R, ServiceInvocationError>
where T: MessageFull, R: MessageFull,

Invokes a method on a service using and returning proto-generated Message objects.

§Arguments
  • method - The URI representing the method to invoke.
  • call_options - Options to include in the request message.
  • request_message - The protobuf Message to include in the request message.
§Returns

The payload returned by the service operation as a protobuf Message.

§Errors

Returns an error if invocation fails, the given arguments cannot be turned into a valid RPC Request message, result protobuf deserialization fails, or result payload is empty.

Implementors§

Source§

impl RpcClient for InMemoryRpcClient

Source§

impl RpcClient for MockRpcClient

A client for performing Remote Procedure Calls (RPC) on (other) uEntities.

Please refer to the Communication Layer API specification for details.