pub trait Client<T>where
    Self: Sized + Client<T> + ClientConnect<T>,
    T: Send + Clone,{
    type ReadyRequest;
    type ReadyResponse;

    // Required method
    fn is_ready<'life0, 'async_trait>(
        &'life0 self,
        request: Self::ReadyRequest
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ReadyResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

gRPC object traits to provide wrappers for grpc functions

Required Associated Types§

source

type ReadyRequest

The type expected for ReadyRequest structs.

source

type ReadyResponse

The type expected for ReadyResponse structs.

Required Methods§

source

fn is_ready<'life0, 'async_trait>( &'life0 self, request: Self::ReadyRequest ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ReadyResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns a tonic::Response containing a ReadyResponse Takes an ReadyRequest.

Errors

Returns tonic::Status with tonic::Code::Unknown if the server is not ready.

Examples
use lib_common::grpc::get_endpoint_from_env;
use svc_assets_client_grpc::prelude::*;

async fn example () -> Result<(), Box<dyn std::error::Error>> {
    let (host, port) = get_endpoint_from_env("SERVER_HOSTNAME", "SERVER_PORT_GRPC");
    let client = AssetsClient::new_client(&host, port, "assets");
    let response = client
        .is_ready(assets::ReadyRequest {})
        .await?;
    println!("RESPONSE={:?}", response.into_inner());
    Ok(())
}

Implementors§