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_: PartitionType
Partition type and subtype
offset: u32
Partition offset
size: usize
Partition size
encrypted: bool
Partition 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 PartialEq for PartitionEntry
impl PartialEq for PartitionEntry
Source§impl TryFrom<&[u8]> for PartitionEntry
impl TryFrom<&[u8]> for PartitionEntry
Source§impl TryFrom<&[u8; 32]> for PartitionEntry
impl TryFrom<&[u8; 32]> for PartitionEntry
Source§type Error = PartitionError
type Error = PartitionError
The type returned in the event of a conversion error.
impl Eq for PartitionEntry
impl StructuralPartialEq 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 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