rx_bevy_observable_event

Crates.iorx_bevy_observable_event
lib.rsrx_bevy_observable_event
version0.3.1
created_at2026-01-19 06:34:15.524148+00
updated_at2026-01-24 17:58:06.330754+00
descriptionrx_bevy event observable, a glue between regular bevy events and observables
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2053858
size137,558
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

observable_event

crates.io ci codecov license

The EventObservable turns Bevy events triggered on an entity into signals, allowing you to use any event as an observable source, and construct reactive pipelines from them using operators.

Subscribers will observe events targeted at the specified entity, and a completion signal once the entity is despawned.

See Also

Example

cargo run -p rx_bevy --example observable_event_example
#[derive(Resource, Deref, DerefMut)]
pub struct DummyEventTarget(Entity);

#[derive(Resource, Default, Deref, DerefMut)]
pub struct ExampleSubscriptions(SharedSubscription);

fn setup(
    mut commands: Commands,
    rx_schedule_update_virtual: RxSchedule<Update, Virtual>,
    mut subscriptions: ResMut<ExampleSubscriptions>,
) {
    commands.spawn((
        Camera3d::default(),
        Transform::from_xyz(2., 6., 8.).looking_at(Vec3::ZERO, Vec3::Y),
    ));

    let watched_entity = commands.spawn(Name::new("Watch me")).id();

    subscriptions.add(
        EventObservable::<DummyEvent>::new(watched_entity, rx_schedule_update_virtual.handle())
            .subscribe(PrintObserver::new("event_observable")),
    );

    commands.insert_resource(DummyEventTarget(watched_entity));
}

Then, provided something is triggering DummyEvents on the watched entity:

Producer is sending DummyEvent { target: 6v1#4294967302 } to 6v1!
event_observable - next: DummyEvent { target: 6v1#4294967302 }
Producer is sending DummyEvent { target: 6v1#4294967302 } to 6v1!
event_observable - next: DummyEvent { target: 6v1#4294967302 }
...
Commit count: 652

cargo fmt