mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-23 23:32:30 +00:00
Hand-roll Clone impl instead of derive
This commit is contained in:
parent
20bf995c3b
commit
ccc2ddab66
@ -12,13 +12,22 @@ use super::Error;
|
||||
/// There is no guarantee that muliple partitions on the same flash
|
||||
/// operate on mutually exclusive ranges - such a separation is up to
|
||||
/// the user to guarantee.
|
||||
#[derive(Clone)]
|
||||
pub struct Partition<'a, M: RawMutex, T: NorFlash> {
|
||||
flash: &'a Mutex<M, T>,
|
||||
offset: u32,
|
||||
size: u32,
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, T: NorFlash> Clone for Partition<'a, M, T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
flash: self.flash,
|
||||
offset: self.offset,
|
||||
size: self.size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> {
|
||||
/// Create a new partition
|
||||
pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self {
|
||||
|
@ -13,13 +13,22 @@ use super::Error;
|
||||
/// There is no guarantee that muliple partitions on the same flash
|
||||
/// operate on mutually exclusive ranges - such a separation is up to
|
||||
/// the user to guarantee.
|
||||
#[derive(Clone)]
|
||||
pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> {
|
||||
flash: &'a Mutex<M, RefCell<T>>,
|
||||
offset: u32,
|
||||
size: u32,
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, T: NorFlash> Clone for BlockingPartition<'a, M, T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
flash: self.flash,
|
||||
offset: self.offset,
|
||||
size: self.size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> {
|
||||
/// Create a new partition
|
||||
pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self {
|
||||
|
Loading…
Reference in New Issue
Block a user