rx_core_macro_subscription_derive

Crates.iorx_core_macro_subscription_derive
lib.rsrx_core_macro_subscription_derive
version0.2.0
created_at2026-01-18 23:16:15.775448+00
updated_at2026-01-24 14:57:57.328402+00
descriptionrx_core subscription derive, implements associated type only traits
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2053294
size10,202
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

macro_subscription_derive

crates.io ci codecov license

Helper macro to implement a few traits required for a subscription.

Traits you still have to implement to get a subscriber

  • SubscriptionLike (unless using #[rx_delegate_subscription_like_to_destination])
  • TeardownCollection (unless using #[rx_delegate_teardown_collection])

Traits Implemented

  • WithPrimaryCategory: Sets the associated type to PrimaryCategorySubscription

Attributes

All attributes are prefixed with rx_ for easy auto-complete access.

  • #[rx_delegate_teardown_collection]: Implements add_teardown

    The default implementation is:

    fn add_teardown(&mut self, teardown: Teardown) {
        if !self.is_closed() {
            self.(#[teardown] or if missing, #[destination]).add_teardown(teardown);
        } else {
            teardown.execute();
        }
    }
    
  • #[rx_skip_unsubscribe_on_drop_impl]: Skips the default unsubscribe-on-drop implementation. Only use when the subscription explicitly does NOT have to unsubscribe on drop, or you want to provide your own implementation.

    The default implementation:

    fn drop(&mut self) {
        if !self.is_closed() {
            self.unsubscribe();
        }
    }
    

See Also

Expanding the proc macro

In case you want to inspect the output of the proc macro.

If you haven't installed cargo-expand yet, install it first:

cargo install cargo-expand

Then expand the macro output:

cargo expand -p rx_core_observable_interval
Commit count: 652

cargo fmt