From 3aecdd48b2648ab8cf5bfd72cb86542fa41a49a3 Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Mon, 18 Dec 2023 15:22:33 -0700 Subject: [PATCH] more small stuff --- src/game.rs | 12 +++++++----- src/js_collections.rs | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/game.rs b/src/game.rs index e9bf8bfb..4be905bf 100644 --- a/src/game.rs +++ b/src/game.rs @@ -117,7 +117,7 @@ pub fn resources() -> JsHashMap { Game::resources().into() } -/// Get an [`JsHashMap`] with the rooms visible for the current +/// Get a [`JsHashMap`] with the rooms visible for the current /// tick. /// /// [Screeps documentation](https://docs.screeps.com/api/#Game.rooms) @@ -125,7 +125,7 @@ pub fn rooms() -> JsHashMap { Game::rooms().into() } -/// Get an [`JsHashMap`] with all of your spawns, which +/// Get a [`JsHashMap`] with all of your spawns, which /// has spawn names as keys. /// /// [Screeps documentation](https://docs.screeps.com/api/#Game.spawns) @@ -133,7 +133,7 @@ pub fn spawns() -> JsHashMap { Game::spawns().into() } -/// Get an [`JsHashMap`] with all of your owned +/// Get a [`JsHashMap`] with all of your owned /// structures. /// /// [Screeps documentation](https://docs.screeps.com/api/#Game.spawns) @@ -205,8 +205,10 @@ pub fn get_object_by_id_erased(id: &RawObjectId) -> Option { Game::get_object_by_id(&js_str) } -/// Send an email message to yourself with a given message. Set a group -/// interval to only send messages every `group_interval` minutes. +/// Send an email message to yourself with a given message. +/// +/// Set a `group_interval` with a limit, in minutes, on how frequently emails +/// are allowed to be sent. /// /// [Screeps documentation](https://docs.screeps.com/api/#Game.notify) pub fn notify(message: &str, group_interval: Option) { diff --git a/src/js_collections.rs b/src/js_collections.rs index 7e9ffca2..554335b4 100644 --- a/src/js_collections.rs +++ b/src/js_collections.rs @@ -35,6 +35,8 @@ pub trait JsCollectionFromValue { fn from_value(val: JsValue) -> Self; } +/// Container holding a reference to an [`Object`] in JavaScript as well as +/// expected types for both the keys and values. pub struct JsHashMap { map: Object, _phantom: PhantomData<(K, V)>,