1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
//! Typed bindings to the Screeps in-game API for WASM Rust AIs. //! //! # Cargo Features //! //! ## `check-all-casts` //! //! By default, `screeps-game-api` assumes that the Screeps JavaScript API calls //! return the types that they are documented to return and bypasses //! `instanceof` checks when constructing rust wrappers for those return values. //! //! To enable checking all types on all API calls, even ones when the screeps //! server reliably returns the expected type, depend on `screeps-game-api` with //! the `"check-all-casts"` feature flag: //! //! ```toml //! [dependencies] //! # ... //! screeps-game-api = { version = "0.3", features = ["check-all-casts"] } //! ``` #![recursion_limit = "128"] #[macro_use] pub mod macros; pub mod constants; pub mod game; pub mod inter_shard_memory; pub mod js_collections; pub mod local; pub mod memory; pub mod objects; pub mod pathfinder; pub mod raw_memory; pub mod traits; pub use stdweb::private::ConversionError; pub use crate::{ constants::*, js_collections::JsVec, local::{Position, RoomName, RoomNameParseError}, objects::*, traits::{FromExpectedType, IntoExpectedType}, }; /// An alias for `Position` for those used to the JavaScript `RoomPosition` /// type. pub type RoomPosition = Position; /// Traits which implement base functionalities for Screeps types. /// /// # Example /// /// ```no_run /// use screeps::prelude::*; /// /// let c = screeps::game::creeps::get("Bob").unwrap(); /// /// // `HasId` trait brought in from prelude /// let id = c.id(); /// ``` /// /// This module contains all base functionality traits, and no structures. pub mod prelude { pub use crate::objects::{ CanDecay, CanStoreEnergy, HasCooldown, HasId, HasPosition, HasStore, OwnedStructureProperties, RoomObjectProperties, StructureProperties, }; }