DioxusLabs / DioxusLabs/dioxus

Subsecond: When is HotFnPanic triggered?

Open
#5,614 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

I am trying to integrate subsecond into a game. However, as far as I can tell, `HotFnPanic` is never triggered.

The documentation for [`subsecond::HotFn::try_call`](https://docs.rs/subsecond/0.8.0-alpha.0/subsecond/struct.HotFn.html#method.try_call) says the following

> If this function is stale and can’t be updated in place (ie, changes occurred above this call), then this function will emit an [HotFnPanic](https://docs.rs/subsecond/0.8.0-alpha.0/subsecond/struct.HotFnPanic.html)

What does "changes occurred above this call" mean? I assumed it means code that is before the `subsecond::call`. However, that does not seem to be the case

```rust
fn main() {
dioxus_devtools::connect_subsecond(); // or with a more lightweight integration

println!("changing this should trigger a HotFnPanic, but it does not?");
loop {
subsecond::call(foo);
}
}

fn foo() {
println!("foo");
std::thread::sleep(std::time::Duration::from_secs(1));
}

```

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.