From c9803688ccf47a200003b3f630eb81d7d94def1a Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Sat, 1 Aug 2020 13:49:25 -0700 Subject: [PATCH] Ensure Context is Send. --- tarpc/Cargo.toml | 1 + tarpc/src/rpc/context.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index c3621c4..8b0da93 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -35,6 +35,7 @@ pin-project = "0.4.17" rand = "0.7" tokio = { version = "0.2", features = ["time"] } serde = { optional = true, version = "1.0", features = ["derive"] } +static_assertions = "1.1.0" tokio-util = { optional = true, version = "0.2" } tarpc-plugins = { path = "../plugins", version = "0.8" } tokio-serde = { optional = true, version = "0.6" } diff --git a/tarpc/src/rpc/context.rs b/tarpc/src/rpc/context.rs index 5c671f8..6e31d36 100644 --- a/tarpc/src/rpc/context.rs +++ b/tarpc/src/rpc/context.rs @@ -8,6 +8,7 @@ //! client to server and is used by the server to enforce response deadlines. use crate::trace::{self, TraceId}; +use static_assertions::assert_impl_all; use std::time::{Duration, SystemTime}; /// A request context that carries request-scoped information like deadlines and trace information. @@ -38,6 +39,8 @@ pub struct Context { pub trace_context: trace::Context, } +assert_impl_all!(Context: Send); + #[cfg(feature = "serde1")] fn ten_seconds_from_now() -> SystemTime { SystemTime::now() + Duration::from_secs(10)