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

Support async-generic feature flags in cgp-async #37

Merged
merged 5 commits into from
Dec 7, 2024

Conversation

soareschen
Copy link
Collaborator

@soareschen soareschen commented Dec 7, 2024

  • Introduce the following feature flags to cgp-async:
    • async
    • send
    • sync
    • static
    • full - default feature with all enabled
  • Introduce the following traits in cgp-async:
    • MaybeSend - alias to Send when the send feature is enabled, otherwise nothing.
    • MaybeSync - alias to Sync when the sync feature is enabled, otherwise nothing.
    • MaybeStatic - alias to 'static when the static feature is enabled, otherwise nothing.
  • Update the Async trait from Sized + Send + Sync + 'static to MaybeSend + MaybeSync + MaybeStatic.
    • The Sized constraint is removed from Async to allow use inside dyn traits.
  • Update the #[async_trait] macro to desugar async functions to return impl Future<Output: MaybeSend>.
    • Use of #[async_trait] now requires import of cgp::prelude::* to allow MaybeSend to be auto imported.
  • cgp-async now re-exports cgp_sync::strip_async if the async feature is not enabled.
    • i.e. async functions are desugared into sync functions if the async feature is disabled.
  • Crates such as cgp and cgp-core offers the full feature, which can be disabled to disable the indirect default features in cgp-async.

@soareschen soareschen merged commit 106990f into main Dec 7, 2024
5 checks passed
@soareschen soareschen deleted the async-feature-flags branch December 7, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant