DioxusLabs / DioxusLabs/dioxus

Provide a subsecond proc macro that generates a HotFn call

Open
#4,143 3 comments 0 reactions 0 assignees View on GitHub
enhancement subsecond
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

Per https://github.com/jkelleyrtp/subsecond-bevy-demo/blob/main/src/main.rs, all calls to hotpatched functions must be routed to an "inner" implementation that is actually hotpatched:

```rust
fn button_system(
mut interaction_query: Query<
(
&Interaction,
&mut BackgroundColor,
&mut BorderColor,
&Children,
),
(Changed, With),
>,
mut text_query: Query<&mut Text>,
) {
dioxus_devtools::subsecond::HotFn::current(query_inner).call((interaction_query, text_query));
}

fn query_inner(
mut interaction_query: Query<
(
&Interaction,
&mut BackgroundColor,
&mut BorderColor,
&Children,
),
(Changed, With),
>,
mut text_query: Query<&mut Text>,
) {
// ...
}
```

Since Bevy systems tend to have many params, this approach is very verbose.
Could we have a proc macro that generates that boilerplate for us, allowing for something like this?

```rust
#[subsecond]
fn button_system(
mut interaction_query: Query<
(
&Interaction,
&mut BackgroundColor,
&mut BorderColor,
&Children,
),
(Changed, With),
>,
mut text_query: Query<&mut Text>,
) {
// ...
}
```

Or is this in third-party territory?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.