Ensure Context is Send.

This commit is contained in:
Tim Kuehn
2020-08-01 13:49:25 -07:00
parent 4987094483
commit c9803688cc
2 changed files with 4 additions and 0 deletions

View File

@@ -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" }

View File

@@ -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)