#bevy #macro #proc-macro #statement #query #expressing #caravan

macro bevy_caravan

A function-like proc macro designed for making expressing Bevy's query.get statements easier

1 unstable release

0.1.0 Jul 17, 2024

#428 in Procedural macros

MIT/Apache

79KB
1.5K SLoC

Caravan Whiteboard Banner

Caravan is a function-like procedural macro built to make expressing query.get statements easier. For this goal, it employs a minature programming language that is written into the function parameters; Example shown below.

ref_caravan!(entity :: query = bindings);

This code would expand into the following:

let Ok(bindings) = query.get(entity) else { return; };

That's the most basic, and expected to be the most common, use-case. The macro has a wide range of additional features, enabling it to be more flexible. Caravan is currently a work in progress but it's primary functions are finished. Documentation is planned but not finished; The best way to understand the macro as of now would be to take a look at the tests that have been written for it: https://github.com/orangutanrider/bevy_caravan/tree/main/tests

No runtime deps

Features