9 releases (5 breaking)

0.6.0 Apr 4, 2024
0.5.0 Mar 6, 2024
0.4.0 Mar 6, 2024
0.3.0 May 8, 2023
0.1.1 Aug 3, 2022

#2067 in Game dev

Download history 45/week @ 2024-07-26 7/week @ 2024-08-02 4/week @ 2024-09-20 1/week @ 2024-09-27

506 downloads per month

MIT/Apache

125KB
3K SLoC

Rust 2.5K SLoC // 0.0% comments Tera 359 SLoC

bevy_api_gen

This crate is a part of the "bevy_mod_scripting" workspace.

bevy_api_gen is a Cargo plugin that generates reflection-powered wrappers for Bevy types. It can list Reflect types in a workspace and perform arbitrary codegen using Tera templates.

Installation

To install bevy_api_gen, use the following command:

cargo +nightly-2024-01-24 install bevy_api_gen

Usage

Generate

To run the main codegen process, use the following command:

cargo +nightly-2024-01-24 bevy-api-gen generate

This will perform all parts of the process and generate meta as well as .rs files for each crate in your workspace in your /target/plugin-nightly-2024-01-24/bevy_api_gen directory

Collect

After generating all the files, you can 'collect' them in a mod.rs file like so:

cargo +nightly-2024-01-24 bevy-api-gen collect

List Types

To see a list of all Reflect implementing types in your workspace run:

cargo +nightly-2024-01-24 bevy-api-gen list-types > all_types.txt

List Templates

To see the list of all templates which you can override use:

cargo +nightly-2024-01-24 bevy-api-gen list-templates

Print Template

You can also print any of the templates to stdout:

cargo +nightly-2024-01-24 bevy-api-gen print item.tera

Dependencies

~14–26MB
~406K SLoC