Skip to main content

Crate warcraft3_stats_observer

Crate warcraft3_stats_observer 

Source
Expand description

Rust bindings for the Warcraft 3 Stats Observer API memory map.

Provides safe access to the shared-memory block exported by the Warcraft III Stats Observer API. Use ObserverHandle as the entry point — it owns the Windows file-mapping handles and dereferences to ObserverData.

§Example

use warcraft3_stats_observer::ObserverHandle;

let observer = ObserverHandle::new()
    .expect("Warcraft III not running or stats observer not available");

println!("refresh rate: {} ms", { observer.refresh_rate });

§Packed structs

All structs are #[repr(C, packed)] to mirror the layout of the underlying memory map. Reading a misaligned field by reference is undefined behaviour, so copy fields with {} before borrowing or formatting them:

println!("gold: {}", { player.gold });

Structs§

AbilityInfo
State for a single hero ability slot.
BuildQueueInfo
State for a single entry in a player’s build queue.
HeroInfo
State for a single hero owned by a player.
ItemInfo
State for a single item held in a hero’s inventory.
ObserverData
Top-level layout of the Warcraft III Stats Observer shared memory map.
ObserverGame
Game-wide state exposed by the Warcraft III Stats Observer API.
ObserverHandle
Owns the Windows handles from OpenFileMappingW and MapViewOfFile.
PaddedString
Fixed-size, optionally NULL-terminated UTF-8 string read from the observer memory map.
PlayerInfo
Per-player state — name, race, resources, and arrays of heroes, structures, units, upgrades, items, and build queue entries.
PlayerItemInfo
Aggregate per-player statistics for a specific item type.
ShopGoodInfo
State for a single item offered for sale at a shop.
ShopInfo
State for a single shop available on the map.
StructureInfo
State for a single structure owned by a player.
UnitInfo
Aggregate state for one unit kind owned by a player.
UpgradeInfo
State for a single upgrade or research entry available to a player.

Enums§

AiDifficultyPreference
Difficulty preference selected for a computer player.
BuildQueueType
What kind of work a build queue entry represents.
PlayerGameResult
End-of-game result for a player.
PlayerRace
Race a player is actually playing.
PlayerSlotState
Live state of a player slot.
PlayerType
What occupies a player slot.
RacePreference
Race chosen by the player in the lobby. Bit-flag encoded.

Constants§

MAX_GOODS
Maximum number of goods sold by a single shop.
MAX_HEROES
Maximum number of heroes per player tracked by the observer API.
MAX_ITEMS
Maximum number of distinct items collected per player.
MAX_PLAYERS
Maximum number of player slots tracked by the observer API.
MAX_SHOPS
Maximum number of shops tracked by the observer API.
MAX_STRUCTURES
Maximum number of structures per player tracked by the observer API.
MAX_UNITS
Maximum number of unit kinds per player tracked by the observer API.
MAX_UNITS_IN_QUEUE
Maximum number of in-progress build queue entries per player.
MAX_UPGRADES
Maximum number of upgrades per player tracked by the observer API.
MAX_UPKEEP_LEVELS
Number of upkeep levels reported by the observer API.