pub struct Sector<'a> {
pub header: SectorHeader,
pub data_block: &'a [u8],
}
Expand description
A section of data read from the Dat2
file.
Fields§
§header: SectorHeader
§data_block: &'a [u8]
Implementations§
Source§impl<'a> Sector<'a>
impl<'a> Sector<'a>
Sourcepub fn new(
buffer: &'a [u8],
header_size: &SectorHeaderSize,
) -> Result<Self, Error>
pub fn new( buffer: &'a [u8], header_size: &SectorHeaderSize, ) -> Result<Self, Error>
Creates a sector from the given buffer using the header size to correctly initiate the root sector.
§Errors
Either a SectorHeader
couldn’t be initiated due to a wrong buffer or
there are no more bytes after the initial header.
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for Sector<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Sector<'a>
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<'a> Ord for Sector<'a>
impl<'a> Ord for Sector<'a>
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<'a> PartialOrd for Sector<'a>
impl<'a> PartialOrd for Sector<'a>
impl<'a> Eq for Sector<'a>
impl<'a> StructuralPartialEq for Sector<'a>
Auto Trait Implementations§
impl<'a> Freeze for Sector<'a>
impl<'a> RefUnwindSafe for Sector<'a>
impl<'a> Send for Sector<'a>
impl<'a> Sync for Sector<'a>
impl<'a> Unpin for Sector<'a>
impl<'a> UnwindSafe for Sector<'a>
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