Skip to main content

EspWlPartition

Struct EspWlPartition 

Source
pub struct EspWlPartition<T> { /* private fields */ }
Expand description

Represents a partition wrapped with the ESP-IDF Wear-Leveling algorithm

Implementations§

Source§

impl<T> EspWlPartition<T>
where T: BorrowMut<EspPartition>,

Source

pub fn new(partition: T) -> Result<Self, EspError>

Wrap the provided raw partition with the ESP-IDF Wear-Leveling algorithm

Return an error if the wrap operation failed, or the WL partition if the operation succeeded.

Arguments:

  • partition: The partition to mount
Source

pub fn size(&self) -> usize

Return the size of the mounted WL partition

Source

pub fn sector_size(&self) -> usize

Return the size of a sector in the mounted WL partition

Source

pub fn read(&mut self, offset: usize, buf: &mut [u8]) -> Result<(), EspError>

Read data from the mounted WL partition

§Arguments
  • offset: The offset in the partition to read from, in bytes
  • buf: The buffer to read the data into

Return an error if the read operation failed. The read operation would fail if the offset and buffer length are beyond the partition bounds.

The read operation will also fail if the offset and the buffer length are not aligned with the partition read alignment.

Source

pub fn write(&mut self, offset: usize, data: &[u8]) -> Result<(), EspError>

Write data to the mounted WL partition

§Arguments
  • offset: The offset in the partition to write to, in bytes
  • data: The data to write to the partition

Return an error if the write operation failed. The write operation would fail if the offset and data length are beyond the partition bounds.

The write operation will also fail if the offset and the data length are not aligned with the partition write alignment.

Source

pub fn erase(&mut self, offset: usize, size: usize) -> Result<(), EspError>

Erase a region of the mounted WL partition

§Arguments
  • offset: The offset in the partition to start erasing from, in bytes
  • size: The size of the region to erase, in bytes

Return an error if the erase operation failed. The erase operation would fail if the offset and size are beyond the partition bounds.

Trait Implementations§

Source§

impl<T> Drop for EspWlPartition<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T> RawHandle for EspWlPartition<T>

Source§

type Handle = i32

Source§

fn handle(&self) -> Self::Handle

Care should be taken to use the returned ESP-IDF driver raw handle only while the driver is still alive, so as to avoid use-after-free errors.
Source§

impl<T> Send for EspWlPartition<T>
where T: Send,

Auto Trait Implementations§

§

impl<T> Freeze for EspWlPartition<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for EspWlPartition<T>
where T: RefUnwindSafe,

§

impl<T> Sync for EspWlPartition<T>
where T: Sync,

§

impl<T> Unpin for EspWlPartition<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for EspWlPartition<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for EspWlPartition<T>
where T: UnwindSafe,

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> 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.

§

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

§

type Error = !

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

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

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.