diff options
| -rw-r--r-- | embassy-sync/src/channel.rs | 12 | ||||
| -rw-r--r-- | embassy-sync/src/pipe.rs | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index f421af392..d6f36f53d 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs | |||
| @@ -30,7 +30,6 @@ use crate::blocking_mutex::Mutex; | |||
| 30 | use crate::waitqueue::WakerRegistration; | 30 | use crate::waitqueue::WakerRegistration; |
| 31 | 31 | ||
| 32 | /// Send-only access to a [`Channel`]. | 32 | /// Send-only access to a [`Channel`]. |
| 33 | #[derive(Copy)] | ||
| 34 | pub struct Sender<'ch, M, T, const N: usize> | 33 | pub struct Sender<'ch, M, T, const N: usize> |
| 35 | where | 34 | where |
| 36 | M: RawMutex, | 35 | M: RawMutex, |
| @@ -47,6 +46,8 @@ where | |||
| 47 | } | 46 | } |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 49 | impl<'ch, M, T, const N: usize> Copy for Sender<'ch, M, T, N> where M: RawMutex {} | ||
| 50 | |||
| 50 | impl<'ch, M, T, const N: usize> Sender<'ch, M, T, N> | 51 | impl<'ch, M, T, const N: usize> Sender<'ch, M, T, N> |
| 51 | where | 52 | where |
| 52 | M: RawMutex, | 53 | M: RawMutex, |
| @@ -67,7 +68,6 @@ where | |||
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | /// Send-only access to a [`Channel`] without knowing channel size. | 70 | /// Send-only access to a [`Channel`] without knowing channel size. |
| 70 | #[derive(Copy)] | ||
| 71 | pub struct DynamicSender<'ch, T> { | 71 | pub struct DynamicSender<'ch, T> { |
| 72 | channel: &'ch dyn DynamicChannel<T>, | 72 | channel: &'ch dyn DynamicChannel<T>, |
| 73 | } | 73 | } |
| @@ -78,6 +78,8 @@ impl<'ch, T> Clone for DynamicSender<'ch, T> { | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | impl<'ch, T> Copy for DynamicSender<'ch, T> {} | ||
| 82 | |||
| 81 | impl<'ch, M, T, const N: usize> From<Sender<'ch, M, T, N>> for DynamicSender<'ch, T> | 83 | impl<'ch, M, T, const N: usize> From<Sender<'ch, M, T, N>> for DynamicSender<'ch, T> |
| 82 | where | 84 | where |
| 83 | M: RawMutex, | 85 | M: RawMutex, |
| @@ -107,7 +109,6 @@ impl<'ch, T> DynamicSender<'ch, T> { | |||
| 107 | } | 109 | } |
| 108 | 110 | ||
| 109 | /// Receive-only access to a [`Channel`]. | 111 | /// Receive-only access to a [`Channel`]. |
| 110 | #[derive(Copy)] | ||
| 111 | pub struct Receiver<'ch, M, T, const N: usize> | 112 | pub struct Receiver<'ch, M, T, const N: usize> |
| 112 | where | 113 | where |
| 113 | M: RawMutex, | 114 | M: RawMutex, |
| @@ -124,6 +125,8 @@ where | |||
| 124 | } | 125 | } |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 128 | impl<'ch, M, T, const N: usize> Copy for Receiver<'ch, M, T, N> where M: RawMutex {} | ||
| 129 | |||
| 127 | impl<'ch, M, T, const N: usize> Receiver<'ch, M, T, N> | 130 | impl<'ch, M, T, const N: usize> Receiver<'ch, M, T, N> |
| 128 | where | 131 | where |
| 129 | M: RawMutex, | 132 | M: RawMutex, |
| @@ -144,7 +147,6 @@ where | |||
| 144 | } | 147 | } |
| 145 | 148 | ||
| 146 | /// Receive-only access to a [`Channel`] without knowing channel size. | 149 | /// Receive-only access to a [`Channel`] without knowing channel size. |
| 147 | #[derive(Copy)] | ||
| 148 | pub struct DynamicReceiver<'ch, T> { | 150 | pub struct DynamicReceiver<'ch, T> { |
| 149 | channel: &'ch dyn DynamicChannel<T>, | 151 | channel: &'ch dyn DynamicChannel<T>, |
| 150 | } | 152 | } |
| @@ -155,6 +157,8 @@ impl<'ch, T> Clone for DynamicReceiver<'ch, T> { | |||
| 155 | } | 157 | } |
| 156 | } | 158 | } |
| 157 | 159 | ||
| 160 | impl<'ch, T> Copy for DynamicReceiver<'ch, T> {} | ||
| 161 | |||
| 158 | impl<'ch, T> DynamicReceiver<'ch, T> { | 162 | impl<'ch, T> DynamicReceiver<'ch, T> { |
| 159 | /// Receive the next value. | 163 | /// Receive the next value. |
| 160 | /// | 164 | /// |
diff --git a/embassy-sync/src/pipe.rs b/embassy-sync/src/pipe.rs index 6e3e77b49..21d451ea6 100644 --- a/embassy-sync/src/pipe.rs +++ b/embassy-sync/src/pipe.rs | |||
| @@ -11,7 +11,6 @@ use crate::ring_buffer::RingBuffer; | |||
| 11 | use crate::waitqueue::WakerRegistration; | 11 | use crate::waitqueue::WakerRegistration; |
| 12 | 12 | ||
| 13 | /// Write-only access to a [`Pipe`]. | 13 | /// Write-only access to a [`Pipe`]. |
| 14 | #[derive(Copy)] | ||
| 15 | pub struct Writer<'p, M, const N: usize> | 14 | pub struct Writer<'p, M, const N: usize> |
| 16 | where | 15 | where |
| 17 | M: RawMutex, | 16 | M: RawMutex, |
| @@ -28,6 +27,8 @@ where | |||
| 28 | } | 27 | } |
| 29 | } | 28 | } |
| 30 | 29 | ||
| 30 | impl<'p, M, const N: usize> Copy for Writer<'p, M, N> where M: RawMutex {} | ||
| 31 | |||
| 31 | impl<'p, M, const N: usize> Writer<'p, M, N> | 32 | impl<'p, M, const N: usize> Writer<'p, M, N> |
| 32 | where | 33 | where |
| 33 | M: RawMutex, | 34 | M: RawMutex, |
| @@ -74,7 +75,6 @@ where | |||
| 74 | impl<'p, M, const N: usize> Unpin for WriteFuture<'p, M, N> where M: RawMutex {} | 75 | impl<'p, M, const N: usize> Unpin for WriteFuture<'p, M, N> where M: RawMutex {} |
| 75 | 76 | ||
| 76 | /// Read-only access to a [`Pipe`]. | 77 | /// Read-only access to a [`Pipe`]. |
| 77 | #[derive(Copy)] | ||
| 78 | pub struct Reader<'p, M, const N: usize> | 78 | pub struct Reader<'p, M, const N: usize> |
| 79 | where | 79 | where |
| 80 | M: RawMutex, | 80 | M: RawMutex, |
| @@ -91,6 +91,8 @@ where | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | impl<'p, M, const N: usize> Copy for Reader<'p, M, N> where M: RawMutex {} | ||
| 95 | |||
| 94 | impl<'p, M, const N: usize> Reader<'p, M, N> | 96 | impl<'p, M, const N: usize> Reader<'p, M, N> |
| 95 | where | 97 | where |
| 96 | M: RawMutex, | 98 | M: RawMutex, |
