Skip to content

Conversation

@AngelOfSol
Copy link
Contributor

@AngelOfSol AngelOfSol commented Feb 15, 2021

Let me know if you think I should make any changes to the example. I think it's a pretty good reference example of what you can do with the new API, though I'm curious if some sort of MapWorld<> API is reasonable as a better example.

let mut writer = batch.writer::<T>().unwrap();
for item in arch.get::<T>().unwrap().iter() {
if writer.push(item.clone()).is_err() {
panic!()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
panic!()
unreachable!()

@@ -0,0 +1,142 @@
use core::any::TypeId;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include module-level doc comments that explain what this demonstrates, why it's useful, why special effort is needed (there's no static guarantee that all components are Clone) and what the caveats are (unregistered components aren't cloned).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'll get on (I've not written an example before)

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.

2 participants