mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 23:02:30 +00:00
Merge pull request #1760 from sinewave-ee/master
embassy-sync: manual Copy impls for channel and pipe
This commit is contained in:
commit
47b8e04b1c
@ -30,7 +30,6 @@ use crate::blocking_mutex::Mutex;
|
|||||||
use crate::waitqueue::WakerRegistration;
|
use crate::waitqueue::WakerRegistration;
|
||||||
|
|
||||||
/// Send-only access to a [`Channel`].
|
/// Send-only access to a [`Channel`].
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct Sender<'ch, M, T, const N: usize>
|
pub struct Sender<'ch, M, T, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -47,6 +46,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'ch, M, T, const N: usize> Copy for Sender<'ch, M, T, N> where M: RawMutex {}
|
||||||
|
|
||||||
impl<'ch, M, T, const N: usize> Sender<'ch, M, T, N>
|
impl<'ch, M, T, const N: usize> Sender<'ch, M, T, N>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -67,7 +68,6 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Send-only access to a [`Channel`] without knowing channel size.
|
/// Send-only access to a [`Channel`] without knowing channel size.
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct DynamicSender<'ch, T> {
|
pub struct DynamicSender<'ch, T> {
|
||||||
channel: &'ch dyn DynamicChannel<T>,
|
channel: &'ch dyn DynamicChannel<T>,
|
||||||
}
|
}
|
||||||
@ -78,6 +78,8 @@ impl<'ch, T> Clone for DynamicSender<'ch, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'ch, T> Copy for DynamicSender<'ch, T> {}
|
||||||
|
|
||||||
impl<'ch, M, T, const N: usize> From<Sender<'ch, M, T, N>> for DynamicSender<'ch, T>
|
impl<'ch, M, T, const N: usize> From<Sender<'ch, M, T, N>> for DynamicSender<'ch, T>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -107,7 +109,6 @@ impl<'ch, T> DynamicSender<'ch, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Receive-only access to a [`Channel`].
|
/// Receive-only access to a [`Channel`].
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct Receiver<'ch, M, T, const N: usize>
|
pub struct Receiver<'ch, M, T, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -124,6 +125,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'ch, M, T, const N: usize> Copy for Receiver<'ch, M, T, N> where M: RawMutex {}
|
||||||
|
|
||||||
impl<'ch, M, T, const N: usize> Receiver<'ch, M, T, N>
|
impl<'ch, M, T, const N: usize> Receiver<'ch, M, T, N>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -144,7 +147,6 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Receive-only access to a [`Channel`] without knowing channel size.
|
/// Receive-only access to a [`Channel`] without knowing channel size.
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct DynamicReceiver<'ch, T> {
|
pub struct DynamicReceiver<'ch, T> {
|
||||||
channel: &'ch dyn DynamicChannel<T>,
|
channel: &'ch dyn DynamicChannel<T>,
|
||||||
}
|
}
|
||||||
@ -155,6 +157,8 @@ impl<'ch, T> Clone for DynamicReceiver<'ch, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'ch, T> Copy for DynamicReceiver<'ch, T> {}
|
||||||
|
|
||||||
impl<'ch, T> DynamicReceiver<'ch, T> {
|
impl<'ch, T> DynamicReceiver<'ch, T> {
|
||||||
/// Receive the next value.
|
/// Receive the next value.
|
||||||
///
|
///
|
||||||
|
@ -11,7 +11,6 @@ use crate::ring_buffer::RingBuffer;
|
|||||||
use crate::waitqueue::WakerRegistration;
|
use crate::waitqueue::WakerRegistration;
|
||||||
|
|
||||||
/// Write-only access to a [`Pipe`].
|
/// Write-only access to a [`Pipe`].
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct Writer<'p, M, const N: usize>
|
pub struct Writer<'p, M, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -28,6 +27,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'p, M, const N: usize> Copy for Writer<'p, M, N> where M: RawMutex {}
|
||||||
|
|
||||||
impl<'p, M, const N: usize> Writer<'p, M, N>
|
impl<'p, M, const N: usize> Writer<'p, M, N>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -74,7 +75,6 @@ where
|
|||||||
impl<'p, M, const N: usize> Unpin for WriteFuture<'p, M, N> where M: RawMutex {}
|
impl<'p, M, const N: usize> Unpin for WriteFuture<'p, M, N> where M: RawMutex {}
|
||||||
|
|
||||||
/// Read-only access to a [`Pipe`].
|
/// Read-only access to a [`Pipe`].
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct Reader<'p, M, const N: usize>
|
pub struct Reader<'p, M, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -91,6 +91,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'p, M, const N: usize> Copy for Reader<'p, M, N> where M: RawMutex {}
|
||||||
|
|
||||||
impl<'p, M, const N: usize> Reader<'p, M, N>
|
impl<'p, M, const N: usize> Reader<'p, M, N>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
|
Loading…
Reference in New Issue
Block a user