Skip to main content

PartitionEntry

Struct PartitionEntry 

Source
pub struct PartitionEntry { /* private fields */ }
Expand description

Represents a single partition entry.

Implementations§

Source§

impl PartitionEntry

Source

pub fn magic(&self) -> u16

The magic value of the entry.

Source

pub fn raw_type(&self) -> u8

The partition type in raw representation.

Source

pub fn raw_subtype(&self) -> u8

The partition sub-type in raw representation.

Source

pub fn offset(&self) -> u32

Offset of the partition on flash.

Source

pub fn len(&self) -> u32

Length of the partition in bytes.

Source

pub fn is_empty(&self) -> bool

Checks for a zero-length partition.

Source

pub fn label(&self) -> &[u8]

The label of the partition.

Source

pub fn label_as_str(&self) -> &str

The label of the partition as &str.

Source

pub fn flags(&self) -> u32

Raw flags of this partition. You probably want to use Self::is_read_only and Self::is_encrypted instead.

Source

pub fn is_read_only(&self) -> bool

If the partition is read only.

Source

pub fn is_encrypted(&self) -> bool

If the partition is encrypted.

This is the flag from the partition table. If flash encryption is enabled certain partition types are encrypted regardless of this.

Source

pub fn partition_type(&self) -> PartitionType

The partition type (type and sub-type).

Source

pub fn as_flash_region<'a, 'd>( self, flash: &'a mut FlashStorage<'d>, ) -> FlashRegion<'a, 'd>

Provides a “view” into the partition allowing to read/write the partition contents using the given FlashStorage.

Source

pub fn sha256(&self, flash: &mut FlashStorage<'_>) -> Result<[u8; 32], Error>

Calculate the SHA-256 digest of this partition.

  • App / bootloader with appended hash: return that digest after verifying it
  • App / bootloader without appended hash: hash the image (not the whole partition)
  • Other types: hash the entire partition

For app images this is the validation hash (shown by esptool.py image-info), not the ELF file SHA-256 stored in crate::EspAppDesc.

Trait Implementations§

Source§

impl Clone for PartitionEntry

Source§

fn clone(&self) -> PartitionEntry

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PartitionEntry

Source§

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

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

impl Format for PartitionEntry

Available on crate feature defmt only.
Source§

fn format(&self, fmt: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl Copy for PartitionEntry

Auto Trait Implementations§

§

impl Freeze for PartitionEntry

§

impl RefUnwindSafe for PartitionEntry

§

impl Send for PartitionEntry

§

impl Sync for PartitionEntry

§

impl Unpin for PartitionEntry

§

impl UnsafeUnpin for PartitionEntry

§

impl UnwindSafe for PartitionEntry

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.