-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
656 additions
and
267 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
syntax = "proto3"; | ||
|
||
package echo; | ||
|
||
message EchoRequest { | ||
string message = 1; | ||
} | ||
|
||
message EchoResponse { | ||
string message = 1; | ||
} | ||
|
||
service Echo { | ||
rpc UnaryEcho(EchoRequest) returns (EchoResponse) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
use std::net::SocketAddr; | ||
|
||
use lazy_static::lazy_static; | ||
|
||
lazy_static! { | ||
static ref GREETER_CLIENT: volo_gen::proto_gen::hello::GreeterClient = { | ||
let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap(); | ||
volo_gen::proto_gen::hello::GreeterClientBuilder::new("hello") | ||
.address(addr) | ||
.build() | ||
}; | ||
static ref ECHO_CLIENT: volo_gen::proto_gen::echo::EchoClient = { | ||
let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap(); | ||
volo_gen::proto_gen::echo::EchoClientBuilder::new("hello") | ||
.address(addr) | ||
.build() | ||
}; | ||
} | ||
|
||
#[volo::main] | ||
async fn main() { | ||
let req = volo_gen::proto_gen::hello::HelloRequest { | ||
name: "Volo".to_string(), | ||
}; | ||
let resp = GREETER_CLIENT.clone().say_hello(req).await; | ||
match resp { | ||
Ok(info) => println!("GREETER: {info:?}"), | ||
Err(e) => eprintln!("GREETER: {e:?}"), | ||
} | ||
|
||
let req = volo_gen::proto_gen::echo::EchoRequest { | ||
message: "Volo".to_string(), | ||
}; | ||
let resp = ECHO_CLIENT.clone().unary_echo(req).await; | ||
match resp { | ||
Ok(info) => println!("ECHO: {info:?}"), | ||
Err(e) => eprintln!("ECHO: {e:?}"), | ||
} | ||
} |
Oops, something went wrong.