Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal async-await foundations, updated #804

Merged
merged 3 commits into from Oct 27, 2021
Merged

Commits on Oct 27, 2021

  1. Bring TerminateInfo and InitializeInfo back to public

    The types are used as arguments to custom init/terminate callbacks, and aren't
    entirely internal.
    chitoyuu committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    afc16aa View commit details
    Browse the repository at this point in the history
  2. Minimal async-await foundations

    This sets the foundations for async-await support in godot-rust, based on the
    original idea in godot-rust#284. However, although the tests work, this is not a full
    implementation:
    
    - Async methods can only be registered manually using `build_method`. Macro
      syntax and implementation are out of the scope of this PR.
    - The runtime types aren't registered automatically yet.
      Users need to manually call `register_runtime` and `terminate_runtime`
      functions in their library lifecycle hooks. Improving this is out of the
      scope of this PR for now.
    - The crate is currently re-exported as `gdnative::asn`, instead of the much
      longer `async_yield`. The name is open to discussion -- I don't like it very
      much.
    - Only local spawners are supported, due to issues with thread safety. Users
      may off-load tasks that don't contain `yield`-likes to thread pool spawners
      using something like `futures::future::Remote`, however.
    - Panics in async methods don't currently behave very well. Their
      `FunctionState`-likes simply block forever and any outstanding bridge
      objects for futures can be leaked.
    toasteater authored and chitoyuu committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    ffe0248 View commit details
    Browse the repository at this point in the history
  3. Resolve concerns for the original PR

    - `set_executor` and `register_runtime` are changed to allow multiple
      calls, at the expense of slightly worse error messages when they aren't
      called as necessary.
    - Renamed the top-level re-export to `tasks` instead of `asn`.
    - Added documentation for previously undocumented public items.
    - Removed `async` from default features
    chitoyuu committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    82f928e View commit details
    Browse the repository at this point in the history