pub struct PebHeader {
pub magic: [u8; 4],
pub erase_count: u32,
pub status: PebStatus,
pub peb_reserved: u8,
pub version: u8,
pub reserved: u8,
}Expand description
PEB header.
This struct represents the on-flash header of a Physical Erase Block (PEB). It stores metadata required for flash management, wear leveling, and recovery logic.
The layout maps directly to struct peb_header_t in the original C
implementation and must not be altered.
Fields§
§magic: [u8; 4]Magic value identifying a valid PEB header. (NVDM)
This field is used to validate that the flash block contains a properly initialized PEB header.
erase_count: u32Erase count of the PEB.
This value tracks how many times the block has been erased and is typically used for wear-leveling decisions.
status: PebStatusCurrent status of the PEB.
This field encodes the lifecycle state of the PEB, such as virgin, active, transferring, or reclaiming.
peb_reserved: u8Reserved byte specific to PEB metadata.
This field is reserved for future use and should be preserved as-is to maintain binary compatibility.
version: u8Version of the PEB header format.
This field allows future extensions of the PEB header layout.
reserved: u8Reserved field.
This field is reserved and should be written as zero.
Trait Implementations§
Source§impl BinarySize for PebHeader
impl BinarySize for PebHeader
Source§fn binary_size() -> usize
fn binary_size() -> usize
Returns the binary size of the PebHeader in bytes.
Layout:
- Fixed-size
- Total: 12 bytes
Source§impl FromStream for PebHeader
impl FromStream for PebHeader
Auto Trait Implementations§
impl Freeze for PebHeader
impl RefUnwindSafe for PebHeader
impl Send for PebHeader
impl Sync for PebHeader
impl Unpin for PebHeader
impl UnwindSafe for PebHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more