Skip to main content

PartitionTable

Struct PartitionTable 

Source
pub struct PartitionTable {
    pub addr: u32,
    pub size: usize,
}
Expand description

Partition table info

Fields§

§addr: u32

Address of table

§size: usize

Size of table

Implementations§

Source§

impl PartitionTable

Source

pub const DEFAULT_ADDR: u32 = 0x8000

Address of partition table

Source

pub const MAX_SIZE: usize = 0x1000

Maximum size of partition table

Source

pub const MAX_ENTRIES: usize

Maxumum number of partition entries

Source§

impl PartitionTable

Source

pub fn new(addr: u32, size: usize) -> Self

Instantiate partition table with specified address and size

Source

pub fn max_entries(&self) -> usize

Get maximum number of entries

Source§

impl PartitionTable

Source

pub fn iter_storage<'s, S>( &self, storage: &'s mut S, calc_md5: bool, ) -> PartitionStorageIter<'s, S>
where S: ReadStorage,

Get iterator over partitions from table

If md5 feature isn’t enabled calc_md5 argument will be ignored.

Source

pub fn read_storage<S, T>( &self, storage: &mut S, check_md5: Option<bool>, ) -> Result<T, StorageOpError<S>>

Read partitions from table

The check_md5 argument means following:

  • None - ignore MD5 checksum
  • Some(false) - check MD5 when found (optional MD5)
  • Some(true) - MD5 checksum is mandatory

If md5 feature isn’t enabled check_md5 argument will be ignored.

Source

pub fn write_storage<S>( &self, storage: &mut S, partitions: impl IntoIterator<Item = impl AsRef<PartitionEntry>>, write_md5: bool, ) -> Result<usize, StorageOpError<S>>
where S: Storage,

Write partitions into table

If md5 feature isn’t enabled write_md5 argument will be ignored.

Source§

impl PartitionTable

Source

pub fn iter_nor_flash<'s, S>( &self, storage: &'s mut S, calc_md5: bool, ) -> PartitionNorFlashIter<'s, S>
where S: ReadNorFlash,

Get iterator over partitions from table

If md5 feature isn’t enabled calc_md5 argument will be ignored.

Source

pub fn read_nor_flash<S, T>( &self, storage: &mut S, check_md5: Option<bool>, ) -> Result<T, NorFlashOpError<S>>

Read partitions from table

The check_md5 argument means following:

  • None - ignore MD5 checksum
  • Some(false) - check MD5 when found (optional MD5)
  • Some(true) - MD5 checksum is mandatory

If md5 feature isn’t enabled check_md5 argument will be ignored.

Source

pub fn write_nor_flash<S>( &self, storage: &mut S, partitions: impl IntoIterator<Item = impl AsRef<PartitionEntry>>, write_md5: bool, ) -> Result<usize, NorFlashOpError<S>>
where S: NorFlash,

Write partitions into table

If md5 feature isn’t enabled write_md5 argument will be ignored.

Trait Implementations§

Source§

impl Clone for PartitionTable

Source§

fn clone(&self) -> PartitionTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PartitionTable

Source§

impl Debug for PartitionTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PartitionTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for PartitionTable

Source§

impl PartialEq for PartitionTable

Source§

fn eq(&self, other: &PartitionTable) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PartitionTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.