├── .cargo
└── config.toml
├── .github
├── FUNDING.yml
└── workflows
│ ├── book.yml
│ ├── publish.yml
│ └── test.yml
├── .gitignore
├── .vscode
└── settings.json
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── crates
├── forky_bevy
│ ├── Cargo.toml
│ └── src
│ │ ├── extensions
│ │ ├── app.rs
│ │ ├── app_res.rs
│ │ ├── global_transform.rs
│ │ ├── map.rs
│ │ ├── mod.rs
│ │ ├── pose.rs
│ │ ├── quat.rs
│ │ ├── transform_x.rs
│ │ └── vec3.rs
│ │ ├── lib.rs
│ │ └── systems
│ │ ├── exit_system.rs
│ │ └── mod.rs
├── forky_cli
│ ├── Cargo.toml
│ ├── README.md
│ ├── examples
│ │ ├── cli.rs
│ │ └── swap_mouse.rs
│ └── src
│ │ ├── common
│ │ ├── auto_mod.rs
│ │ ├── for_each_directory.rs
│ │ ├── forky_cli.rs
│ │ ├── mod.rs
│ │ └── watch.rs
│ │ ├── key
│ │ ├── auto_key_command.rs
│ │ ├── input_command.rs
│ │ ├── input_sequence.rs
│ │ └── mod.rs
│ │ ├── lib.rs
│ │ ├── main.rs
│ │ ├── server
│ │ ├── _self_signed_certs
│ │ │ ├── cert.pem
│ │ │ ├── key.pem
│ │ │ └── mod.rs
│ │ ├── address.rs
│ │ ├── mod.rs
│ │ ├── proxy.rs
│ │ ├── serve.rs
│ │ └── tls.rs
│ │ ├── style
│ │ ├── cli_all.rs
│ │ ├── command_all.rs
│ │ ├── command_file.rs
│ │ ├── index_files.rs
│ │ ├── lightning.rs
│ │ ├── mod.rs
│ │ ├── style_command.rs
│ │ └── type_files.rs
│ │ └── utils
│ │ ├── mod.rs
│ │ └── path_buf.rs
├── forky_core
│ ├── Cargo.toml
│ └── src
│ │ ├── extensions
│ │ ├── duration.rs
│ │ ├── mod.rs
│ │ ├── option.rs
│ │ ├── path_buf_ext.rs
│ │ ├── path_ext.rs
│ │ ├── result_x.rs
│ │ ├── str_x.rs
│ │ ├── string.rs
│ │ └── vec.rs
│ │ ├── forky_event
│ │ ├── forky_event.rs
│ │ └── mod.rs
│ │ ├── graph
│ │ ├── mod.rs
│ │ └── node.rs
│ │ ├── lib.rs
│ │ ├── math
│ │ ├── constants.rs
│ │ └── mod.rs
│ │ ├── math_f64
│ │ ├── constants.rs
│ │ ├── funcs.rs
│ │ └── mod.rs
│ │ ├── style
│ │ └── mod.rs
│ │ └── utils
│ │ ├── async_utils.rs
│ │ ├── mod.rs
│ │ └── random.rs
├── forky_esp
│ ├── Cargo.toml
│ └── src
│ │ ├── __extensions
│ │ ├── mod.rs
│ │ └── rgb.rs
│ │ ├── _core
│ │ ├── _esp_device.rs
│ │ ├── _led_controller_rgb.rs
│ │ ├── _led_controller_rgbw.rs
│ │ ├── _logger.rs
│ │ ├── _smart_leds_adapter_rgbw.rs
│ │ ├── _timer.rs
│ │ └── mod.rs
│ │ ├── entry
│ │ ├── device.rs
│ │ ├── hello_led.rs
│ │ ├── hello_led_strip.rs
│ │ ├── hello_world.rs
│ │ └── mod.rs
│ │ ├── lib.rs
│ │ └── main.rs
├── forky_fs
│ ├── Cargo.toml
│ ├── src
│ │ ├── cli
│ │ │ ├── fs_watcher.rs
│ │ │ ├── mod.rs
│ │ │ └── subcommand.rs
│ │ ├── fs
│ │ │ ├── fs_async_utils.rs
│ │ │ ├── fs_error.rs
│ │ │ ├── fs_ext.rs
│ │ │ ├── mod.rs
│ │ │ ├── read_dir.rs
│ │ │ └── read_file.rs
│ │ ├── lib.rs
│ │ └── utility
│ │ │ ├── cli_args
│ │ │ ├── misc.rs
│ │ │ └── mod.rs
│ │ │ ├── command.rs
│ │ │ ├── mod.rs
│ │ │ ├── process
│ │ │ ├── child_x.rs
│ │ │ └── mod.rs
│ │ │ └── terminal
│ │ │ ├── misc.rs
│ │ │ ├── mod.rs
│ │ │ └── redirect_io.rs
│ └── test_dir
│ │ ├── _ignored_dir
│ │ └── mod.rs
│ │ ├── _ignored_file.rs
│ │ ├── included_dir
│ │ └── mod.rs
│ │ ├── included_file.rs
│ │ └── mod.rs
├── forky_net
│ ├── Cargo.toml
│ └── src
│ │ ├── axum_utils
│ │ ├── axum_ext.rs
│ │ └── mod.rs
│ │ ├── layers
│ │ ├── cors.rs
│ │ ├── mod.rs
│ │ └── no_cache.rs
│ │ ├── lib.rs
│ │ ├── reqwest_utils
│ │ ├── mod.rs
│ │ └── reqwest_ext.rs
│ │ └── state
│ │ ├── api_environment.rs
│ │ ├── mod.rs
│ │ └── uptime.rs
├── forky_play
│ ├── Cargo.toml
│ ├── assets
│ │ ├── branding
│ │ │ ├── icon.png
│ │ │ └── icon.svg
│ │ ├── fonts
│ │ │ ├── FiraMono-LICENSE
│ │ │ ├── FiraMono-Medium.ttf
│ │ │ └── FiraSans-Bold.ttf
│ │ └── shaders
│ │ │ ├── custom_material.wgsl
│ │ │ ├── noise.wgsl
│ │ │ ├── sdf2.wgsl
│ │ │ ├── sdf3.wgsl
│ │ │ ├── simple.wgsl
│ │ │ ├── unlit.wgsl
│ │ │ ├── unlit_texture.wgsl
│ │ │ ├── utility.wgsl
│ │ │ └── uv.wgsl
│ ├── docs
│ │ ├── Splines.md
│ │ └── Tools.md
│ ├── examples
│ │ ├── bevy_graph.rs
│ │ ├── gamai_graph.rs
│ │ ├── maze.rs
│ │ ├── maze_terminal.rs
│ │ ├── mithril.rs
│ │ ├── node_set_graph.rs
│ │ ├── rotate_cube.rs
│ │ ├── shader.rs
│ │ ├── shader_unlit.rs
│ │ ├── shader_uv.rs
│ │ ├── spline_catmull_rom.rs
│ │ ├── spline_editor.rs
│ │ └── spline_mesh.rs
│ ├── src
│ │ ├── camera
│ │ │ ├── camera_view_toggle.rs
│ │ │ ├── fly_camera_bundle.rs
│ │ │ ├── fps_camera_bundle.rs
│ │ │ ├── mod.rs
│ │ │ ├── orbit_camera_bundle.rs
│ │ │ ├── orbit_camera_controller.rs
│ │ │ ├── orbit_keyboard_controller.rs
│ │ │ └── plugin.rs
│ │ ├── common
│ │ │ ├── id_hashmap.rs
│ │ │ └── mod.rs
│ │ ├── debug
│ │ │ ├── gizmos.rs
│ │ │ ├── grid.rs
│ │ │ └── mod.rs
│ │ ├── extensions
│ │ │ ├── material.rs
│ │ │ └── mod.rs
│ │ ├── geometry__
│ │ │ ├── bezier
│ │ │ │ ├── cubic.rs
│ │ │ │ ├── linear.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── quadratic.rs
│ │ │ ├── bezier2
│ │ │ │ ├── cubic.rs
│ │ │ │ ├── linear.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── quadratic.rs
│ │ │ ├── bezier3
│ │ │ │ ├── cubic.rs
│ │ │ │ ├── linear.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── quadratic.rs
│ │ │ └── mod.rs
│ │ ├── input
│ │ │ ├── keyboard_controller.rs
│ │ │ ├── mod.rs
│ │ │ ├── mouse_controller.rs
│ │ │ ├── plugin.rs
│ │ │ └── transform_controller.rs
│ │ ├── lib.rs
│ │ ├── materials
│ │ │ ├── forky_material_plugin.rs
│ │ │ ├── forky_shader.rs
│ │ │ ├── inline_shaders.rs
│ │ │ ├── mod.rs
│ │ │ ├── unlit_material.rs
│ │ │ ├── unlit_texture_material.rs
│ │ │ └── uv_material.rs
│ │ ├── mesh_utils
│ │ │ ├── mesh_factory.rs
│ │ │ └── mod.rs
│ │ ├── spline
│ │ │ ├── _solvers
│ │ │ │ ├── catmull_rom.rs
│ │ │ │ └── mod.rs
│ │ │ ├── _spline
│ │ │ │ ├── cubic_spline.rs
│ │ │ │ ├── linear_spline.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── quadratic_spline.rs
│ │ │ │ ├── spline.rs
│ │ │ │ └── spline_type.rs
│ │ │ ├── graph
│ │ │ │ ├── mod.rs
│ │ │ │ ├── on_node_moved.rs
│ │ │ │ ├── spline_edge.rs
│ │ │ │ ├── spline_graph.rs
│ │ │ │ ├── spline_graph_lookup.rs
│ │ │ │ ├── spline_graph_plugin.rs
│ │ │ │ ├── spline_node.rs
│ │ │ │ └── spline_node_positional.rs
│ │ │ ├── mesh
│ │ │ │ ├── create_spline_mesh.rs
│ │ │ │ ├── edge_loop.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── normals.rs
│ │ │ │ ├── triangles.rs
│ │ │ │ ├── uvs.rs
│ │ │ │ └── vertices.rs
│ │ │ ├── mod.rs
│ │ │ ├── spline_plugin.rs
│ │ │ └── utils
│ │ │ │ ├── debug_utils.rs
│ │ │ │ └── mod.rs
│ │ └── utility
│ │ │ ├── keycode.rs
│ │ │ ├── mod.rs
│ │ │ └── systems.rs
│ └── test
│ │ ├── extensions
│ │ ├── app.rs
│ │ ├── mod.rs
│ │ └── quat.rs
│ │ ├── geometry
│ │ ├── bezier.rs
│ │ ├── bezier_render.rs
│ │ └── mod.rs
│ │ ├── maze
│ │ ├── ball.rs
│ │ ├── depth_first_backtrace.rs
│ │ ├── maze_walls.rs
│ │ ├── mod.rs
│ │ ├── plugin.rs
│ │ └── rect_maze.rs
│ │ ├── misc
│ │ ├── boid.rs
│ │ ├── ecs.rs
│ │ ├── graphics.rs
│ │ ├── kaleid.rs
│ │ ├── mod.rs
│ │ ├── physics.rs
│ │ └── utility.rs
│ │ ├── mod.rs
│ │ ├── physics
│ │ ├── euler_physics.rs
│ │ ├── mod.rs
│ │ ├── revolute_joint.rs
│ │ └── slerp_joint.rs
│ │ ├── spline
│ │ ├── catmull_rom.rs
│ │ ├── ecs_spline_graph.rs
│ │ ├── graph.rs
│ │ ├── mod.rs
│ │ ├── spline.rs
│ │ ├── spline_graph.rs
│ │ ├── spline_mesh.rs
│ │ ├── spline_mesh_render.rs
│ │ ├── spline_physics.rs
│ │ └── spline_physics_render.rs
│ │ └── sweet.rs
└── forky_web
│ ├── Cargo.toml
│ └── src
│ ├── dom_utils
│ ├── animation_frame.rs
│ ├── context_menu.rs
│ ├── document_interaction_listener.rs
│ ├── file.rs
│ ├── forky_style_g.rs
│ ├── future_timeout.rs
│ ├── history.rs
│ ├── html_event_listener.rs
│ ├── html_event_waiter.rs
│ ├── interval.rs
│ ├── lifecycle.rs
│ ├── location.rs
│ ├── loop_utils.rs
│ ├── mod.rs
│ ├── poll.rs
│ ├── resize_listener.rs
│ ├── search_params.rs
│ └── utils.rs
│ ├── extensions
│ ├── array.rs
│ ├── closure.rs
│ ├── document.rs
│ ├── element.rs
│ ├── iframe.rs
│ ├── mod.rs
│ ├── response.rs
│ └── result.rs
│ ├── lib.rs
│ ├── logging
│ ├── log_buffer.rs
│ ├── log_filter.rs
│ ├── mod.rs
│ ├── replace_func.rs
│ └── set_panic_hook.rs
│ └── net
│ ├── fetch.rs
│ └── mod.rs
├── docs
├── .gitignore
├── book.toml
├── src
│ ├── SUMMARY.md
│ ├── custom
│ │ ├── index.css
│ │ └── index.js
│ ├── draft
│ │ ├── bevy_editor.md
│ │ ├── bevy_webxr_plan.md
│ │ ├── default_graphs
│ │ │ ├── render_graph.dot.svg
│ │ │ └── schedule_Main.dot.svg
│ │ ├── esp
│ │ │ ├── esp32-c3.md
│ │ │ ├── general.md
│ │ │ ├── leds.md
│ │ │ └── wasm.md
│ │ ├── notes.md
│ │ └── play
│ │ │ └── notes.md
│ ├── forky_cli
│ │ ├── index.md
│ │ ├── mod.md
│ │ └── watch.md
│ ├── index.md
│ └── other
│ │ └── contributing.md
└── theme
│ ├── book.js
│ ├── css
│ ├── chrome.css
│ ├── general.css
│ ├── print.css
│ └── variables.css
│ ├── favicon.png
│ ├── favicon.svg
│ ├── fonts
│ ├── OPEN-SANS-LICENSE.txt
│ ├── SOURCE-CODE-PRO-LICENSE.txt
│ ├── fonts.css
│ ├── open-sans-v17-all-charsets-300.woff2
│ ├── open-sans-v17-all-charsets-300italic.woff2
│ ├── open-sans-v17-all-charsets-600.woff2
│ ├── open-sans-v17-all-charsets-600italic.woff2
│ ├── open-sans-v17-all-charsets-700.woff2
│ ├── open-sans-v17-all-charsets-700italic.woff2
│ ├── open-sans-v17-all-charsets-800.woff2
│ ├── open-sans-v17-all-charsets-800italic.woff2
│ ├── open-sans-v17-all-charsets-italic.woff2
│ ├── open-sans-v17-all-charsets-regular.woff2
│ └── source-code-pro-v11-all-charsets-500.woff2
│ ├── head.hbs
│ ├── highlight.css
│ ├── highlight.js
│ └── index.hbs
├── examples
└── build.rs
├── html
├── https.config.js
└── index.html
├── justfile
├── rustfmt.toml
└── src
└── lib.rs
/.cargo/config.toml:
--------------------------------------------------------------------------------
1 | [target.wasm32-unknown-unknown]
2 | runner = 'sweet test-wasm'
3 |
4 | [env]
5 | SWEET_ROOT = { value = "", relative = true }
6 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [mrchantey]
2 |
--------------------------------------------------------------------------------
/.github/workflows/book.yml:
--------------------------------------------------------------------------------
1 | # Github Setup:
2 | # 1. settings > pages > branch > main/docs
3 | # 2. settings > actions > general > workflow permissions > read and write permissions
4 | name: 🌍 Deploy Book
5 | on:
6 | push:
7 | branches: main
8 | paths: ['docs/**','.github/workflows/book.yml']
9 | jobs:
10 | deploy:
11 | name: Build and Deploy
12 | runs-on: ubuntu-20.04
13 | concurrency:
14 | group: ${{ github.workflow }}-${{ github.ref }}
15 | steps:
16 | - name: 📂 Checkout
17 | uses: actions/checkout@v4
18 | - name: 📂 Cache
19 | uses: actions/cache@v3
20 | with:
21 | path: |
22 | ~/.cargo/bin/
23 | ~/.cargo/registry/index/
24 | ~/.cargo/registry/cache/
25 | ~/.cargo/git/db/
26 | target/
27 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
28 | - name: 🔨 Install mdbook
29 | uses: peaceiris/actions-mdbook@v1
30 | with:
31 | mdbook-version: '0.4.34'
32 | - name: 🔨 Install mdbook-mermaid
33 | uses: baptiste0928/cargo-install@v2
34 | with:
35 | crate: mdbook-mermaid
36 | version: '0.12.6'
37 | - name: 🔨 Build Book
38 | run: mdbook build
39 | working-directory: ./docs
40 | - name: 🌍 Deploy
41 | uses: peaceiris/actions-gh-pages@v3
42 | if: ${{ github.ref == 'refs/heads/main' }}
43 | with:
44 | github_token: ${{ secrets.GITHUB_TOKEN }}
45 | publish_branch: pages
46 | publish_dir: ./docs/book
47 | destination_dir: docs
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | # https://pratikpc.medium.com/publishing-crates-using-github-actions-165ee67780e1
2 | name: 🌍 Publish Crates
3 | on:
4 | push:
5 | tags: 'v*.*.never'
6 | workflow_dispatch:
7 | jobs:
8 | publish:
9 | name: Publish
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout sources
13 | uses: actions/checkout@v4
14 |
15 | - name: Install stable toolchain
16 | uses: actions-rs/toolchain@v1
17 | with:
18 | profile: minimal
19 | toolchain: stable
20 | override: true
21 | # - run: cargo publish --token ${CRATES_TOKEN}
22 | # env:
23 | # CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # rust
2 | rustc-ice-*
3 | target/
4 | crates/*/target/
5 | **/*.rs.bk
6 | html/*
7 | !html/index.html
8 | !html/https.config.js
9 |
10 | # esp idf
11 | .embuild
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | // "rust-analyzer.cargo.target": "wasm32-unknown-unknown",
3 | "files.autoSave": "afterDelay",
4 | "files.autoSaveDelay": 1000,
5 | "files.exclude": {
6 | "**/.git": true,
7 | "**/.svn": true,
8 | "**/.hg": true,
9 | "**/CVS": true,
10 | "**/.DS_Store": true,
11 | "**/Thumbs.db": true,
12 | // ".vscode": true,
13 | //optional
14 | "LICENSE": true,
15 | "**/.embuild/": true,
16 | // "**/.cargo/": true,
17 | // "**/Cargo.lock": true,
18 | // "**/mod.rs": true,
19 | // "out/": true,
20 | // "**/target/": true,
21 | "**/sdkconfig.defaults": true,
22 | "**/build.rs": true,
23 | "docs/book/**": true,
24 | "html/assets/**": true
25 | },
26 | "rust-analyzer.cargo.features": "all",
27 | // "rust-analyzer.cargo.features": [
28 | // "web_sys_unstable_apis"
29 | // ],
30 | "search.exclude": {
31 | "Cargo.lock": true,
32 | "**/assets/*": true,
33 | "**.svg": true
34 | },
35 | "rust-analyzer.showUnlinkedFileNotification": false
36 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Peter Hayman
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Forky
2 |
3 |
4 |
5 | Rust utilities
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
21 |
22 |

