Skip to content

Commit

Permalink
Merge pull request #30 from boydjohnson/bump-outdated
Browse files Browse the repository at this point in the history
Bump tonic, tonic-build to 0.7, bump heck
  • Loading branch information
adamrk authored Sep 19, 2022
2 parents a80c65f + 4d5cc93 commit 201eaab
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion 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.4"
tonic = "0.7"
tonic-rpc = { path = "../tonic-rpc" }
6 changes: 3 additions & 3 deletions tonic-rpc-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tonic-rpc-macro"
version = "0.1.0"
version = "0.2.0"
authors = ["Adam Bratschi-Kaye <ark.email@gmail.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -16,9 +16,9 @@ Core macro for tonic-rpc.
proc-macro = true

[dependencies]
heck = "0.3"
heck = "0.4"
itertools = "0.10"
syn = { version = "1.0", features = ["full"] }
tonic-build = "0.4"
tonic-build = "0.7"
proc-macro2 = "1.0"
quote = "1.0"
8 changes: 4 additions & 4 deletions tonic-rpc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use syn::{
parse_macro_input, punctuated::Pair, FnArg, ItemTrait, ReturnType, TraitItem, TraitItemMethod,
Type,
};
use tonic_build::{Method, Service};
use tonic_build::{Attributes, Method, Service};

struct RustDefMethod {
pub name: String,
Expand Down Expand Up @@ -213,7 +213,7 @@ fn make_method<T: From<RustDefMethod>>(method: TraitItemMethod, trait_name: &str
quote::format_ident!("__tonic_generated_{}_{}_response", trait_name, name);

RustDefMethod {
identifier: heck::CamelCase::to_camel_case(name.as_str()),
identifier: heck::ToUpperCamelCase::to_upper_camel_case(name.as_str()),
name,
client_streaming,
server_streaming,
Expand Down Expand Up @@ -247,8 +247,8 @@ where
name,
methods,
};
let client = tonic_build::client::generate(&service, false, "", false);
let server = tonic_build::server::generate(&service, false, "", false);
let client = tonic_build::client::generate(&service, false, "", false, &Attributes::default());
let server = tonic_build::server::generate(&service, false, "", false, &Attributes::default());
let types = service.methods.iter().map(|m| {
let request_name = m.generated_request();
let response_name = m.generated_response();
Expand Down
10 changes: 5 additions & 5 deletions tonic-rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tonic-rpc"
version = "0.1.1"
version = "0.2.0"
authors = ["Adam Bratschi-Kaye <ark.email@gmail.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -24,12 +24,12 @@ messagepack = ["rmp-serde"]
[dependencies]
bytes = "1.0"
serde = { version = "1.0", features = ["derive"] }
tonic = "0.4"
tonic-rpc-macro = { version = "0.1", path = "../tonic-rpc-macro" }
tonic = "0.7"
tonic-rpc-macro = { version = "0.2", path = "../tonic-rpc-macro" }

# optional codecs
bincode = { version = "1.3", optional = true }
rmp-serde = { version = "0.15", optional = true }
rmp-serde = { version = "1.1", optional = true }
serde_json = { version = "1.0", optional = true }
serde_cbor = { version = "0.11", optional = true }

Expand All @@ -39,7 +39,7 @@ tokio = { version = "1.4", features = [ "full" ] }
tokio-stream = { version = "0.1", features = [ "net" ] }

[build-dependencies]
tonic-build = "0.4"
tonic-build = "0.7"

# docs.rs-specific configuration
[package.metadata.docs.rs]
Expand Down
9 changes: 6 additions & 3 deletions tonic-rpc/tests/util/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{error::Error};
use std::convert::Infallible;

use tokio::net::TcpListener;
use tokio_stream::wrappers::TcpListenerStream;
Expand All @@ -14,9 +14,12 @@ use tonic::{
/// Returns the address to connect to.
pub async fn run_server<S>(svc: S) -> String
where
S: Service<Request<Body>, Response = Response<BoxBody>> + NamedService + Clone + Send + 'static,
S: Service<Request<Body>, Response = Response<BoxBody>, Error = Infallible>
+ NamedService
+ Clone
+ Send
+ 'static,
S::Future: Send + 'static,
S::Error: Error + Send + Sync,
{
let listener = TcpListener::bind("[::1]:0").await.unwrap();
let port = listener.local_addr().unwrap().port();
Expand Down

0 comments on commit 201eaab

Please sign in to comment.