pub struct War3MapMetadata {
pub header: War3MapHeader,
pub map_info: Option<War3MapW3i>,
pub imp: Option<War3MapImp>,
pub wts: Option<War3MapWts>,
pub images: Vec<War3Image>,
pub minimap_icons: Option<War3MapMmp>,
pub files: Option<Vec<String>>,
pub modification: Option<ModInfo>,
}Expand description
Rich in-memory parse result.
Holds non-serializable assets such as War3Image rasters. Convert to
MapSnapshot for CLI dumps, JSON, or WASM.
Fields§
§header: War3MapHeader§map_info: Option<War3MapW3i>§imp: Option<War3MapImp>§wts: Option<War3MapWts>§images: Vec<War3Image>§minimap_icons: Option<War3MapMmp>Minimap icons from war3map.mmp (gold mines, houses, starts).
files: Option<Vec<String>>§modification: Option<ModInfo>Third-party modification detected in the map script, if any.
Implementations§
Source§impl War3MapMetadata
impl War3MapMetadata
Sourcepub fn parse(buffer: &[u8]) -> Result<Self>
pub fn parse(buffer: &[u8]) -> Result<Self>
Parse a map buffer, reading every known member file.
Individual member files that are missing or corrupt simply come back
as None / empty — only an unreadable archive is an error.
§Example
ⓘ
use war3parser::prelude::War3MapMetadata;
let buffer = std::fs::read("path/to/map.w3x")?;
let mut metadata = War3MapMetadata::parse(&buffer)?;
metadata.resolve_trigger_strings();
let snapshot = metadata.snapshot()?;Sourcepub fn parse_snapshot(buffer: &[u8]) -> Result<MapSnapshot>
pub fn parse_snapshot(buffer: &[u8]) -> Result<MapSnapshot>
Parse a buffer and immediately produce a portable MapSnapshot,
with TRIGSTR references resolved when a string table is present.
Sourcepub fn resolve_trigger_strings(&mut self)
pub fn resolve_trigger_strings(&mut self)
Replace TRIGSTR_<id> references in the map info with their values
from the string table. No-op when either part is missing.
Sourcepub fn snapshot(&self) -> Result<MapSnapshot>
pub fn snapshot(&self) -> Result<MapSnapshot>
Build a portable snapshot from the rich in-memory metadata.
Auto Trait Implementations§
impl Freeze for War3MapMetadata
impl RefUnwindSafe for War3MapMetadata
impl Send for War3MapMetadata
impl Sync for War3MapMetadata
impl Unpin for War3MapMetadata
impl UnsafeUnpin for War3MapMetadata
impl UnwindSafe for War3MapMetadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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