|
@@ -7,9 +7,9 @@ use tokio::sync::Notify;
|
|
|
/// Any copy of the owner (created via clone) can send or receive objects,
|
|
|
/// but only one copy will receive any particular object.
|
|
|
#[derive(Default)]
|
|
|
-pub struct Updater<T>(Arc<(Mutex<Option<T>>, Notify)>);
|
|
|
+pub struct Updater<T: Send + Sync>(Arc<(Mutex<Option<T>>, Notify)>);
|
|
|
|
|
|
-impl<T> Updater<T> {
|
|
|
+impl<T: Send + Sync> Updater<T> {
|
|
|
/// Send an object T to the receiver end, repacing any currently queued object.
|
|
|
pub fn send(&self, value: T) {
|
|
|
let mut locked_object = self.0 .0.lock().expect("send failed to lock mutex");
|
|
@@ -46,7 +46,7 @@ impl<T> Updater<T> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl<T> Clone for Updater<T> {
|
|
|
+impl<T: Send + Sync> Clone for Updater<T> {
|
|
|
fn clone(&self) -> Self {
|
|
|
Updater(Arc::clone(&self.0))
|
|
|
}
|