From your post, it's not really clear what you are asking for and whether all the types/traits your snippet mentions are hypothetical things you'd like to implement or taken from some other crate.
Sorry, to clarify, the types exist and are from bevy. What I'm asking about is whether rust has some ergonomic way of writing type specialized versions of generic functions. Here, the commented out version of despawn_level_contents is such a specialization of despawn_where. The definition is trivial but a little boilerplatey, I was wondering whether there was a nicer way.
Thanks. Yeah, tbc I'm aware I can use generics with systems, I am using despawn_where and the commented out version of despawn_level_contents, which works just fine. I was just hoping there was some more concise way to write despawn_level_contents. I wrote despawn_level_contents because I didn't want to have to write
Well, that seems like a minimal convenience. Actually it seems you'd have to write more code by doing it your way, BUT, you could store the specialized fn in a variable and then use that
let despawn_level_contents = despawn_where::<Or<(With<Guy>, With<Wall>, With<Portal>)>>>;
app.add_enter_system(AppState::Loading, despawn_level_contents)
You could also store it in a static global variable, but it'd be more boilerplaty