Crate screeps_async

source ·
Expand description

A tick-aware async runtime for Screeps

§Getting Started

Add screeps-async to your Cargo.toml

[dependencies]
screeps-async = "0.3.0"

§The #[screeps_async::main] macro

#[screeps_async::main]
pub fn game_loop() {
    // Tick logic that spawns some tasks
    screeps_async::spawn(async {
        println!("Hello!");
    });
}

This expands to roughly the following:

pub fn game_loop() {
    // Tick logic that spawns some tasks
    screeps_async::spawn(async {
        println!("Hello!");
    });

    screeps_async::run().unwrap();
}

Re-exports§

Modules§

  • Errors emitted by screeps-async
  • Macros to make common workflows easier
  • The Screeps Async runtime
  • Synchronization primitives for async contexts
  • Utilities for tracking time

Macros§

  • Run a block of code each tick, resolving the specified list of dependencies by calling .resolve each tick and exiting if any dependency can’t be resolved.

Constants§

Functions§

  • The main entrypoint for the async runtime. Runs a future to completion.
  • Configures the runtime with default settings. Must be called only once
  • Run the task executor for one tick
  • Spawn a new async task
  • Acquire a reference to the ScreepsRuntime.