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

Remove Async bounds in component traits and macros #20

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use syn::punctuated::Punctuated;
use syn::{parse_quote, Ident, ItemTrait, TraitItem};

use crate::derive_component::replace_self_receiver::replace_self_receiver;
Expand Down Expand Up @@ -42,7 +43,7 @@ pub fn derive_provider_trait(
&local_assoc_types,
)?;

provider_trait.supertraits = parse_quote!(Async);
provider_trait.supertraits = Punctuated::default();

if !context_constraints.is_empty() {
if let Some(where_clause) = &mut provider_trait.generics.where_clause {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn test_derive_component_with_const_generic() {

pub struct FooComponent;

pub trait FooProvider<Context, const BAR: usize>: Async {
pub trait FooProvider<Context, const BAR: usize> {
type Foo;

fn foo(context: &Context) -> Self::Foo;
Expand Down
4 changes: 1 addition & 3 deletions crates/cgp-component/src/traits/delegate_component.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use cgp_async::Async;

pub trait DelegateComponent<Name>: Async {
pub trait DelegateComponent<Name> {
type Delegate;
}
6 changes: 2 additions & 4 deletions crates/cgp-component/src/traits/has_components.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use cgp_async::Async;

pub trait HasComponents: Async {
type Components: Async;
pub trait HasComponents {
type Components;
}
1 change: 0 additions & 1 deletion crates/cgp-error/src/can_raise_error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use cgp_async::Async;
use cgp_component::{derive_component, DelegateComponent, HasComponents};

use crate::has_error_type::HasErrorType;
Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-error/src/has_error_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use cgp_component::{derive_component, DelegateComponent, HasComponents};
`Self::Error` type.
*/
#[derive_component(ErrorTypeComponent, ProvideErrorType<Context>)]
pub trait HasErrorType: Async {
pub trait HasErrorType {
/**
The `Error` associated type is also required to implement [`Debug`].

Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-run/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ use cgp_error::HasErrorType;

#[derive_component(RunnerComponent, Runner<Context>)]
#[async_trait]
pub trait CanRun: HasErrorType {
pub trait CanRun: Async + HasErrorType {
async fn run(&self) -> Result<(), Self::Error>;
}
Loading