Skip to content

Commit

Permalink
Merge pull request #32 from adamrk/update-example
Browse files Browse the repository at this point in the history
fix example
  • Loading branch information
adamrk authored Sep 20, 2022
2 parents 1c8863d + 27fd9bd commit 5cdde90
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ jobs:
- uses: actions/checkout@main
- name: Run tests
run: cargo test --verbose --all-features
- name: Run example
run: |
cargo run --bin example > log
grep '^Got 33$' log
4 changes: 2 additions & 2 deletions example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ license = "MIT"
[dependencies]
tokio = { version = "1.0", features = [ "full" ] }
tokio-stream = { version = "0.1", features = [ "net" ] }
tonic = "0.7"
tonic-rpc = { path = "../tonic-rpc" }
tonic = "0.8"
tonic-rpc = { path = "../tonic-rpc", features = ["json"] }
3 changes: 1 addition & 2 deletions example/src/example.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg(feature = "json")]
use tokio::net::TcpListener;
use tokio_stream::wrappers::TcpListenerStream;
use tonic::transport::Server;
Expand Down Expand Up @@ -29,7 +28,7 @@ impl increment_server::Increment for State {
}

/// Run the server.
async fn run_server() {
pub(crate) async fn run_server() {
let listener = TcpListener::bind("[::1]:8080").await.unwrap();
let addr = listener.local_addr().unwrap();
tokio::spawn(async move {
Expand Down
8 changes: 3 additions & 5 deletions example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#[cfg(feature = "json")]
mod example;

#[tokio::main]
async fn main() {
example::run_server()
example::run_server().await
}

#[cfg(not(feature = "json"))]
fn main() {}

0 comments on commit 5cdde90

Please sign in to comment.