-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 Inputs, Outputs, Chaining, and Registration Ergo #876
Conversation
A test for the inputs and outputs should be added to the examples for the normal reasons. They're unique enough that illustrating the feature is important. |
@@ -115,8 +114,13 @@ where | |||
ThreadLocalExecution::NextFlush | |||
} | |||
|
|||
fn run(&mut self, world: &World, resources: &Resources) { | |||
(self.func)(&mut self.state, world, resources) | |||
unsafe fn run_unsafe( |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
} | ||
|
||
// This system takes a Result<usize> input and either prints the parsed value or the error message | ||
// Try changing the Message resource to something that isn't an integer. You should see the error message printed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message is already not an integer. It is "hello"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! I changed it to hello to test the error case, then forgot to change it back. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time for another round of ECS improvements!
System Registration Ergonomics: add_system() now takes a generic IntoSystem type instead of a boxed system
System Inputs and Outputs: The
System
trait now has Input and Output associated types.System<Input = X, Output = Y>
System Chaining. This allows us to make "result systems" with error handlers (among other things)
Note: only
System<Input = (), Output =()>
systems can be added to a schedule. Schedules don't know how to populate inputs, nor do they know what to do with outputs.