From 1a23a01aa05adbf4f253bbca087af6d17cdad0b2 Mon Sep 17 00:00:00 2001 From: Centaurus99 Date: Sun, 17 Mar 2024 08:16:00 +0000 Subject: [PATCH] feat(model): add send to trace config and model --- src/lib.rs | 6 +++--- src/model/bw.rs | 2 +- src/model/delay.rs | 2 +- src/model/loss.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dcaa6c1..c07f20d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -146,7 +146,7 @@ pub type LossPattern = Vec; /// /// The next_bw function either returns **the next bandwidth and its duration** /// in the sequence, or **None** if the trace goes to end. -pub trait BwTrace { +pub trait BwTrace: Send { fn next_bw(&mut self) -> Option<(Bandwidth, Duration)>; } @@ -161,7 +161,7 @@ pub trait BwTrace { /// /// The next_delay function either returns **the next delay and its duration** /// in the sequence, or **None** if the trace goes to end. -pub trait DelayTrace { +pub trait DelayTrace: Send { fn next_delay(&mut self) -> Option<(Delay, Duration)>; } @@ -173,7 +173,7 @@ pub trait DelayTrace { /// /// The next_loss function either returns **the next loss_pattern and its duration** /// in the sequence, or **None** if the trace goes to end. -pub trait LossTrace { +pub trait LossTrace: Send { fn next_loss(&mut self) -> Option<(LossPattern, Duration)>; } diff --git a/src/model/bw.rs b/src/model/bw.rs index 8d5cea8..6f87933 100644 --- a/src/model/bw.rs +++ b/src/model/bw.rs @@ -69,7 +69,7 @@ const DEFAULT_RNG_SEED: u64 = 42; /// separate the configuration part into a simple struct for serialization/deserialization, and /// construct the model from the configuration. #[cfg_attr(feature = "serde", typetag::serde)] -pub trait BwTraceConfig: DynClone { +pub trait BwTraceConfig: DynClone + Send { fn into_model(self: Box) -> Box; } diff --git a/src/model/delay.rs b/src/model/delay.rs index ed88762..c933dc5 100644 --- a/src/model/delay.rs +++ b/src/model/delay.rs @@ -63,7 +63,7 @@ use dyn_clone::DynClone; /// separate the configuration part into a simple struct for serialization/deserialization, and /// construct the model from the configuration. #[cfg_attr(feature = "serde", typetag::serde)] -pub trait DelayTraceConfig: DynClone { +pub trait DelayTraceConfig: DynClone + Send { fn into_model(self: Box) -> Box; } diff --git a/src/model/loss.rs b/src/model/loss.rs index 3174b69..558fa22 100644 --- a/src/model/loss.rs +++ b/src/model/loss.rs @@ -63,7 +63,7 @@ use dyn_clone::DynClone; /// separate the configuration part into a simple struct for serialization/deserialization, and /// construct the model from the configuration. #[cfg_attr(feature = "serde", typetag::serde)] -pub trait LossTraceConfig: DynClone { +pub trait LossTraceConfig: DynClone + Send { fn into_model(self: Box) -> Box; }