Skip to content

Commit 6142cd2

Browse files
authored
Merge branch 'main' into trace-debug-not-info
2 parents e3e4644 + 6a27dc4 commit 6142cd2

33 files changed

+129
-128
lines changed

example-service/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "tarpc-example-service"
33
version = "0.17.0"
4-
rust-version = "1.65.0"
4+
rust-version = "1.85.0"
55
authors = ["Tim Kuehn <tikue@google.com>"]
6-
edition = "2021"
6+
edition = "2024"
77
license = "MIT"
88
documentation = "https://docs.rs/tarpc-example-service"
99
homepage = "https://github.com/google/tarpc"

example-service/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// https://opensource.org/licenses/MIT.
66

77
use clap::Parser;
8-
use service::{init_tracing, WorldClient};
8+
use service::{WorldClient, init_tracing};
99
use std::{net::SocketAddr, time::Duration};
1010
use tarpc::{client, context, tokio_serde::formats::Json};
1111
use tokio::time::sleep;

example-service/src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ use rand::{
1010
distributions::{Distribution, Uniform},
1111
thread_rng,
1212
};
13-
use service::{init_tracing, World};
13+
use service::{World, init_tracing};
1414
use std::{
1515
net::{IpAddr, Ipv6Addr, SocketAddr},
1616
time::Duration,
1717
};
1818
use tarpc::{
1919
context,
20-
server::{self, incoming::Incoming, Channel},
20+
server::{self, Channel, incoming::Incoming},
2121
tokio_serde::formats::Json,
2222
};
2323
use tokio::time;

hooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ diff=""
9393
for file in $(git diff --name-only --cached);
9494
do
9595
if [ ${file: -3} == ".rs" ]; then
96-
diff="$diff$(rustfmt --edition 2018 --check $file)"
96+
diff="$diff$(rustfmt --edition 2024 --check $file)"
9797
if [ $? != 0 ]; then
9898
FMTRESULT=1
9999
fi

plugins/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "tarpc-plugins"
33
version = "0.14.1"
4-
rust-version = "1.65.0"
4+
rust-version = "1.85.0"
55
authors = ["Adam Wright <adam.austin.wright@gmail.com>", "Tim Kuehn <timothy.j.kuehn@gmail.com>"]
6-
edition = "2021"
6+
edition = "2024"
77
license = "MIT"
88
documentation = "https://docs.rs/tarpc-plugins"
99
homepage = "https://github.com/google/tarpc"

plugins/rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
edition = "2018"
1+
edition = "2024"

plugins/src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ extern crate syn;
1313

1414
use proc_macro::TokenStream;
1515
use proc_macro2::TokenStream as TokenStream2;
16-
use quote::{format_ident, quote, ToTokens};
16+
use quote::{ToTokens, format_ident, quote};
1717
use syn::{
18-
braced,
18+
AttrStyle, Attribute, Expr, FnArg, Ident, Lit, LitBool, MetaNameValue, Pat, PatType, Path,
19+
ReturnType, Token, Type, Visibility, braced,
1920
ext::IdentExt,
2021
parenthesized,
2122
parse::{Parse, ParseStream},
2223
parse_macro_input, parse_quote,
2324
spanned::Spanned,
2425
token::Comma,
25-
AttrStyle, Attribute, Expr, FnArg, Ident, Lit, LitBool, MetaNameValue, Pat, PatType, Path,
26-
ReturnType, Token, Type, Visibility,
2726
};
2827

2928
/// Accumulates multiple errors into a result.
@@ -339,12 +338,12 @@ impl Parse for DeriveMeta {
339338
#[proc_macro_attribute]
340339
#[cfg(feature = "serde1")]
341340
pub fn derive_serde(_attr: TokenStream, item: TokenStream) -> TokenStream {
342-
let mut gen: proc_macro2::TokenStream = quote! {
341+
let mut derives: proc_macro2::TokenStream = quote! {
343342
#[derive(::tarpc::serde::Serialize, ::tarpc::serde::Deserialize)]
344343
#[serde(crate = "::tarpc::serde")]
345344
};
346-
gen.extend(proc_macro2::TokenStream::from(item));
347-
proc_macro::TokenStream::from(gen)
345+
derives.extend(proc_macro2::TokenStream::from(item));
346+
proc_macro::TokenStream::from(derives)
348347
}
349348

350349
fn collect_cfg_attrs(rpcs: &[RpcMethod]) -> Vec<Vec<&Attribute>> {

tarpc/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "tarpc"
33
version = "0.37.0"
4-
rust-version = "1.65.0"
4+
rust-version = "1.85.0"
55
authors = [
66
"Adam Wright <adam.austin.wright@gmail.com>",
77
"Tim Kuehn <timothy.j.kuehn@gmail.com>",
88
]
9-
edition = "2021"
9+
edition = "2024"
1010
license = "MIT"
1111
documentation = "https://docs.rs/tarpc"
1212
homepage = "https://github.com/google/tarpc"
@@ -64,7 +64,7 @@ opentelemetry-semantic-conventions = "0.30.0"
6464

6565
[dev-dependencies]
6666
assert_matches = "1.4"
67-
bincode = "1.3"
67+
bincode = { version = "2.0", features = ["serde"] }
6868
bytes = { version = "1", features = ["serde"] }
6969
flate2 = "1.0"
7070
futures-test = "0.3"

tarpc/examples/compression.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// license that can be found in the LICENSE file or at
55
// https://opensource.org/licenses/MIT.
66

7-
use flate2::{read::DeflateDecoder, write::DeflateEncoder, Compression};
8-
use futures::{prelude::*, Sink, SinkExt, Stream, StreamExt, TryStreamExt};
7+
use flate2::{Compression, read::DeflateDecoder, write::DeflateEncoder};
8+
use futures::{Sink, SinkExt, Stream, StreamExt, TryStreamExt, prelude::*};
99
use serde::{Deserialize, Serialize};
1010
use serde_bytes::ByteBuf;
1111
use std::{io, io::Read, io::Write};
@@ -74,7 +74,7 @@ where
7474
}
7575

7676
fn serialize<T: Serialize>(t: T) -> io::Result<ByteBuf> {
77-
bincode::serialize(&t)
77+
bincode::serde::encode_to_vec(&t, bincode::config::standard())
7878
.map(ByteBuf::from)
7979
.map_err(io::Error::other)
8080
}
@@ -83,12 +83,14 @@ fn deserialize<D>(message: ByteBuf) -> io::Result<D>
8383
where
8484
for<'a> D: Deserialize<'a>,
8585
{
86-
bincode::deserialize(message.as_ref()).map_err(io::Error::other)
86+
let (d, _) = bincode::serde::decode_from_slice(message.as_ref(), bincode::config::standard())
87+
.map_err(io::Error::other)?;
88+
Ok(d)
8789
}
8890

8991
fn add_compression<In, Out>(
9092
transport: impl Stream<Item = io::Result<CompressedMessage<In>>>
91-
+ Sink<CompressedMessage<Out>, Error = io::Error>,
93+
+ Sink<CompressedMessage<Out>, Error = io::Error>,
9294
) -> impl Stream<Item = io::Result<In>> + Sink<Out, Error = io::Error>
9395
where
9496
Out: Serialize,

tarpc/examples/pubsub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Subscriber {
113113
return Err(anyhow!(
114114
"[{}] Server never initialized the subscriber.",
115115
local_addr
116-
))
116+
));
117117
}
118118
};
119119
let (handler, abort_handle) =

0 commit comments

Comments
 (0)