Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows you to define an asynchronous `main` function instead of the poll based `update` function, which allows you to more easily keep state between individual ticks of the runtime. Unfortunately the most efficient implementation isn't possible yet on stable Rust, as we are blocked by the following two features: - [type_alias_impl_trait](rust-lang/rust#63063) - [const_async_blocks](rust-lang/rust#85368) For now we have to use a workaround that is less efficient by calling the `main` function at runtime and allocating it onto a new WebAssembly page. Here is a full example of how an auto splitter could look like using the `async_main` macro: Usage on stable Rust: ```rust async_main!(stable); ``` Usage on nightly Rust: ```rust async_main!(nightly); ``` The asynchronous main function itself: ```rust async fn main() { // TODO: Set up some general state and settings. loop { let process = Process::wait_attach("explorer.exe").await; process.until_closes(async { // TODO: Load some initial information from the process. loop { // TODO: Do something on every tick. next_tick().await; } }).await; } } ```
- Loading branch information