Struct Parser

Source
pub struct Parser<'a, Reader: Seek + Read> { /* private fields */ }
Expand description

WAD parser. Wraps a mutable reference to a Read + Seek cursor to provide random read access.

Implementations§

Source§

impl<'a, Reader: Seek + Read> Parser<'a, Reader>

Source

pub fn new(cursor: &'a mut Reader) -> BinParseResult<(Self, Vec<String>)>

Constructs a new wad parser starting at the provided cursor. May produce a list of warnings for duplicate entriess (entries sharing the same name).

Source

pub fn directory(&self) -> HashMap<String, Entry>

Clones WAD entries into a hash map. Entries are used to access lumps within the WAD.

Source

pub fn parse_mip_texture(&mut self, entry: &Entry) -> BinParseResult<MipTexture>

Attempts to parse a mip-mapped texture at the offset provided by the entry

Source

pub fn parse_image(&mut self, entry: &Entry) -> BinParseResult<Image>

Attempts to parse a 2D at the offset provided by the entry

Source

pub fn parse_palette(&mut self, entry: &Entry) -> BinParseResult<Box<Palette>>

Attempts to parse a 768 byte palette at the offset provided by the entry

Source

pub fn read_raw(&mut self, entry: &Entry) -> BinParseResult<Box<[u8]>>

Attempts to read a number of bytes using the provided entry’s length and offset

Source

pub fn parse_inferred(&mut self, entry: &Entry) -> BinParseResult<Lump>

Attempts to read a lump based on the provided entry’s name and lump kind. All known kinds of lump are attempted based on the entry. E.g. there is a special case where Quake’s gfx.wad has a flat lump named CONCHARS which is erroneously tagged as miptex.

Trait Implementations§

Source§

impl<'a, Reader: Debug + Seek + Read> Debug for Parser<'a, Reader>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, Reader> Freeze for Parser<'a, Reader>

§

impl<'a, Reader> RefUnwindSafe for Parser<'a, Reader>
where Reader: RefUnwindSafe,

§

impl<'a, Reader> Send for Parser<'a, Reader>
where Reader: Send,

§

impl<'a, Reader> Sync for Parser<'a, Reader>
where Reader: Sync,

§

impl<'a, Reader> Unpin for Parser<'a, Reader>

§

impl<'a, Reader> !UnwindSafe for Parser<'a, Reader>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.