pub struct ChunkHeader {
pub chunk_type: ChunkType,
pub chunk_size: u32,
pub total_size: u32,
}
Expand description
Header of a chunk
Fields§
§chunk_type: ChunkType
The type of the chunk
chunk_size: u32
Output size of the chunk in blocksize
total_size: u32
Size of the chunk in the sparse image
Implementations§
Source§impl ChunkHeader
impl ChunkHeader
Sourcepub fn new_dontcare(blocks: u32) -> Self
pub fn new_dontcare(blocks: u32) -> Self
Create a don’t care header for a given length in blocks
Sourcepub fn new_raw(blocks: u32, block_size: u32) -> Self
pub fn new_raw(blocks: u32, block_size: u32) -> Self
Create a new raw header for a given amount in blocks for block_size
The actual data should follow this header
Sourcepub fn new_fill(blocks: u32) -> Self
pub fn new_fill(blocks: u32) -> Self
Create a new fill header for a given amount of blocks to be filled
The header should be followed by 4 bytes indicate the data to fill with
Sourcepub fn from_bytes(bytes: &ChunkHeaderBytes) -> Result<ChunkHeader, ParseError>
pub fn from_bytes(bytes: &ChunkHeaderBytes) -> Result<ChunkHeader, ParseError>
Create new ChunkHeader from a raw header
Sourcepub fn to_bytes(&self) -> ChunkHeaderBytes
pub fn to_bytes(&self) -> ChunkHeaderBytes
Convert into a raw header
Sourcepub fn out_size(&self, header: &FileHeader) -> usize
pub fn out_size(&self, header: &FileHeader) -> usize
Resulting size of this chunk in the output
Trait Implementations§
Source§impl Clone for ChunkHeader
impl Clone for ChunkHeader
Source§fn clone(&self) -> ChunkHeader
fn clone(&self) -> ChunkHeader
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 ChunkHeader
impl Debug for ChunkHeader
Source§impl PartialEq for ChunkHeader
impl PartialEq for ChunkHeader
impl Eq for ChunkHeader
impl StructuralPartialEq for ChunkHeader
Auto Trait Implementations§
impl Freeze for ChunkHeader
impl RefUnwindSafe for ChunkHeader
impl Send for ChunkHeader
impl Sync for ChunkHeader
impl Unpin for ChunkHeader
impl UnwindSafe for ChunkHeader
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