aboutsummaryrefslogtreecommitdiff
path: root/embassy-boot/boot/src/partition.rs
diff options
context:
space:
mode:
authorRasmus Melchior Jacobsen <[email protected]>2023-04-05 08:28:31 +0200
committerRasmus Melchior Jacobsen <[email protected]>2023-04-05 08:28:31 +0200
commit2deb2c624c78f4ff582441d7d00a654ac3844e33 (patch)
tree159614af96d809bab75537400d91d2dda4224432 /embassy-boot/boot/src/partition.rs
parent064ec9581e33fdd42f89ff75984254ccfec3f6c2 (diff)
Let Partition range be u32 instead of usize
Diffstat (limited to 'embassy-boot/boot/src/partition.rs')
-rw-r--r--embassy-boot/boot/src/partition.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/embassy-boot/boot/src/partition.rs b/embassy-boot/boot/src/partition.rs
index ac6b0ed0f..7529059b6 100644
--- a/embassy-boot/boot/src/partition.rs
+++ b/embassy-boot/boot/src/partition.rs
@@ -6,20 +6,19 @@ use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash
6#[cfg_attr(feature = "defmt", derive(defmt::Format))] 6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7pub struct Partition { 7pub struct Partition {
8 /// The offset into the flash where the partition starts. 8 /// The offset into the flash where the partition starts.
9 pub from: usize, 9 pub from: u32,
10 /// The offset into the flash where the partition ends. 10 /// The offset into the flash where the partition ends.
11 pub to: usize, 11 pub to: u32,
12} 12}
13 13
14impl Partition { 14impl Partition {
15 /// Create a new partition with the provided range 15 /// Create a new partition with the provided range
16 pub const fn new(from: usize, to: usize) -> Self { 16 pub const fn new(from: u32, to: u32) -> Self {
17 Self { from, to } 17 Self { from, to }
18 } 18 }
19 19
20 /// Return the size of the partition 20 /// Return the size of the partition
21 #[allow(clippy::len_without_is_empty)] 21 pub const fn size(&self) -> u32 {
22 pub const fn len(&self) -> usize {
23 self.to - self.from 22 self.to - self.from
24 } 23 }
25 24