Add easy connect method in codegen
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use tonic::transport::Channel;
|
||||
|
||||
pub mod hello_world {
|
||||
include!(concat!(env!("OUT_DIR"), "/helloworld.rs"));
|
||||
}
|
||||
@@ -8,11 +6,7 @@ use hello_world::{client::GreeterClient, HelloRequest};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let origin = vec![http::Uri::from_static("http://[::1]:50051").into()];
|
||||
|
||||
let svc = Channel::builder().balance_list(origin)?;
|
||||
|
||||
let mut client = GreeterClient::new(svc);
|
||||
let mut client = GreeterClient::connect("http://[::1]:50051")?;
|
||||
|
||||
let request = tonic::Request::new(HelloRequest {
|
||||
name: "hello".into(),
|
||||
|
||||
Reference in New Issue
Block a user