Skip to content

Introduce IsProviderFor trait to help improve compile errors#63

Merged
soareschen merged 23 commits intomainfrom
provider-check
Feb 7, 2025
Merged

Introduce IsProviderFor trait to help improve compile errors#63
soareschen merged 23 commits intomainfrom
provider-check

Conversation

@soareschen
Copy link
Collaborator

@soareschen soareschen commented Feb 2, 2025

  • Introduce IsProviderFor<ComponentName, Context, Params> trait to serve as a way to capture constraints of provider implementations.
  • Introduce CanUseComponent<ComponentName, Params> as an alias to check for the implementation of IsProviderFor on a context.
  • Introduce #[cgp_provider(ComponentName)] macro to automatically implement IsProviderFor using the constraints specified in the impl block of a provider.
  • Update delegate_components macro to also implement IsProviderFor for each implementation of DelegateComponent.
  • Introduce a provider-supertrait feature flag on cgp-component-macro to add IsProviderFor as a supertrait of a provider trait. This will be enabled by default once all existing CGP code has been migrated to use #[cgp_provider].

@soareschen soareschen marked this pull request as draft February 2, 2025 20:10
@soareschen soareschen marked this pull request as ready for review February 7, 2025 21:49
@soareschen soareschen merged commit 7db0522 into main Feb 7, 2025
5 checks passed
@soareschen soareschen deleted the provider-check branch February 7, 2025 21:49
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