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

Allow nested delegation of components #27

Open
soareschen opened this issue Dec 1, 2024 · 0 comments
Open

Allow nested delegation of components #27

soareschen opened this issue Dec 1, 2024 · 0 comments
Milestone

Comments

@soareschen
Copy link
Collaborator

Summary

With trait-generic providers like UseDelegate, it is common to have nested delegation of components. However, the current design of delegate_components! require the nested components to be defined with separate struct definitions and delegation.

New Syntax

The new delegate_components! macro would support nested delegation with the following syntax:

pub struct FooComponents;

delegate_components! {
  FooComponents {
    FooOneComponent: FooOneImpl,
    FooTwoComponent: UseDelegate<BarComponents {
      BarOneComponent: BarOneImpl,
      BarTwoComponent: BarTwoImpl,
    }>,
  }
}

Which would roughly expanded into the current syntax:

pub struct FooComponents;
pub struct BarComponents;


delegate_components! {
  FooComponents {
    FooOneComponent: FooOneImpl,
    FooTwoComponent: UseDelegate<BarComponents>,
  }
}

delegate_components! {
  BarComponents {
    BarOneComponent: BarOneImpl,
    BarTwoComponent: BarTwoImpl,
  }
}
@soareschen soareschen added this to the v1.0 Release milestone Dec 1, 2024
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

No branches or pull requests

1 participant