23 |
24 |
made with ❤️🔥 by mrchantey
25 |
26 |
27 | ## Contents
28 | - [Forky CLI](./crates/forky_cli/README.md)
--------------------------------------------------------------------------------
/crates/forky_bevy/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "forky_bevy"
3 | version.workspace = true
4 | edition.workspace = true
5 | authors.workspace = true
6 | documentation.workspace = true
7 | license.workspace = true
8 | readme.workspace = true
9 | description.workspace = true
10 | repository.workspace = true
11 |
12 | [dependencies]
13 | forky_core.workspace = true
14 | bevy.workspace = true
15 | rand.workspace = true
16 | # bevy = { workspace = true, optional = true }
17 |
18 | anyhow.workspace = true
19 | extend.workspace = true
20 |
21 | [target.'cfg(target_arch = "wasm32")'.dependencies]
22 | forky_web.workspace = true
23 | js-sys.workspace = true
24 | # wasm-bindgen = { workspace = true, optional = true }
25 | # wasm-bindgen-futures = { workspace = true, optional = true }
26 | # web-sys = { workspace = true, optional = true }
27 |
28 |
29 | [dev-dependencies]
30 | sweet.workspace = true
--------------------------------------------------------------------------------
/crates/forky_bevy/src/extensions/app.rs:
--------------------------------------------------------------------------------
1 | use crate::prelude::*;
2 | use bevy::prelude::*;
3 | use extend::ext;
4 | use forky_core::utils::RcCell;
5 |
6 | #[ext]
7 | pub impl App {
8 | fn __(&mut self) -> &mut Self { self }
9 | fn with_app_res(self) -> RcCell { AppRes::init(self) }
10 |
11 | #[cfg(target_arch = "wasm32")]
12 | #[must_use]
13 | fn run_on_animation_frame(mut self) -> forky_web::AnimationFrame {
14 | forky_web::AnimationFrame::new(move || {
15 | self.update();
16 | })
17 | }
18 | }
19 |
20 |
21 | #[cfg(test)]
22 | mod test {
23 | use crate::prelude::*;
24 | use sweet::prelude::*;
25 | #[test]
26 | pub fn works() {
27 | let app = AppRes::new();
28 | let app = app.borrow_mut();
29 | expect(app.world().contains_non_send::()).to_be_true();
30 | }
31 | }
--------------------------------------------------------------------------------
/crates/forky_bevy/src/extensions/app_res.rs:
--------------------------------------------------------------------------------
1 | use bevy::prelude::*;
2 | use extend::ext;
3 | use forky_core::prelude::*;
4 |
5 | #[derive(Deref, DerefMut)]
6 | pub struct AppRes(pub RcCell);
7 |
8 | impl AppRes {
9 | pub fn new() -> RcCell { Self::init(App::new()) }
10 |
11 |
12 | pub fn build(func: impl FnOnce(&mut App)) -> RcCell {
13 | let mut app = App::new();
14 | func(&mut app);
15 | Self::init(app)
16 | }
17 |
18 | pub fn init(app: App) -> RcCell {
19 | let app = rccell(app);
20 | let app2 = app.clone();
21 | app.borrow_mut().insert_non_send_resource(AppRes(app2));
22 | app
23 | }
24 | }
25 |
26 | #[ext]
27 | pub impl RcCell {
28 | #[cfg(target_arch = "wasm32")]
29 | fn run_on_animation_frame(self) -> forky_web::AnimationFrame {
30 | forky_web::AnimationFrame::new(move || {
31 | self.borrow_mut().update();
32 | })
33 | }
34 |
35 | #[cfg(target_arch = "wasm32")]
36 | fn run_forever(self) -> impl std::future::Future