diff options
Diffstat (limited to 'src/client.rs')
| -rw-r--r-- | src/client.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs new file mode 100644 index 0000000..aaf42de --- /dev/null +++ b/src/client.rs @@ -0,0 +1,20 @@ +use hello_world::HelloRequest; +use hello_world::greeter_client::GreeterClient; + +pub mod hello_world { + tonic::include_proto!("helloworld"); +} + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let mut client = GreeterClient::connect("http://[::1]:50051").await?; + + let request = tonic::Request::new(HelloRequest { + name: "Tonic".into(), + }); + + let response = client.say_hello(request).await?; + println!("RESPONSE={:?}", response); + + Ok(()) +} |
