pub struct DataItemHeader {
pub status: DataItemStatus,
pub pnum: u8,
pub reserved: u16,
pub offset: u16,
pub group_name_size: u8,
pub data_item_name_size: u8,
pub value_size: u16,
pub index: u8,
pub item_type: NvdmDataItemType,
pub sequence_number: u32,
pub hash_name: u32,
}Expand description
Data item header.
This struct represents the on-flash header for an NVDM data item. It contains metadata describing the state, identity, size, and storage layout of the data item.
The layout and field meanings map directly to struct data_item_header_t
in the original C implementation and are used by the NVDM storage
and recovery logic.
Fields§
§status: DataItemStatusStatus of the data item.
This field encodes the lifecycle state of the data item, such as whether it is valid, being written, deleted, or empty.
pnum: u8Physical block number where the data item is stored.
This value typically identifies the PEB or page index associated with the data item.
reserved: u16Reserved field.
This field is reserved for future use and should be ignored. It is preserved to maintain binary compatibility with the on-flash data layout.
offset: u16Offset to the data item value.
This field specifies the byte offset from the start of the data item header to the actual value data.
group_name_size: u8Size of the group name, in bytes.
This value indicates the length of the group name associated with the data item.
data_item_name_size: u8Size of the data item name, in bytes.
This value indicates the length of the data item name associated with the data item.
value_size: u16Size of the data item value, in bytes.
This field specifies the length of the stored value data.
index: u8Index of the data item.
This field is typically used to distinguish between multiple instances of data items with the same name.
item_type: NvdmDataItemTypeType of the data item value.
This field specifies how the value data should be interpreted, such as raw binary data or string data.
sequence_number: u32Sequence number of the data item.
This monotonically increasing value is used to determine the most recent version of a data item during recovery or scanning.
hash_name: u32Hash of the data item name.
This field stores a hash value derived from the group name and data item name, enabling faster lookups during NVDM operations.
Trait Implementations§
Source§impl BinarySize for DataItemHeader
impl BinarySize for DataItemHeader
Source§fn binary_size() -> usize
fn binary_size() -> usize
Returns the binary size of the DataItemHeader in bytes.
Layout size:
- Fixed-size, packed
- Total: 20 bytes
Source§impl Debug for DataItemHeader
impl Debug for DataItemHeader
Source§impl Default for DataItemHeader
impl Default for DataItemHeader
Source§fn default() -> Self
fn default() -> Self
Creates a default DataItemHeader instance with safe invalid values.
Default semantics:
status:DataItemStatus::Empty(unused slot)pnum:0xFF(invalid physical block number)reserved:0offset:0group_name_size:0data_item_name_size:0value_size:0index:0item_type:NvdmDataItemType::RawDatasequence_number:0hash_name:0
Source§impl FromStream for DataItemHeader
impl FromStream for DataItemHeader
Source§impl ToStream for DataItemHeader
impl ToStream for DataItemHeader
Auto Trait Implementations§
impl Freeze for DataItemHeader
impl RefUnwindSafe for DataItemHeader
impl Send for DataItemHeader
impl Sync for DataItemHeader
impl Unpin for DataItemHeader
impl UnwindSafe for DataItemHeader
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