I'm working on a Bevy system validator macro. In Bevy there is a ECS and a Query system parameter which can be used to query for entities and their components. But you can't borrow components mutably twice. So I need to check that. I already parsed all query arguments into a Vec<(Vec<QueryArg>, Vec<QueryFilter>)>. QueryFilter isn't relevant, so I'm gonna talk about QueryArg, which looks like this:
enum QueryArg {
Entity,
MutRef(TypePath),
Ref(TypePath),
}
I need to check if theres an instance of MutRef, and if there is disallow all other instances of MutRef and Ref with the same TypePath. How could I achieve this?