Tighten sender/receiver bounds

This commit is contained in:
huntc 2021-07-14 13:39:23 +10:00
parent d86892ca56
commit babee7f32a

View File

@ -65,8 +65,10 @@ where
} }
// Safe to pass the sender around // Safe to pass the sender around
unsafe impl<'ch, M, T, const N: usize> Send for Sender<'ch, M, T, N> where M: Mutex<Data = ()> {} unsafe impl<'ch, M, T, const N: usize> Send for Sender<'ch, M, T, N> where M: Mutex<Data = ()> + Sync
unsafe impl<'ch, M, T, const N: usize> Sync for Sender<'ch, M, T, N> where M: Mutex<Data = ()> {} {}
unsafe impl<'ch, M, T, const N: usize> Sync for Sender<'ch, M, T, N> where M: Mutex<Data = ()> + Sync
{}
/// Receive values from the associated `Sender`. /// Receive values from the associated `Sender`.
/// ///
@ -79,8 +81,14 @@ where
} }
// Safe to pass the receiver around // Safe to pass the receiver around
unsafe impl<'ch, M, T, const N: usize> Send for Receiver<'ch, M, T, N> where M: Mutex<Data = ()> {} unsafe impl<'ch, M, T, const N: usize> Send for Receiver<'ch, M, T, N> where
unsafe impl<'ch, M, T, const N: usize> Sync for Receiver<'ch, M, T, N> where M: Mutex<Data = ()> {} M: Mutex<Data = ()> + Sync
{
}
unsafe impl<'ch, M, T, const N: usize> Sync for Receiver<'ch, M, T, N> where
M: Mutex<Data = ()> + Sync
{
}
/// Splits a bounded mpsc channel into a `Sender` and `Receiver`. /// Splits a bounded mpsc channel into a `Sender` and `Receiver`.
/// ///