xref: /tonic/examples/src/helloworld/client.rs (revision 3a5c66d5)
1 pub mod hello_world {
2     tonic::include_proto!("helloworld");
3 }
4 
5 use hello_world::{greeter_client::GreeterClient, HelloRequest};
6 
7 #[tokio::main]
8 async fn main() -> Result<(), Box<dyn std::error::Error>> {
9     let mut client = GreeterClient::connect("http://[::1]:50051").await?;
10 
11     let request = tonic::Request::new(HelloRequest {
12         name: "Tonic".into(),
13     });
14 
15     let response = client.say_hello(request).await?;
16 
17     println!("RESPONSE={:?}", response);
18 
19     Ok(())
20 }
21