Shorthand for Singleton adding
When you want to add a singleton to query, you need to choose a term using term_at or filter using with and then say it is a singleton.
However it would be nice to have a simpler way to annotate singletons.
I propose two possible solutions, either add with_singleton and singleton that takes term index to merge the two calls or add Singleton<T> generic struct which can take a component to mark as singleton, similar to Option<T> marking as optional.
@tynberry Singleton<T> should be possible
with_singleton and singleton are out of the question. Sander, flecs itself, is opposed against those sort of small utility functions as it adds maintenance burden and I'd like to stick close enough to the CPP API as well.
also note there's the DSL macro exactly for this reason:
system!(
"processing_xxx_system",
world,
&mut ProcessingState ($), //singleton
&AsyncTaskSender,
)
```
@tynberry do you want to PR Singleton<T> or should I add it to the backlog for myself?
I might look at it but you can keep it on backlog.
I know about the DSL macros, but from my experience of a low end computer user, rust analyzer does not work very well or at least as fast with them. I might look at them as well, but macros are still magic to me.
@tynberry yeah RA with macro's don't work great until the macro is somewhat finished. Be sure to use the vs-code expand macro in case you're wondering what it produces
the DSL macro mostly follows the convention from here https://www.flecs.dev/flecs/md_docs_2FlecsQueryLanguage.html
but with some small differences (documented)
replaced with trait usage.