moshimoshi

A small crate to sugar working with command callbacks in bevy.

Crates.io Docs.rs

```rust use bevy::prelude::; use moshimoshi::;

[derive(Component)]

struct Button;

[derive(Component, Deref, DerefMut)]

struct OnClick(EntityCallback);

[derive(Component, Deref, DerefMut)]

struct Counter(u32);

[derive(Component)]

struct Text(String);

fn setup(mut commands: Commands) { commands.spawn(( Button, Counter(0), Text("Click Me".tostring()), OnClick(moshi!([e: Entity], counter: Query<&mut Counter> => { **counter.getmut(e).unwrap() += 1; })) )); }

impl Button { fn update(mut commands: Commands, buttons: Query<(Entity, &OnClick), Changed