Struct esp_partition_table::PartitionEntry
source · pub struct PartitionEntry {
pub type_: PartitionType,
pub offset: u32,
pub size: usize,
pub encrypted: bool,
/* private fields */
}Expand description
ESP Partition info
Binary representation:
| Off | Len | Desc |
|---|---|---|
| 0 | 2 | Magic |
| 2 | 1 | Type |
| 3 | 1 | SubType |
| 4 | 4 | Offset |
| 8 | 4 | Size |
| 12 | 16 | Name |
| 28 | 4 | Flags |
Fields§
§type_: PartitionTypePartition type and subtype
offset: u32Partition offset
size: usizePartition size
encrypted: boolPartition encrypted flag
Implementations§
source§impl PartitionEntry
impl PartitionEntry
sourcepub const MAX_NAME_LEN: usize = 16usize
pub const MAX_NAME_LEN: usize = 16usize
Max partition name length
sourcepub fn new(
type_: impl Into<PartitionType>,
offset: u32,
size: usize,
name: impl AsRef<str>,
encrypted: bool
) -> Result<Self, PartitionError>
pub fn new( type_: impl Into<PartitionType>, offset: u32, size: usize, name: impl AsRef<str>, encrypted: bool ) -> Result<Self, PartitionError>
Create partition info
sourcepub fn set_offset(&mut self, offset: u32) -> Result<(), PartitionError>
pub fn set_offset(&mut self, offset: u32) -> Result<(), PartitionError>
Set partition offset with alignment check
sourcepub fn set_name(&mut self, name: impl AsRef<str>) -> Result<(), PartitionError>
pub fn set_name(&mut self, name: impl AsRef<str>) -> Result<(), PartitionError>
Set partition name
sourcepub fn from_bytes(data: &PartitionBuffer) -> Result<Self, PartitionError>
pub fn from_bytes(data: &PartitionBuffer) -> Result<Self, PartitionError>
Convert partition data from binary representation
sourcepub fn to_bytes(&self, data: &mut PartitionBuffer) -> Result<(), PartitionError>
pub fn to_bytes(&self, data: &mut PartitionBuffer) -> Result<(), PartitionError>
Convert partition data to binary representation
Trait Implementations§
source§impl AsRef<PartitionEntry> for PartitionEntry
impl AsRef<PartitionEntry> for PartitionEntry
source§impl Clone for PartitionEntry
impl Clone for PartitionEntry
source§fn clone(&self) -> PartitionEntry
fn clone(&self) -> PartitionEntry
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for PartitionEntry
impl Debug for PartitionEntry
source§impl Default for PartitionEntry
impl Default for PartitionEntry
source§fn default() -> PartitionEntry
fn default() -> PartitionEntry
Returns the “default value” for a type. Read more
source§impl TryFrom<&[u8]> for PartitionEntry
impl TryFrom<&[u8]> for PartitionEntry
source§impl TryFrom<&[u8; 32]> for PartitionEntry
impl TryFrom<&[u8; 32]> for PartitionEntry
§type Error = PartitionError
type Error = PartitionError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl RefUnwindSafe for PartitionEntry
impl Send for PartitionEntry
impl Sync for PartitionEntry
impl Unpin for PartitionEntry
impl UnwindSafe for PartitionEntry
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
Mutably borrows from an owned value. Read more