#registration #macro #bevy #away #far #system #schedule

macro bevy_registration_procedural_macros

Run code on the app from far away. Only the procedural macros are in this crate.

6 releases

0.2.4 Jan 29, 2025
0.2.3 Jan 15, 2025
0.1.0 Jan 6, 2025

#1734 in Procedural macros

Download history 110/week @ 2024-12-31 40/week @ 2025-01-07 484/week @ 2025-01-14 25/week @ 2025-01-21 128/week @ 2025-01-28 24/week @ 2025-02-04

663 downloads per month
Used in bevy_registration

MIT/Apache

12KB
204 lines

Bevy Registration

Annotate systems, resources, and events with macros and automatically add them to your app. This uses Inventory internally, so it should work on Linux, macOS, iOS, FreeBSD, Android, Windows, and WebAssembly.

Bevy Versions

registration version bevy version
0.1.0 - 0.2.4 0.15

Example:

use bevy::prelude::*;
use bevy_registration::prelude::*;

// Initiates the resource on the app.
#[init]
#[derive(Resource, Default)]
pub struct TestResource;

// Adds the system to the Update schedule.
#[system(Update)]
fn resource_tester(resource: Option<Res<TestResource>>) {
    // This will not panic.
    resource.unwrap();
}

fn main() {
    App::new()
        // Add bevy's default plugins, to start up the update loop.
        .add_plugins(DefaultPlugins)
        // Add the registration plugin that will collect the far-away app code.
        .add_plugins(RegistrationPlugin)
        .run();
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~255–690KB
~16K SLoC