diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-07-18 11:36:47 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-07-18 11:36:47 +0000 |
| commit | 94b2143463e02026bf74374eb6a4db83bcc92e08 (patch) | |
| tree | 5c4b5b1c5c722aef26d4b7217a9c50f4e131e123 | |
| parent | 5236df97c65fb30885d0304cdbca3d92986ac8bb (diff) | |
| parent | ccc2ddab6694a0588d191aec5ab3fa2c82c60b18 (diff) | |
Merge pull request #3195 from MathiasKoch/chore/flash-partition-clone
chore(embassy-embedded-hal): Add Clone impl to flash Partition
| -rw-r--r-- | embassy-embedded-hal/src/flash/partition/asynch.rs | 10 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/flash/partition/blocking.rs | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/embassy-embedded-hal/src/flash/partition/asynch.rs b/embassy-embedded-hal/src/flash/partition/asynch.rs index 5920436dd..1b0c91232 100644 --- a/embassy-embedded-hal/src/flash/partition/asynch.rs +++ b/embassy-embedded-hal/src/flash/partition/asynch.rs | |||
| @@ -18,6 +18,16 @@ pub struct Partition<'a, M: RawMutex, T: NorFlash> { | |||
| 18 | size: u32, | 18 | size: u32, |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | impl<'a, M: RawMutex, T: NorFlash> Clone for Partition<'a, M, T> { | ||
| 22 | fn clone(&self) -> Self { | ||
| 23 | Self { | ||
| 24 | flash: self.flash, | ||
| 25 | offset: self.offset, | ||
| 26 | size: self.size, | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 21 | impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> { | 31 | impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> { |
| 22 | /// Create a new partition | 32 | /// Create a new partition |
| 23 | pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self { | 33 | pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self { |
diff --git a/embassy-embedded-hal/src/flash/partition/blocking.rs b/embassy-embedded-hal/src/flash/partition/blocking.rs index 2ddbe3de0..a68df7812 100644 --- a/embassy-embedded-hal/src/flash/partition/blocking.rs +++ b/embassy-embedded-hal/src/flash/partition/blocking.rs | |||
| @@ -19,6 +19,16 @@ pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> { | |||
| 19 | size: u32, | 19 | size: u32, |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | impl<'a, M: RawMutex, T: NorFlash> Clone for BlockingPartition<'a, M, T> { | ||
| 23 | fn clone(&self) -> Self { | ||
| 24 | Self { | ||
| 25 | flash: self.flash, | ||
| 26 | offset: self.offset, | ||
| 27 | size: self.size, | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 22 | impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> { | 32 | impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> { |
| 23 | /// Create a new partition | 33 | /// Create a new partition |
| 24 | pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self { | 34 | pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self { |
