pub struct SectorHeader {
pub archive_id: u32,
pub chunk: usize,
pub next: usize,
pub index_id: u8,
}
Expand description
A section header containing validation and its next sector.
Fields§
§archive_id: u32
§chunk: usize
§next: usize
§index_id: u8
Implementations§
Source§impl<'a> SectorHeader
impl<'a> SectorHeader
Sourcepub fn new(
buffer: &'a [u8],
header_size: &SectorHeaderSize,
) -> Result<(&'a [u8], Self), Error>
pub fn new( buffer: &'a [u8], header_size: &SectorHeaderSize, ) -> Result<(&'a [u8], Self), Error>
Constructs a sector header from the given buffer.
Each sector is guaranteed to have a length of 520 bytes. The header size
will be either 8 or 10 bytes, making the data size either 512 or 510 bytes
respectively. Only when the archive id exceeds u16::MAX
will the header size
be expanded (meaning a 10 byte header).
§Errors
The header buffer needs to be exactly SectorHeaderSize
, otherwise you will
get a parser error.
pub const fn validate( &self, archive_id: u32, chunk: usize, index_id: u8, ) -> Result<(), ReadError>
Trait Implementations§
Source§impl Clone for SectorHeader
impl Clone for SectorHeader
Source§fn clone(&self) -> SectorHeader
fn clone(&self) -> SectorHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SectorHeader
impl Debug for SectorHeader
Source§impl Default for SectorHeader
impl Default for SectorHeader
Source§fn default() -> SectorHeader
fn default() -> SectorHeader
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SectorHeader
impl<'de> Deserialize<'de> for SectorHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for SectorHeader
impl Hash for SectorHeader
Source§impl Ord for SectorHeader
impl Ord for SectorHeader
Source§fn cmp(&self, other: &SectorHeader) -> Ordering
fn cmp(&self, other: &SectorHeader) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SectorHeader
impl PartialEq for SectorHeader
Source§impl PartialOrd for SectorHeader
impl PartialOrd for SectorHeader
Source§impl Serialize for SectorHeader
impl Serialize for SectorHeader
impl Eq for SectorHeader
impl StructuralPartialEq for SectorHeader
Auto Trait Implementations§
impl Freeze for SectorHeader
impl RefUnwindSafe for SectorHeader
impl Send for SectorHeader
impl Sync for SectorHeader
impl Unpin for SectorHeader
impl UnwindSafe for SectorHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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