Skip to content

Commit

Permalink
Persistence of app configuration (#4)
Browse files Browse the repository at this point in the history
* persistence of options without Init Distr and Func Configs

* fmt and defaults

* plot settings persistence

* update deps ode-solver

* serde derive default and serde benchmark config

* reset button, derives and persistence description

* refactor naming of PlotData for backends

* emojis and ui tweaks
  • Loading branch information
tomtuamnuq authored Mar 7, 2024
1 parent 5ec1aac commit fb2d046
Show file tree
Hide file tree
Showing 31 changed files with 749 additions and 755 deletions.
76 changes: 13 additions & 63 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ paste = "1.0"
delegate = "0.12"
strum_macros = "0.25"
strum = "0.25"
web-time = "1.1.0"
web-time = "0.2.4"

ode_solvers = "0.3"
ode_solvers = "0.4"
rand_distr = "0.4"
rand = "0.8"
nalgebra = "0.32"
Expand Down Expand Up @@ -59,6 +59,7 @@ opt-level = 0
lto = "off"
panic = "abort"
strip = "symbols"
incremental = false

# Optimize dependencies in debug builds (keeps plotting performant):
[profile.dev.package."*"]
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ RustyChaosCraftor is an interactive exploration tool for visualizing dynamics in
## Installation
This project was tested with stable version ˋrustc 1.76.0ˋ of the Rust toolchain. Install it with `rustup install 1.76.0`.

Sure, I can help you with that. Here's how you can extend the README with the information about how the app saves its state:

### Native
For local testing on native platforms, execute `cargo run --release`. Linux users must install necessary libraries for ˋeframeˋ with:
For local testing on native platforms, execute `cargo run --release`. Linux users must install necessary libraries for `eframe` with:

```bash
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
Expand All @@ -43,13 +45,18 @@ Fedora Rawhide users should run:
```bash
dnf install clang clang-devel clang-tools-extra libxkbcommon-devel pkg-config openssl-devel libxcb-devel gtk3-devel atk fontconfig-devel
```

The app configuration is automatically saved in the user's data directory on shutdown and every 30 seconds during autosave. The exact location of the file depends on the operating system. For example, on Linux, the file is located at `~/.local/share/rustychaoscraftor/app.ron`.

### Web
For web deployment, compile to [WASM](https://en.wikipedia.org/wiki/WebAssembly) using [Trunk](https://trunkrs.dev/):
1. Add the WASM target: `rustup target add wasm32-unknown-unknown`.
2. Install Trunk: `cargo install --locked trunk`.
3. Serve locally with `trunk serve --port=8043`, automatically rebuilding on changes.
4. Access the app at `http://127.0.0.1:8043/index.html#dev`. The `#dev`deactivates caching to view a currently developed version.

The app configuration is saved in the browser's local storage every 30 seconds. Clearing website data may resolve serialization issues.

## Community and Support
To contribute or seek support, open an issue in this repository. Questions, feedback, and contributions are welcome. For any inquiries, please feel free to open an issue.

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@

</html>

<!-- Powered by egui: https://github.com/emilk/egui/ -->
<!-- Powered by egui: https://github.com/emilk/egui/ -->
2 changes: 2 additions & 0 deletions src/chaos/data/initial_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ macro_rules! generate_initial_distribution_variants {

$(
#[derive(PartialEq, Clone, Copy, Serialize, Deserialize)]
#[serde(default)]
pub struct $variant {
$(pub $field: ChaosFloat,)*
}
Expand Down Expand Up @@ -680,6 +681,7 @@ impl ChaosDescription for Logspace {
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::chaos::functions::*;
Expand Down
2 changes: 2 additions & 0 deletions src/chaos/execution/controller_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ impl ChaosExecutionController {
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::chaos::functions::*;
Expand Down
1 change: 1 addition & 0 deletions src/chaos/functions/chaotic_function_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ macro_rules! generate_chaotic_function_configs {
($($variant:ident $par_check_code:ident{ $($field:ident: ($field_min:expr, $field_max:expr)),* } ),*)=> {
$(
#[derive(PartialEq, Clone, Debug, Deserialize, Serialize)]
#[serde(default)]
pub struct $variant {
$(pub $field: ChaosFloat,)*
}
Expand Down
Loading

0 comments on commit fb2d046

Please sign in to comment.