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

run macro #30

Closed
dakom opened this issue Dec 31, 2019 · 0 comments
Closed

run macro #30

dakom opened this issue Dec 31, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@dakom
Copy link
Contributor

dakom commented Dec 31, 2019

This is already on @leudz Ali Baba's Cave (todo list) - just opening an issue for convenience

As discussed on Gitter...

The idea is to have a run macro that is similar in syntax to the system derive macro. The only major difference is that the world must be given as the first argument - and that it executes world.run() under the hood.

This would be valid syntax:

//create an entity
let entity = run!(&world, |mut entities:&mut Entities, mut labels:&mut Label| {
    entities.add_entity(&mut labels, Label::new("foo"))
});

//delete an entity
run!(&world, |mut all_storages: AllStorages| {
    all_storages.delete(entity);
});
@leudz leudz added the enhancement New feature or request label Dec 31, 2019
@leudz leudz mentioned this issue Jan 1, 2020
@leudz leudz closed this as completed in f31d965 Apr 22, 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

2 participants