pub struct Header {Show 20 fields
pub magic: [u8; 2],
pub header_size: u16,
pub header_crc16: u16,
pub file_size: u32,
pub data_crc16: u16,
pub width: u16,
pub height: u16,
pub level_count: u8,
pub face_count: u8,
pub format: Format,
pub flags: u16,
pub reserved: u32,
pub userdata: [u32; 2],
pub color_endpoints: Palette,
pub color_selectors: Palette,
pub alpha_endpoints: Palette,
pub alpha_selectors: Palette,
pub table_size: u16,
pub table_offset: u32,
pub level_offset: Vec<u32>,
}
Fields§
§magic: [u8; 2]
§header_size: u16
§header_crc16: u16
§file_size: u32
§data_crc16: u16
§width: u16
§height: u16
§level_count: u8
§face_count: u8
§format: Format
§flags: u16
§reserved: u32
§userdata: [u32; 2]
§color_endpoints: Palette
§color_selectors: Palette
§alpha_endpoints: Palette
§alpha_selectors: Palette
§table_size: u16
§table_offset: u32
§level_offset: Vec<u32>
Implementations§
Source§impl Header
impl Header
pub fn parse(input: &[u8]) -> Result<Self, Error>
pub fn fixed_size() -> usize
pub fn crc16(init: u16, input: &[u8]) -> u16
pub fn crc16_poly(init: u16, poly: u16, input: &[u8]) -> u16
pub fn check_crc(&self, input: &[u8]) -> bool
pub fn block_size(&self) -> usize
pub fn get_level_data<'a>( &self, input: &'a [u8], idx: usize, ) -> Option<&'a [u8]>
pub fn get_table(&self, input: &[u8]) -> Result<Tables, Error>
pub fn get_color_endpoints( &self, input: &[u8], ) -> Result<Vec<(u16, u16)>, Error>
pub fn get_alpha_endpoints(&self, input: &[u8]) -> Result<Vec<(u8, u8)>, Error>
pub fn get_color_selectors(&self, input: &[u8]) -> Result<Vec<[u8; 4]>, Error>
pub fn get_alpha_selectors(&self, input: &[u8]) -> Result<Vec<[u8; 6]>, Error>
pub fn get_level_info(&self, idx: usize) -> Option<(u16, u16)>
pub fn unpack_level( &self, tables: &Tables, input: &[u8], idx: usize, ) -> Result<Vec<u8>, Error>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
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
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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> 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