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

System Setup #34

Closed
leudz opened this issue Jan 9, 2020 · 0 comments
Closed

System Setup #34

leudz opened this issue Jan 9, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@leudz
Copy link
Owner

leudz commented Jan 9, 2020

This function would be triggered the first time a system is added to the scheduler.

It'll be a second method on the System trait alongside a second type SetupData.
The trait would become:

trait System<'a> {
    type Data: SystemData<'a>;
    type SetupData: SystemData<'a>;
    fn run(storage: <Self::Data as SystemData<'a>>::View);
    fn setup(_: <Self::SetupData as SystemData<'a>>::View) {}
}

Default associated types are not stable yet so everyone will have to define SetupData, fortunately there'll be a macro:

#[system_with_setup]
impl InAcid {
    fn run(/*borrows*/) { ... }
    fn setup(/*setup borrows*/) { ... }
}
@leudz leudz mentioned this issue Jan 9, 2020
@leudz leudz added the enhancement New feature or request label Jan 9, 2020
@leudz leudz closed this as completed Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant