aboutsummaryrefslogtreecommitdiff
path: root/planetwars-client/src/main.rs
blob: 9d9bdab61d1a3f85ef7232100612ba34e8d1a38f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
pub mod pb {
    tonic::include_proto!("grpc.planetwars.bot_api");
}

use pb::test_service_client::TestServiceClient;
use pb::{Hello, HelloResponse};
use tonic::Response;

#[tokio::main]
async fn main() {
    let mut client = TestServiceClient::connect("http://localhost:50051")
        .await
        .unwrap();
    let response: Response<HelloResponse> = client
        .greet(Hello {
            hello_message: "robbe".to_string(),
        })
        .await
        .unwrap();
    println!("{}", response.get_ref().response);
}