Skip to main content

warcraft3_stats_observer/
lib.rs

1//! Rust bindings for the Warcraft 3 Stats Observer API memory map.
2//!
3//! Provides safe access to the shared-memory block exported by the Warcraft III
4//! Stats Observer API. Use [`ObserverHandle`] as the entry point — it owns the
5//! Windows file-mapping handles and dereferences to [`ObserverData`].
6//!
7//! # Example
8//!
9//! ```no_run
10//! use warcraft3_stats_observer::ObserverHandle;
11//!
12//! let observer = ObserverHandle::new()
13//!     .expect("Warcraft III not running or stats observer not available");
14//!
15//! println!("refresh rate: {} ms", { observer.refresh_rate });
16//! ```
17//!
18//! # Packed structs
19//!
20//! All structs are `#[repr(C, packed)]` to mirror the layout of
21//! the underlying memory map. Reading a misaligned field by reference is
22//! undefined behaviour, so copy fields with `{}` before borrowing or
23//! formatting them:
24//!
25//! ```ignore
26//! println!("gold: {}", { player.gold });
27//! ```
28
29mod ability;
30pub use ability::*;
31mod build_queue;
32pub use build_queue::*;
33mod game;
34pub use game::*;
35mod hero;
36pub use hero::*;
37mod item;
38pub use item::*;
39mod observer;
40pub use observer::*;
41mod player;
42pub use player::*;
43mod player_item;
44pub use player_item::*;
45mod shop;
46pub use shop::*;
47mod shop_good;
48pub use shop_good::*;
49mod string_utils;
50pub use string_utils::*;
51mod structure;
52pub use structure::*;
53mod unit;
54pub use unit::*;
55mod upgrade;
56pub use upgrade::*;