├── .devcontainer ├── Dockerfile ├── devcontainer.json └── setup.sh ├── .github └── workflows │ ├── publish.yml │ └── web.yml ├── .gitignore ├── .idea └── workspace.xml ├── .vscode ├── launch.json └── settings.json ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── ensure_no_std ├── .cargo │ └── config.toml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md └── src │ └── main.rs ├── fluxion ├── Cargo.lock ├── Cargo.toml ├── README.md ├── examples │ ├── benchmark.rs │ ├── foreign.rs │ └── simple.rs └── src │ ├── actor.rs │ ├── fluxion.rs │ ├── foreign.rs │ ├── identifiers.rs │ ├── lib.rs │ ├── message.rs │ └── references.rs ├── fluxion_macro ├── Cargo.toml ├── README.md └── src │ └── lib.rs ├── oranda.json └── site ├── css └── main.css ├── docs ├── .gitignore ├── book.toml └── src │ ├── SUMMARY.md │ ├── actors_and_messages.md │ ├── first_steps.md │ ├── foreign.md │ ├── foreward.md │ └── handling_messages.md └── images ├── fluxion_social.png ├── fluxion_social.svg ├── fluxion_square.png ├── fluxion_square.svg ├── fluxion_square_ar2.png ├── fluxion_square_ar2.svg ├── fluxion_wide.png └── fluxion_wide.svg /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:lunar 2 | 3 | WORKDIR /home/ 4 | 5 | COPY . . 6 | 7 | RUN bash ./setup.sh 8 | 9 | ENV PATH="/root/.cargo/bin:$PATH" -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/rust 3 | { 4 | "name": "Rust", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/rust:1-1-bookworm", 7 | "features": { 8 | "ghcr.io/devcontainers/features/rust:1": { 9 | "version": "latest", 10 | "profile": "complete" 11 | } 12 | } 13 | 14 | // Use 'mounts' to make the cargo cache persistent in a Docker Volume. 15 | // "mounts": [ 16 | // { 17 | // "source": "devcontainer-cargo-cache-${devcontainerId}", 18 | // "target": "/usr/local/cargo", 19 | // "type": "volume" 20 | // } 21 | // ] 22 | 23 | // Features to add to the dev container. More info: https://containers.dev/features. 24 | // "features": {}, 25 | 26 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 27 | // "forwardPorts": [], 28 | 29 | // Use 'postCreateCommand' to run commands after the container is created. 30 | // "postCreateCommand": "rustc --version", 31 | 32 | // Configure tool-specific properties. 33 | // "customizations": {}, 34 | 35 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 36 | // "remoteUser": "root" 37 | } 38 | -------------------------------------------------------------------------------- /.devcontainer/setup.sh: -------------------------------------------------------------------------------- 1 | ## update and install some things we should probably have 2 | apt update 3 | apt-get install -y \ 4 | curl \ 5 | git \ 6 | gnupg2 \ 7 | jq \ 8 | sudo \ 9 | zsh \ 10 | vim \ 11 | build-essential \ 12 | openssl 13 | 14 | ## Install rustup and common components 15 | curl https://sh.rustup.rs -sSf | sh -s -- -y 16 | rustup install nightly 17 | rustup component add rustfmt 18 | rustup component add rustfmt --toolchain nightly 19 | rustup component add clippy 20 | rustup component add clippy --toolchain nightly 21 | 22 | cargo install cargo-expand 23 | cargo install cargo-edit 24 | 25 | ## setup and install oh-my-zsh 26 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 27 | cp -R /root/.oh-my-zsh /home/$USERNAME 28 | cp /root/.zshrc /home/$USERNAME 29 | sed -i -e "s/\/root\/.oh-my-zsh/\/home\/$USERNAME\/.oh-my-zsh/g" /home/$USERNAME/.zshrc 30 | chown -R $USER_UID:$USER_GID /home/$USERNAME/.oh-my-zsh /home/$USERNAME/.zshrc -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | workflow_dispatch: 5 | jobs: 6 | publish: 7 | name: Publish 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout sources 11 | uses: actions/checkout@v4 12 | - name: Install stable toolchain 13 | uses: dtolnay/rust-toolchain@stable 14 | with: 15 | profile: minimal 16 | toolchain: stable 17 | override: true 18 | - name: Publish Fluxion 19 | run: cargo publish -p fluxion --token ${CARGO_REGISTRY_TOKEN} 20 | working-directory: ./fluxion 21 | env: 22 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/web.yml: -------------------------------------------------------------------------------- 1 | # Workflow to build your docs with oranda (and mdbook) 2 | # and deploy them to Github Pages 3 | name: Web 4 | 5 | # We're going to push to the gh-pages branch, so we need that permission 6 | permissions: 7 | contents: write 8 | 9 | # What situations do we want to build docs in? 10 | # All of these work independently and can be removed / commented out 11 | # if you don't want oranda/mdbook running in that situation 12 | on: 13 | # Check that a PR didn't break docs! 14 | # 15 | # Note that the "Deploy to Github Pages" step won't run in this mode, 16 | # so this won't have any side-effects. But it will tell you if a PR 17 | # completely broke oranda/mdbook. Sadly we don't provide previews (yet)! 18 | pull_request: 19 | 20 | # Whenever something gets pushed to main, update the docs! 21 | # This is great for getting docs changes live without cutting a full release. 22 | # 23 | # Note that if you're using cargo-dist, this will "race" the Release workflow 24 | # that actually builds the Github Release that oranda tries to read (and 25 | # this will almost certainly complete first). As a result you will publish 26 | # docs for the latest commit but the oranda landing page won't know about 27 | # the latest release. The workflow_run trigger below will properly wait for 28 | # cargo-dist, and so this half-published state will only last for ~10 minutes. 29 | # 30 | # If you only want docs to update with releases, disable this, or change it to 31 | # a "release" branch. You can, of course, also manually trigger a workflow run 32 | # when you want the docs to update. 33 | push: 34 | branches: 35 | - main 36 | 37 | # Whenever a workflow called "Release" completes, update the docs! 38 | # 39 | # If you're using cargo-dist, this is recommended, as it will ensure that 40 | # oranda always sees the latest release right when it's available. Note 41 | # however that Github's UI is wonky when you use workflow_run, and won't 42 | # show this workflow as part of any commit. You have to go to the "actions" 43 | # tab for your repo to see this one running (the gh-pages deploy will also 44 | # only show up there). 45 | workflow_run: 46 | workflows: [ "Publish" ] 47 | types: 48 | - completed 49 | 50 | workflow_dispatch: 51 | 52 | # Alright, let's do it! 53 | jobs: 54 | web: 55 | name: Build and deploy site and docs 56 | runs-on: ubuntu-latest 57 | steps: 58 | # Setup 59 | - uses: actions/checkout@v3 60 | with: 61 | fetch-depth: 0 62 | - uses: dtolnay/rust-toolchain@stable 63 | - uses: swatinem/rust-cache@v2 64 | 65 | # If you use any mdbook plugins, here's the place to install them! 66 | 67 | # Install and run oranda (and mdbook)! 68 | # 69 | # This will write all output to ./public/ (including copying mdbook's output to there). 70 | - name: Install and run oranda 71 | run: | 72 | curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.6.1/oranda-installer.sh | sh 73 | oranda build 74 | 75 | # Deploy to our gh-pages branch (creating it if it doesn't exist). 76 | # The "public" dir that oranda made above will become the root dir 77 | # of this branch. 78 | # 79 | # Note that once the gh-pages branch exists, you must 80 | # go into repo's settings > pages and set "deploy from branch: gh-pages". 81 | # The other defaults work fine. 82 | - name: Deploy to Github Pages 83 | uses: JamesIves/github-pages-deploy-action@v4.4.1 84 | # ONLY if we're on main (so no PRs or feature branches allowed!) 85 | if: ${{ github.ref == 'refs/heads/master' }} 86 | with: 87 | branch: gh-pages 88 | # Gotta tell the action where to find oranda's output 89 | folder: public 90 | token: ${{ secrets.GITHUB_TOKEN }} 91 | single-commit: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | /env 3 | public/ -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 35 | 40 | 42 | { 43 | "lastFilter": { 44 | "state": "OPEN", 45 | "assignee": "wireboy5" 46 | } 47 | } 48 | 49 | 55 | 56 | 57 | 59 | 60 | 62 | { 63 | "customColor": "", 64 | "associatedIndex": 6 65 | } 66 | 67 | 68 | 71 | { 72 | "keyToString": { 73 | "RunOnceActivity.OpenProjectViewOnStart": "true", 74 | "RunOnceActivity.ShowReadmeOnStart": "true", 75 | "RunOnceActivity.rust.reset.selective.auto.import": "true", 76 | "git-widget-placeholder": "v0.10", 77 | "ignore.virus.scanning.warn.message": "true", 78 | "node.js.detected.package.eslint": "true", 79 | "node.js.detected.package.tslint": "true", 80 | "node.js.selected.package.eslint": "(autodetect)", 81 | "node.js.selected.package.tslint": "(autodetect)", 82 | "nodejs_package_manager_path": "npm", 83 | "org.rust.cargo.project.model.PROJECT_DISCOVERY": "true", 84 | "org.rust.first.attach.projects.stats": "true", 85 | "settings.editor.selected.configurable": "reference.settingsdialog.project.grazie", 86 | "vue.rearranger.settings.migration": "true" 87 | } 88 | } 89 | 90 | 91 | 107 | 108 | 109 | 111 | 112 | 113 | 114 | 115 | 1712331359136 116 | 122 | 123 | 124 | 125 | 127 | 128 | 149 | 150 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "lldb", 9 | "request": "launch", 10 | "name": "Debug unit tests in library 'fluxion'", 11 | "cargo": { 12 | "args": [ 13 | "test", 14 | "--no-run", 15 | "--lib", 16 | "--package=fluxion" 17 | ], 18 | "filter": { 19 | "name": "fluxion", 20 | "kind": "lib" 21 | } 22 | }, 23 | "args": [], 24 | "cwd": "${workspaceFolder}" 25 | }, 26 | { 27 | "type": "lldb", 28 | "request": "launch", 29 | "name": "Debug executable 'fluxion'", 30 | "cargo": { 31 | "args": [ 32 | "build", 33 | "--bin=fluxion", 34 | "--package=fluxion" 35 | ], 36 | "filter": { 37 | "name": "fluxion", 38 | "kind": "bin" 39 | } 40 | }, 41 | "args": [], 42 | "cwd": "${workspaceFolder}" 43 | }, 44 | { 45 | "type": "lldb", 46 | "request": "launch", 47 | "name": "Debug unit tests in executable 'fluxion'", 48 | "cargo": { 49 | "args": [ 50 | "test", 51 | "--no-run", 52 | "--bin=fluxion", 53 | "--package=fluxion" 54 | ], 55 | "filter": { 56 | "name": "fluxion", 57 | "kind": "bin" 58 | } 59 | }, 60 | "args": [], 61 | "cwd": "${workspaceFolder}" 62 | } 63 | ] 64 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.check.command": "clippy" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.10.5 -- 2024-11-5 4 | 5 | Version 0.10.5 changes `MessageSender`s to return a sized error type. 6 | This type was intentionally made to *not* be irrefutable, as this could cause breaking changes across features. 7 | 8 | ## 0.10.4 -- 2024-11-5 9 | 10 | Version 0.10.4 changes `MessageSenders` to also return boxed errors, enabling delegates to fail to send messages. 11 | Previously messages had been infallible, however this provided no way for networked delegates to fail. 12 | 13 | ## 0.10.3 -- 2024-11-3 14 | 15 | Version 0.10.3 makes `LocalRef`s `Clone` implementation not depend on its generics. 16 | 17 | ## 0.10.2 -- 2024-11-3 18 | 19 | Version 0.10.2 implements `Clone` for `LocalRef`s. 20 | 21 | ## 0.10.1 -- 2024-11-2 22 | 23 | Version 0.10.1 adds support for naming actors, which can be useful when communicating over a network where actor id's may not be guarenteed to be consistent. 24 | 25 | ## 0.10.0 -- 2024-8-26 26 | 27 | Version 0.10 is intended to be the final complete overhaul of Fluxion. The only scenario in which another rewrite should be expected is if this version has major usability issues. Otherwise, all future minor versions, as well as version 1.0.0, should just be bug fixes and minor feature updates. 28 | 29 | This version replaces Fluxion's entire messaging/supervisor backend with raw function calls via [Slacktor](https://github.com/peperworx/slacktor). This provides a very similar API to the channel based backend, and comes with a variety of benefits. First and foremost is that Fluxion is now completely, 100%, executor agnostic. No boilerplate code or trait implementations are required anymore. Additionally, Fluxion is now orders of magnitude faster. 30 | 31 | Version 1.10 also completely overhauls the idea of foreign messages. All data serialization and message passing is now handled by a "delegate". Additionally, Fluxion is now much more flexible in requiring the Serialize and Deserialize traits. 32 | 33 | Here are some bullet points of the core changes: 34 | 35 | 36 | - Fluxion no longer uses channels. 37 | - These have been replaced with raw function calls. 38 | - While there are breaking API changes, this doesn't reduce the usability of the API. 39 | - Fluxion no longer uses supervisor tasks. 40 | - They are not necessary if channels are not being used. 41 | - As a consequence of this, error policies are also gone. In the future, error policies may be moved into their own crate, as they were useful in their own right. 42 | - Foreign messages are now entirely handled by "delegates" 43 | - This includes serialization and deserialization of methods. 44 | - Messages also now have IDs that represent the message type. These are, by default, the full path of the message's type. 45 | - Actor initialization and deinitialization logic has been greatly simplified. 46 | - Only the `initialize` and `deinitialize` functions are provided. 47 | - Due to being unable to verify if all references to the actor have been destroyed, only `initialize` provides mutable access to the actor. 48 | - This update should be the last major refactor of Fluxion. While there may be a few breaking changes until 1.0.0, unless there is a massive usability issue, then the Fluxion API will mostly stay where it is. 49 | - Fluxion is several orders of magnitude faster. 50 | - This is due to the abstraction over raw function calls provided by [Slacktor](https://github.com/peperworx/slacktor). 51 | - Fluxion is much easier to use. See the `simple` example for basic and heavily commented usage. 52 | - Fluxion still supports `no_std` environments, and still requires `alloc` and `core`. -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.22.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.3" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "async-trait" 31 | version = "0.1.81" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" 34 | dependencies = [ 35 | "proc-macro2", 36 | "quote", 37 | "syn", 38 | ] 39 | 40 | [[package]] 41 | name = "autocfg" 42 | version = "1.3.0" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 45 | 46 | [[package]] 47 | name = "backtrace" 48 | version = "0.3.73" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" 51 | dependencies = [ 52 | "addr2line", 53 | "cc", 54 | "cfg-if", 55 | "libc", 56 | "miniz_oxide", 57 | "object", 58 | "rustc-demangle", 59 | ] 60 | 61 | [[package]] 62 | name = "bincode" 63 | version = "1.3.3" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 66 | dependencies = [ 67 | "serde", 68 | ] 69 | 70 | [[package]] 71 | name = "bitflags" 72 | version = "2.6.0" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 75 | 76 | [[package]] 77 | name = "byteorder" 78 | version = "1.5.0" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 81 | 82 | [[package]] 83 | name = "bytes" 84 | version = "1.7.1" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" 87 | 88 | [[package]] 89 | name = "cc" 90 | version = "1.1.15" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" 93 | dependencies = [ 94 | "shlex", 95 | ] 96 | 97 | [[package]] 98 | name = "cfg-if" 99 | version = "1.0.0" 100 | source = "registry+https://github.com/rust-lang/crates.io-index" 101 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 102 | 103 | [[package]] 104 | name = "const_format" 105 | version = "0.2.32" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" 108 | dependencies = [ 109 | "const_format_proc_macros", 110 | ] 111 | 112 | [[package]] 113 | name = "const_format_proc_macros" 114 | version = "0.2.32" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" 117 | dependencies = [ 118 | "proc-macro2", 119 | "quote", 120 | "unicode-xid", 121 | ] 122 | 123 | [[package]] 124 | name = "cordyceps" 125 | version = "0.3.2" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "ec10f0a762d93c4498d2e97a333805cb6250d60bead623f71d8034f9a4152ba3" 128 | dependencies = [ 129 | "loom 0.5.6", 130 | "tracing", 131 | ] 132 | 133 | [[package]] 134 | name = "crossbeam-deque" 135 | version = "0.8.5" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" 138 | dependencies = [ 139 | "crossbeam-epoch", 140 | "crossbeam-utils", 141 | ] 142 | 143 | [[package]] 144 | name = "crossbeam-epoch" 145 | version = "0.9.18" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" 148 | dependencies = [ 149 | "crossbeam-utils", 150 | ] 151 | 152 | [[package]] 153 | name = "crossbeam-utils" 154 | version = "0.8.20" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" 157 | 158 | [[package]] 159 | name = "either" 160 | version = "1.13.0" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 163 | 164 | [[package]] 165 | name = "ensure_fluxion_no_std" 166 | version = "0.1.0" 167 | dependencies = [ 168 | "fluxion", 169 | ] 170 | 171 | [[package]] 172 | name = "fluxion" 173 | version = "0.10.5" 174 | dependencies = [ 175 | "async-trait", 176 | "bincode", 177 | "const_format", 178 | "fluxion_macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 179 | "maitake-sync", 180 | "rand", 181 | "rayon", 182 | "serde", 183 | "slacktor", 184 | "tokio", 185 | ] 186 | 187 | [[package]] 188 | name = "fluxion_macro" 189 | version = "0.1.0" 190 | dependencies = [ 191 | "proc-macro2", 192 | "quote", 193 | "syn", 194 | ] 195 | 196 | [[package]] 197 | name = "fluxion_macro" 198 | version = "0.1.0" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "18715016f93ae7acb2d8c8ee3df0a0b780ec9c8d074d1e6322a5b1dea681363e" 201 | dependencies = [ 202 | "proc-macro2", 203 | "quote", 204 | "syn", 205 | ] 206 | 207 | [[package]] 208 | name = "generator" 209 | version = "0.7.5" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" 212 | dependencies = [ 213 | "cc", 214 | "libc", 215 | "log", 216 | "rustversion", 217 | "windows 0.48.0", 218 | ] 219 | 220 | [[package]] 221 | name = "generator" 222 | version = "0.8.2" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | checksum = "979f00864edc7516466d6b3157706e06c032f22715700ddd878228a91d02bc56" 225 | dependencies = [ 226 | "cfg-if", 227 | "libc", 228 | "log", 229 | "rustversion", 230 | "windows 0.58.0", 231 | ] 232 | 233 | [[package]] 234 | name = "getrandom" 235 | version = "0.2.15" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 238 | dependencies = [ 239 | "cfg-if", 240 | "libc", 241 | "wasi", 242 | ] 243 | 244 | [[package]] 245 | name = "gimli" 246 | version = "0.29.0" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" 249 | 250 | [[package]] 251 | name = "hermit-abi" 252 | version = "0.3.9" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 255 | 256 | [[package]] 257 | name = "lazy_static" 258 | version = "1.5.0" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 261 | 262 | [[package]] 263 | name = "libc" 264 | version = "0.2.158" 265 | source = "registry+https://github.com/rust-lang/crates.io-index" 266 | checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" 267 | 268 | [[package]] 269 | name = "lock_api" 270 | version = "0.4.12" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 273 | dependencies = [ 274 | "autocfg", 275 | "scopeguard", 276 | ] 277 | 278 | [[package]] 279 | name = "log" 280 | version = "0.4.22" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 283 | 284 | [[package]] 285 | name = "loom" 286 | version = "0.5.6" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" 289 | dependencies = [ 290 | "cfg-if", 291 | "generator 0.7.5", 292 | "scoped-tls", 293 | "tracing", 294 | "tracing-subscriber", 295 | ] 296 | 297 | [[package]] 298 | name = "loom" 299 | version = "0.7.2" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" 302 | dependencies = [ 303 | "cfg-if", 304 | "generator 0.8.2", 305 | "scoped-tls", 306 | "tracing", 307 | "tracing-subscriber", 308 | ] 309 | 310 | [[package]] 311 | name = "maitake-sync" 312 | version = "0.1.2" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "6816ab14147f80234c675b80ed6dc4f440d8a1cefc158e766067aedb84c0bcd5" 315 | dependencies = [ 316 | "cordyceps", 317 | "loom 0.7.2", 318 | "mycelium-bitfield", 319 | "pin-project", 320 | "portable-atomic", 321 | ] 322 | 323 | [[package]] 324 | name = "matchers" 325 | version = "0.1.0" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 328 | dependencies = [ 329 | "regex-automata 0.1.10", 330 | ] 331 | 332 | [[package]] 333 | name = "memchr" 334 | version = "2.7.4" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 337 | 338 | [[package]] 339 | name = "miniz_oxide" 340 | version = "0.7.4" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" 343 | dependencies = [ 344 | "adler", 345 | ] 346 | 347 | [[package]] 348 | name = "mio" 349 | version = "1.0.2" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" 352 | dependencies = [ 353 | "hermit-abi", 354 | "libc", 355 | "wasi", 356 | "windows-sys", 357 | ] 358 | 359 | [[package]] 360 | name = "mycelium-bitfield" 361 | version = "0.1.5" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" 364 | 365 | [[package]] 366 | name = "nu-ansi-term" 367 | version = "0.46.0" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 370 | dependencies = [ 371 | "overload", 372 | "winapi", 373 | ] 374 | 375 | [[package]] 376 | name = "object" 377 | version = "0.36.3" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" 380 | dependencies = [ 381 | "memchr", 382 | ] 383 | 384 | [[package]] 385 | name = "once_cell" 386 | version = "1.19.0" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 389 | 390 | [[package]] 391 | name = "overload" 392 | version = "0.1.1" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 395 | 396 | [[package]] 397 | name = "parking_lot" 398 | version = "0.12.3" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 401 | dependencies = [ 402 | "lock_api", 403 | "parking_lot_core", 404 | ] 405 | 406 | [[package]] 407 | name = "parking_lot_core" 408 | version = "0.9.10" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 411 | dependencies = [ 412 | "cfg-if", 413 | "libc", 414 | "redox_syscall", 415 | "smallvec", 416 | "windows-targets 0.52.6", 417 | ] 418 | 419 | [[package]] 420 | name = "pin-project" 421 | version = "1.1.5" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" 424 | dependencies = [ 425 | "pin-project-internal", 426 | ] 427 | 428 | [[package]] 429 | name = "pin-project-internal" 430 | version = "1.1.5" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" 433 | dependencies = [ 434 | "proc-macro2", 435 | "quote", 436 | "syn", 437 | ] 438 | 439 | [[package]] 440 | name = "pin-project-lite" 441 | version = "0.2.14" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 444 | 445 | [[package]] 446 | name = "portable-atomic" 447 | version = "1.7.0" 448 | source = "registry+https://github.com/rust-lang/crates.io-index" 449 | checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" 450 | 451 | [[package]] 452 | name = "ppv-lite86" 453 | version = "0.2.20" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 456 | dependencies = [ 457 | "zerocopy", 458 | ] 459 | 460 | [[package]] 461 | name = "proc-macro2" 462 | version = "1.0.86" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 465 | dependencies = [ 466 | "unicode-ident", 467 | ] 468 | 469 | [[package]] 470 | name = "quote" 471 | version = "1.0.37" 472 | source = "registry+https://github.com/rust-lang/crates.io-index" 473 | checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" 474 | dependencies = [ 475 | "proc-macro2", 476 | ] 477 | 478 | [[package]] 479 | name = "rand" 480 | version = "0.8.5" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 483 | dependencies = [ 484 | "libc", 485 | "rand_chacha", 486 | "rand_core", 487 | ] 488 | 489 | [[package]] 490 | name = "rand_chacha" 491 | version = "0.3.1" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 494 | dependencies = [ 495 | "ppv-lite86", 496 | "rand_core", 497 | ] 498 | 499 | [[package]] 500 | name = "rand_core" 501 | version = "0.6.4" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 504 | dependencies = [ 505 | "getrandom", 506 | ] 507 | 508 | [[package]] 509 | name = "rayon" 510 | version = "1.10.0" 511 | source = "registry+https://github.com/rust-lang/crates.io-index" 512 | checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" 513 | dependencies = [ 514 | "either", 515 | "rayon-core", 516 | ] 517 | 518 | [[package]] 519 | name = "rayon-core" 520 | version = "1.12.1" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" 523 | dependencies = [ 524 | "crossbeam-deque", 525 | "crossbeam-utils", 526 | ] 527 | 528 | [[package]] 529 | name = "redox_syscall" 530 | version = "0.5.3" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" 533 | dependencies = [ 534 | "bitflags", 535 | ] 536 | 537 | [[package]] 538 | name = "regex" 539 | version = "1.10.6" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" 542 | dependencies = [ 543 | "aho-corasick", 544 | "memchr", 545 | "regex-automata 0.4.7", 546 | "regex-syntax 0.8.4", 547 | ] 548 | 549 | [[package]] 550 | name = "regex-automata" 551 | version = "0.1.10" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 554 | dependencies = [ 555 | "regex-syntax 0.6.29", 556 | ] 557 | 558 | [[package]] 559 | name = "regex-automata" 560 | version = "0.4.7" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" 563 | dependencies = [ 564 | "aho-corasick", 565 | "memchr", 566 | "regex-syntax 0.8.4", 567 | ] 568 | 569 | [[package]] 570 | name = "regex-syntax" 571 | version = "0.6.29" 572 | source = "registry+https://github.com/rust-lang/crates.io-index" 573 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 574 | 575 | [[package]] 576 | name = "regex-syntax" 577 | version = "0.8.4" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" 580 | 581 | [[package]] 582 | name = "rustc-demangle" 583 | version = "0.1.24" 584 | source = "registry+https://github.com/rust-lang/crates.io-index" 585 | checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 586 | 587 | [[package]] 588 | name = "rustversion" 589 | version = "1.0.17" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" 592 | 593 | [[package]] 594 | name = "scoped-tls" 595 | version = "1.0.1" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 598 | 599 | [[package]] 600 | name = "scopeguard" 601 | version = "1.2.0" 602 | source = "registry+https://github.com/rust-lang/crates.io-index" 603 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 604 | 605 | [[package]] 606 | name = "serde" 607 | version = "1.0.209" 608 | source = "registry+https://github.com/rust-lang/crates.io-index" 609 | checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" 610 | dependencies = [ 611 | "serde_derive", 612 | ] 613 | 614 | [[package]] 615 | name = "serde_derive" 616 | version = "1.0.209" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" 619 | dependencies = [ 620 | "proc-macro2", 621 | "quote", 622 | "syn", 623 | ] 624 | 625 | [[package]] 626 | name = "sharded-slab" 627 | version = "0.1.7" 628 | source = "registry+https://github.com/rust-lang/crates.io-index" 629 | checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 630 | dependencies = [ 631 | "lazy_static", 632 | ] 633 | 634 | [[package]] 635 | name = "shlex" 636 | version = "1.3.0" 637 | source = "registry+https://github.com/rust-lang/crates.io-index" 638 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 639 | 640 | [[package]] 641 | name = "signal-hook-registry" 642 | version = "1.4.2" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 645 | dependencies = [ 646 | "libc", 647 | ] 648 | 649 | [[package]] 650 | name = "slab" 651 | version = "0.4.9" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 654 | dependencies = [ 655 | "autocfg", 656 | ] 657 | 658 | [[package]] 659 | name = "slacktor" 660 | version = "0.3.0" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "85049d774eb6404c978ac5235117bde9a3ba12807c83f0aafc43ce5bbe54bd99" 663 | dependencies = [ 664 | "slab", 665 | ] 666 | 667 | [[package]] 668 | name = "smallvec" 669 | version = "1.13.2" 670 | source = "registry+https://github.com/rust-lang/crates.io-index" 671 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 672 | 673 | [[package]] 674 | name = "socket2" 675 | version = "0.5.7" 676 | source = "registry+https://github.com/rust-lang/crates.io-index" 677 | checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" 678 | dependencies = [ 679 | "libc", 680 | "windows-sys", 681 | ] 682 | 683 | [[package]] 684 | name = "syn" 685 | version = "2.0.76" 686 | source = "registry+https://github.com/rust-lang/crates.io-index" 687 | checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" 688 | dependencies = [ 689 | "proc-macro2", 690 | "quote", 691 | "unicode-ident", 692 | ] 693 | 694 | [[package]] 695 | name = "thread_local" 696 | version = "1.1.8" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" 699 | dependencies = [ 700 | "cfg-if", 701 | "once_cell", 702 | ] 703 | 704 | [[package]] 705 | name = "tokio" 706 | version = "1.39.3" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" 709 | dependencies = [ 710 | "backtrace", 711 | "bytes", 712 | "libc", 713 | "mio", 714 | "parking_lot", 715 | "pin-project-lite", 716 | "signal-hook-registry", 717 | "socket2", 718 | "tokio-macros", 719 | "windows-sys", 720 | ] 721 | 722 | [[package]] 723 | name = "tokio-macros" 724 | version = "2.4.0" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" 727 | dependencies = [ 728 | "proc-macro2", 729 | "quote", 730 | "syn", 731 | ] 732 | 733 | [[package]] 734 | name = "tracing" 735 | version = "0.1.40" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 738 | dependencies = [ 739 | "pin-project-lite", 740 | "tracing-attributes", 741 | "tracing-core", 742 | ] 743 | 744 | [[package]] 745 | name = "tracing-attributes" 746 | version = "0.1.27" 747 | source = "registry+https://github.com/rust-lang/crates.io-index" 748 | checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" 749 | dependencies = [ 750 | "proc-macro2", 751 | "quote", 752 | "syn", 753 | ] 754 | 755 | [[package]] 756 | name = "tracing-core" 757 | version = "0.1.32" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 760 | dependencies = [ 761 | "once_cell", 762 | "valuable", 763 | ] 764 | 765 | [[package]] 766 | name = "tracing-log" 767 | version = "0.2.0" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" 770 | dependencies = [ 771 | "log", 772 | "once_cell", 773 | "tracing-core", 774 | ] 775 | 776 | [[package]] 777 | name = "tracing-subscriber" 778 | version = "0.3.18" 779 | source = "registry+https://github.com/rust-lang/crates.io-index" 780 | checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" 781 | dependencies = [ 782 | "matchers", 783 | "nu-ansi-term", 784 | "once_cell", 785 | "regex", 786 | "sharded-slab", 787 | "smallvec", 788 | "thread_local", 789 | "tracing", 790 | "tracing-core", 791 | "tracing-log", 792 | ] 793 | 794 | [[package]] 795 | name = "unicode-ident" 796 | version = "1.0.12" 797 | source = "registry+https://github.com/rust-lang/crates.io-index" 798 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 799 | 800 | [[package]] 801 | name = "unicode-xid" 802 | version = "0.2.5" 803 | source = "registry+https://github.com/rust-lang/crates.io-index" 804 | checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" 805 | 806 | [[package]] 807 | name = "valuable" 808 | version = "0.1.0" 809 | source = "registry+https://github.com/rust-lang/crates.io-index" 810 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 811 | 812 | [[package]] 813 | name = "wasi" 814 | version = "0.11.0+wasi-snapshot-preview1" 815 | source = "registry+https://github.com/rust-lang/crates.io-index" 816 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 817 | 818 | [[package]] 819 | name = "winapi" 820 | version = "0.3.9" 821 | source = "registry+https://github.com/rust-lang/crates.io-index" 822 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 823 | dependencies = [ 824 | "winapi-i686-pc-windows-gnu", 825 | "winapi-x86_64-pc-windows-gnu", 826 | ] 827 | 828 | [[package]] 829 | name = "winapi-i686-pc-windows-gnu" 830 | version = "0.4.0" 831 | source = "registry+https://github.com/rust-lang/crates.io-index" 832 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 833 | 834 | [[package]] 835 | name = "winapi-x86_64-pc-windows-gnu" 836 | version = "0.4.0" 837 | source = "registry+https://github.com/rust-lang/crates.io-index" 838 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 839 | 840 | [[package]] 841 | name = "windows" 842 | version = "0.48.0" 843 | source = "registry+https://github.com/rust-lang/crates.io-index" 844 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 845 | dependencies = [ 846 | "windows-targets 0.48.5", 847 | ] 848 | 849 | [[package]] 850 | name = "windows" 851 | version = "0.58.0" 852 | source = "registry+https://github.com/rust-lang/crates.io-index" 853 | checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" 854 | dependencies = [ 855 | "windows-core", 856 | "windows-targets 0.52.6", 857 | ] 858 | 859 | [[package]] 860 | name = "windows-core" 861 | version = "0.58.0" 862 | source = "registry+https://github.com/rust-lang/crates.io-index" 863 | checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" 864 | dependencies = [ 865 | "windows-implement", 866 | "windows-interface", 867 | "windows-result", 868 | "windows-strings", 869 | "windows-targets 0.52.6", 870 | ] 871 | 872 | [[package]] 873 | name = "windows-implement" 874 | version = "0.58.0" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" 877 | dependencies = [ 878 | "proc-macro2", 879 | "quote", 880 | "syn", 881 | ] 882 | 883 | [[package]] 884 | name = "windows-interface" 885 | version = "0.58.0" 886 | source = "registry+https://github.com/rust-lang/crates.io-index" 887 | checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" 888 | dependencies = [ 889 | "proc-macro2", 890 | "quote", 891 | "syn", 892 | ] 893 | 894 | [[package]] 895 | name = "windows-result" 896 | version = "0.2.0" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" 899 | dependencies = [ 900 | "windows-targets 0.52.6", 901 | ] 902 | 903 | [[package]] 904 | name = "windows-strings" 905 | version = "0.1.0" 906 | source = "registry+https://github.com/rust-lang/crates.io-index" 907 | checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" 908 | dependencies = [ 909 | "windows-result", 910 | "windows-targets 0.52.6", 911 | ] 912 | 913 | [[package]] 914 | name = "windows-sys" 915 | version = "0.52.0" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 918 | dependencies = [ 919 | "windows-targets 0.52.6", 920 | ] 921 | 922 | [[package]] 923 | name = "windows-targets" 924 | version = "0.48.5" 925 | source = "registry+https://github.com/rust-lang/crates.io-index" 926 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 927 | dependencies = [ 928 | "windows_aarch64_gnullvm 0.48.5", 929 | "windows_aarch64_msvc 0.48.5", 930 | "windows_i686_gnu 0.48.5", 931 | "windows_i686_msvc 0.48.5", 932 | "windows_x86_64_gnu 0.48.5", 933 | "windows_x86_64_gnullvm 0.48.5", 934 | "windows_x86_64_msvc 0.48.5", 935 | ] 936 | 937 | [[package]] 938 | name = "windows-targets" 939 | version = "0.52.6" 940 | source = "registry+https://github.com/rust-lang/crates.io-index" 941 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 942 | dependencies = [ 943 | "windows_aarch64_gnullvm 0.52.6", 944 | "windows_aarch64_msvc 0.52.6", 945 | "windows_i686_gnu 0.52.6", 946 | "windows_i686_gnullvm", 947 | "windows_i686_msvc 0.52.6", 948 | "windows_x86_64_gnu 0.52.6", 949 | "windows_x86_64_gnullvm 0.52.6", 950 | "windows_x86_64_msvc 0.52.6", 951 | ] 952 | 953 | [[package]] 954 | name = "windows_aarch64_gnullvm" 955 | version = "0.48.5" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 958 | 959 | [[package]] 960 | name = "windows_aarch64_gnullvm" 961 | version = "0.52.6" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 964 | 965 | [[package]] 966 | name = "windows_aarch64_msvc" 967 | version = "0.48.5" 968 | source = "registry+https://github.com/rust-lang/crates.io-index" 969 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 970 | 971 | [[package]] 972 | name = "windows_aarch64_msvc" 973 | version = "0.52.6" 974 | source = "registry+https://github.com/rust-lang/crates.io-index" 975 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 976 | 977 | [[package]] 978 | name = "windows_i686_gnu" 979 | version = "0.48.5" 980 | source = "registry+https://github.com/rust-lang/crates.io-index" 981 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 982 | 983 | [[package]] 984 | name = "windows_i686_gnu" 985 | version = "0.52.6" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 988 | 989 | [[package]] 990 | name = "windows_i686_gnullvm" 991 | version = "0.52.6" 992 | source = "registry+https://github.com/rust-lang/crates.io-index" 993 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 994 | 995 | [[package]] 996 | name = "windows_i686_msvc" 997 | version = "0.48.5" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1000 | 1001 | [[package]] 1002 | name = "windows_i686_msvc" 1003 | version = "0.52.6" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1006 | 1007 | [[package]] 1008 | name = "windows_x86_64_gnu" 1009 | version = "0.48.5" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1012 | 1013 | [[package]] 1014 | name = "windows_x86_64_gnu" 1015 | version = "0.52.6" 1016 | source = "registry+https://github.com/rust-lang/crates.io-index" 1017 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1018 | 1019 | [[package]] 1020 | name = "windows_x86_64_gnullvm" 1021 | version = "0.48.5" 1022 | source = "registry+https://github.com/rust-lang/crates.io-index" 1023 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1024 | 1025 | [[package]] 1026 | name = "windows_x86_64_gnullvm" 1027 | version = "0.52.6" 1028 | source = "registry+https://github.com/rust-lang/crates.io-index" 1029 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1030 | 1031 | [[package]] 1032 | name = "windows_x86_64_msvc" 1033 | version = "0.48.5" 1034 | source = "registry+https://github.com/rust-lang/crates.io-index" 1035 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1036 | 1037 | [[package]] 1038 | name = "windows_x86_64_msvc" 1039 | version = "0.52.6" 1040 | source = "registry+https://github.com/rust-lang/crates.io-index" 1041 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1042 | 1043 | [[package]] 1044 | name = "zerocopy" 1045 | version = "0.7.35" 1046 | source = "registry+https://github.com/rust-lang/crates.io-index" 1047 | checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 1048 | dependencies = [ 1049 | "byteorder", 1050 | "zerocopy-derive", 1051 | ] 1052 | 1053 | [[package]] 1054 | name = "zerocopy-derive" 1055 | version = "0.7.35" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 1058 | dependencies = [ 1059 | "proc-macro2", 1060 | "quote", 1061 | "syn", 1062 | ] 1063 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = ["fluxion", "ensure_no_std", "fluxion_macro"] 4 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Peperworx 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 |
2 | 3 | Fluxion 4 | 5 | [![crates.io](https://img.shields.io/crates/l/fluxion?style=for-the-badge)](https://crates.io/crates/fluxion) 6 | [![crates.io](https://img.shields.io/crates/v/fluxion?style=for-the-badge)](https://crates.io/crates/fluxion) 7 | [![docs.rs](https://img.shields.io/docsrs/fluxion?style=for-the-badge)](https://docs.rs/fluxion) 8 | 9 | Distributed actor framework written in Rust. 10 |
11 | 12 | 13 | # About 14 | 15 | Fluxion is an actor framework designed with distributed systems in mind, namely sending messages not just between actors, but also between systems. 16 | 17 | ## Why Fluxion? 18 | 19 | Fluxion is designed for a very specific usecase: creating applications that require extremely flexible plugin solutions and communication between different running instances. If you do not need any of the specific features provided by Fluxion, you are probably best off using a different actor system. Internally, Fluxion is based upon [Slacktor](https://github.com/peperworx/slacktor), which provides a core actor framework and high-performance messaging solution. Slacktor was purpose built for Fluxion, and is provided separately for higher-performance usecases, as well as those that do not need Fluxion's additional features. 20 | 21 | ## Core Features 22 | 23 | Fluxion embraces a few core features, and tries to keep an API that is as as simple and extensible as possible. 24 | 25 | ### No-Std Support 26 | 27 | Fluxion and its dependencies only depend on `core` and `alloc`. This means that Fluxion can be used in `no-std` environments, as long as an allocator is available. 28 | 29 | ### Executor Agnosticism 30 | 31 | Fluxion is structured such that it never needs to spawn any tasks. This means that Fluxion does not need to access any specific executor library and is completely executor agnostic with no boilerplate required. You can use Tokio, async_std, Smol, or even write your own executor and Fluxion will not care. In the provided examples, however, we do use Tokio, as it is the most popular executor. 32 | 33 | ### Foreign Messages 34 | 35 | Fluxion's core feature is being able to send messages between systems, and is conditional on the `foreign` feature. Fluxion accomplishes this by allowing the user to define a "delegate" that responds to requests for specific foreign actors. The delegate returns an implementor of a trait that enables sending messages of a specific type. If the `serde` feature is enabled, then messages will be required to implement serialization functionality to be treated as foreign messages. 36 | 37 | ## Getting Started 38 | 39 | The best way to get started right now is to take a look at the `simple` example. It contains the most bare bones possible example for using Fluxion as an actor system with no special features. For more advanced usage, take a look at [the book](https://fluxion.peperworx.com/book/). 40 | 41 | ## License 42 | 43 | Fluxion is Dual-Licensed under the Apache 2.0 and MIT licenses. -------------------------------------------------------------------------------- /ensure_no_std/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-none" -------------------------------------------------------------------------------- /ensure_no_std/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /ensure_no_std/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aho-corasick" 7 | version = "1.1.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 10 | dependencies = [ 11 | "memchr", 12 | ] 13 | 14 | [[package]] 15 | name = "async-trait" 16 | version = "0.1.80" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" 19 | dependencies = [ 20 | "proc-macro2", 21 | "quote", 22 | "syn", 23 | ] 24 | 25 | [[package]] 26 | name = "autocfg" 27 | version = "1.3.0" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 30 | 31 | [[package]] 32 | name = "cc" 33 | version = "1.0.84" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856" 36 | dependencies = [ 37 | "libc", 38 | ] 39 | 40 | [[package]] 41 | name = "cfg-if" 42 | version = "1.0.0" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 45 | 46 | [[package]] 47 | name = "cordyceps" 48 | version = "0.3.2" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "ec10f0a762d93c4498d2e97a333805cb6250d60bead623f71d8034f9a4152ba3" 51 | dependencies = [ 52 | "loom 0.5.6", 53 | "tracing", 54 | ] 55 | 56 | [[package]] 57 | name = "ensure_fluxion_no_std" 58 | version = "0.1.0" 59 | dependencies = [ 60 | "fluxion", 61 | ] 62 | 63 | [[package]] 64 | name = "fluxion" 65 | version = "0.9.0" 66 | dependencies = [ 67 | "async-trait", 68 | "maitake-sync", 69 | "slacktor", 70 | ] 71 | 72 | [[package]] 73 | name = "generator" 74 | version = "0.7.5" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" 77 | dependencies = [ 78 | "cc", 79 | "libc", 80 | "log", 81 | "rustversion", 82 | "windows", 83 | ] 84 | 85 | [[package]] 86 | name = "lazy_static" 87 | version = "1.4.0" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 90 | 91 | [[package]] 92 | name = "libc" 93 | version = "0.2.150" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" 96 | 97 | [[package]] 98 | name = "log" 99 | version = "0.4.20" 100 | source = "registry+https://github.com/rust-lang/crates.io-index" 101 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 102 | 103 | [[package]] 104 | name = "loom" 105 | version = "0.5.6" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" 108 | dependencies = [ 109 | "cfg-if", 110 | "generator", 111 | "scoped-tls", 112 | "tracing", 113 | "tracing-subscriber", 114 | ] 115 | 116 | [[package]] 117 | name = "loom" 118 | version = "0.7.1" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | checksum = "7e045d70ddfbc984eacfa964ded019534e8f6cbf36f6410aee0ed5cefa5a9175" 121 | dependencies = [ 122 | "cfg-if", 123 | "generator", 124 | "scoped-tls", 125 | "tracing", 126 | "tracing-subscriber", 127 | ] 128 | 129 | [[package]] 130 | name = "maitake-sync" 131 | version = "0.1.1" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "27ff6bc892d1b738a544d20599bce0a1446454edaa0338020a7d1b046d78a80f" 134 | dependencies = [ 135 | "cordyceps", 136 | "loom 0.7.1", 137 | "mycelium-bitfield", 138 | "pin-project", 139 | "portable-atomic", 140 | ] 141 | 142 | [[package]] 143 | name = "matchers" 144 | version = "0.1.0" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 147 | dependencies = [ 148 | "regex-automata 0.1.10", 149 | ] 150 | 151 | [[package]] 152 | name = "memchr" 153 | version = "2.6.4" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 156 | 157 | [[package]] 158 | name = "mycelium-bitfield" 159 | version = "0.1.3" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "1178a37e39d26b8c3bbd3197460a59939ca2b8fe002ea92c1d9a1ba87c203d85" 162 | 163 | [[package]] 164 | name = "nu-ansi-term" 165 | version = "0.46.0" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 168 | dependencies = [ 169 | "overload", 170 | "winapi", 171 | ] 172 | 173 | [[package]] 174 | name = "once_cell" 175 | version = "1.18.0" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 178 | 179 | [[package]] 180 | name = "overload" 181 | version = "0.1.1" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 184 | 185 | [[package]] 186 | name = "pin-project" 187 | version = "1.1.3" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" 190 | dependencies = [ 191 | "pin-project-internal", 192 | ] 193 | 194 | [[package]] 195 | name = "pin-project-internal" 196 | version = "1.1.3" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" 199 | dependencies = [ 200 | "proc-macro2", 201 | "quote", 202 | "syn", 203 | ] 204 | 205 | [[package]] 206 | name = "pin-project-lite" 207 | version = "0.2.13" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 210 | 211 | [[package]] 212 | name = "portable-atomic" 213 | version = "1.5.1" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" 216 | 217 | [[package]] 218 | name = "proc-macro2" 219 | version = "1.0.82" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" 222 | dependencies = [ 223 | "unicode-ident", 224 | ] 225 | 226 | [[package]] 227 | name = "quote" 228 | version = "1.0.36" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 231 | dependencies = [ 232 | "proc-macro2", 233 | ] 234 | 235 | [[package]] 236 | name = "regex" 237 | version = "1.10.2" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 240 | dependencies = [ 241 | "aho-corasick", 242 | "memchr", 243 | "regex-automata 0.4.3", 244 | "regex-syntax 0.8.2", 245 | ] 246 | 247 | [[package]] 248 | name = "regex-automata" 249 | version = "0.1.10" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 252 | dependencies = [ 253 | "regex-syntax 0.6.29", 254 | ] 255 | 256 | [[package]] 257 | name = "regex-automata" 258 | version = "0.4.3" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 261 | dependencies = [ 262 | "aho-corasick", 263 | "memchr", 264 | "regex-syntax 0.8.2", 265 | ] 266 | 267 | [[package]] 268 | name = "regex-syntax" 269 | version = "0.6.29" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 272 | 273 | [[package]] 274 | name = "regex-syntax" 275 | version = "0.8.2" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 278 | 279 | [[package]] 280 | name = "rustversion" 281 | version = "1.0.14" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 284 | 285 | [[package]] 286 | name = "scoped-tls" 287 | version = "1.0.1" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 290 | 291 | [[package]] 292 | name = "sharded-slab" 293 | version = "0.1.7" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 296 | dependencies = [ 297 | "lazy_static", 298 | ] 299 | 300 | [[package]] 301 | name = "slab" 302 | version = "0.4.9" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 305 | dependencies = [ 306 | "autocfg", 307 | ] 308 | 309 | [[package]] 310 | name = "slacktor" 311 | version = "0.3.0" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "85049d774eb6404c978ac5235117bde9a3ba12807c83f0aafc43ce5bbe54bd99" 314 | dependencies = [ 315 | "slab", 316 | ] 317 | 318 | [[package]] 319 | name = "smallvec" 320 | version = "1.11.2" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" 323 | 324 | [[package]] 325 | name = "syn" 326 | version = "2.0.61" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" 329 | dependencies = [ 330 | "proc-macro2", 331 | "quote", 332 | "unicode-ident", 333 | ] 334 | 335 | [[package]] 336 | name = "thread_local" 337 | version = "1.1.7" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" 340 | dependencies = [ 341 | "cfg-if", 342 | "once_cell", 343 | ] 344 | 345 | [[package]] 346 | name = "tracing" 347 | version = "0.1.40" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 350 | dependencies = [ 351 | "pin-project-lite", 352 | "tracing-attributes", 353 | "tracing-core", 354 | ] 355 | 356 | [[package]] 357 | name = "tracing-attributes" 358 | version = "0.1.27" 359 | source = "registry+https://github.com/rust-lang/crates.io-index" 360 | checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" 361 | dependencies = [ 362 | "proc-macro2", 363 | "quote", 364 | "syn", 365 | ] 366 | 367 | [[package]] 368 | name = "tracing-core" 369 | version = "0.1.32" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 372 | dependencies = [ 373 | "once_cell", 374 | "valuable", 375 | ] 376 | 377 | [[package]] 378 | name = "tracing-log" 379 | version = "0.2.0" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" 382 | dependencies = [ 383 | "log", 384 | "once_cell", 385 | "tracing-core", 386 | ] 387 | 388 | [[package]] 389 | name = "tracing-subscriber" 390 | version = "0.3.18" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" 393 | dependencies = [ 394 | "matchers", 395 | "nu-ansi-term", 396 | "once_cell", 397 | "regex", 398 | "sharded-slab", 399 | "smallvec", 400 | "thread_local", 401 | "tracing", 402 | "tracing-core", 403 | "tracing-log", 404 | ] 405 | 406 | [[package]] 407 | name = "unicode-ident" 408 | version = "1.0.12" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 411 | 412 | [[package]] 413 | name = "valuable" 414 | version = "0.1.0" 415 | source = "registry+https://github.com/rust-lang/crates.io-index" 416 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 417 | 418 | [[package]] 419 | name = "winapi" 420 | version = "0.3.9" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 423 | dependencies = [ 424 | "winapi-i686-pc-windows-gnu", 425 | "winapi-x86_64-pc-windows-gnu", 426 | ] 427 | 428 | [[package]] 429 | name = "winapi-i686-pc-windows-gnu" 430 | version = "0.4.0" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 433 | 434 | [[package]] 435 | name = "winapi-x86_64-pc-windows-gnu" 436 | version = "0.4.0" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 439 | 440 | [[package]] 441 | name = "windows" 442 | version = "0.48.0" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 445 | dependencies = [ 446 | "windows-targets", 447 | ] 448 | 449 | [[package]] 450 | name = "windows-targets" 451 | version = "0.48.5" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 454 | dependencies = [ 455 | "windows_aarch64_gnullvm", 456 | "windows_aarch64_msvc", 457 | "windows_i686_gnu", 458 | "windows_i686_msvc", 459 | "windows_x86_64_gnu", 460 | "windows_x86_64_gnullvm", 461 | "windows_x86_64_msvc", 462 | ] 463 | 464 | [[package]] 465 | name = "windows_aarch64_gnullvm" 466 | version = "0.48.5" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 469 | 470 | [[package]] 471 | name = "windows_aarch64_msvc" 472 | version = "0.48.5" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 475 | 476 | [[package]] 477 | name = "windows_i686_gnu" 478 | version = "0.48.5" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 481 | 482 | [[package]] 483 | name = "windows_i686_msvc" 484 | version = "0.48.5" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 487 | 488 | [[package]] 489 | name = "windows_x86_64_gnu" 490 | version = "0.48.5" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 493 | 494 | [[package]] 495 | name = "windows_x86_64_gnullvm" 496 | version = "0.48.5" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 499 | 500 | [[package]] 501 | name = "windows_x86_64_msvc" 502 | version = "0.48.5" 503 | source = "registry+https://github.com/rust-lang/crates.io-index" 504 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 505 | -------------------------------------------------------------------------------- /ensure_no_std/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ensure_fluxion_no_std" 3 | description = "If this package compiles, then Fluxion works in a no-std context." 4 | license = "MIT or Apache-2.0" 5 | repository = "https://github.com/peperworx/fluxion" 6 | keywords = [] 7 | categories = [] 8 | version = "0.1.0" 9 | edition = "2021" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | fluxion = { path = "../fluxion" } 15 | 16 | [profile.dev] 17 | panic = "abort" 18 | 19 | [profile.release] 20 | panic = "abort" -------------------------------------------------------------------------------- /ensure_no_std/README.md: -------------------------------------------------------------------------------- 1 | If this crate successfully builds, then Fluxion and its dependencies fully support no_std by default. 2 | 3 | To successfully build, this requires core to be built/installed for the target `x86_64-unknown-none`. 4 | 5 | This can be accomplished via the following command: 6 | ```sh 7 | rustup toolchain add x86_64-unknown-none 8 | ``` -------------------------------------------------------------------------------- /ensure_no_std/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use core::panic::PanicInfo; 5 | 6 | 7 | #[panic_handler] 8 | fn panic(_info: &PanicInfo) -> ! { 9 | loop {} 10 | } 11 | 12 | 13 | #[no_mangle] 14 | pub extern "C" fn _start() { 15 | loop { 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /fluxion/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.3" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "async-trait" 31 | version = "0.1.80" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" 34 | dependencies = [ 35 | "proc-macro2", 36 | "quote", 37 | "syn", 38 | ] 39 | 40 | [[package]] 41 | name = "autocfg" 42 | version = "1.2.0" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" 45 | 46 | [[package]] 47 | name = "backtrace" 48 | version = "0.3.71" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" 51 | dependencies = [ 52 | "addr2line", 53 | "cc", 54 | "cfg-if", 55 | "libc", 56 | "miniz_oxide", 57 | "object", 58 | "rustc-demangle", 59 | ] 60 | 61 | [[package]] 62 | name = "bitflags" 63 | version = "2.5.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" 66 | 67 | [[package]] 68 | name = "bytes" 69 | version = "1.6.0" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" 72 | 73 | [[package]] 74 | name = "cc" 75 | version = "1.0.94" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" 78 | 79 | [[package]] 80 | name = "cfg-if" 81 | version = "1.0.0" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 84 | 85 | [[package]] 86 | name = "cordyceps" 87 | version = "0.3.2" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "ec10f0a762d93c4498d2e97a333805cb6250d60bead623f71d8034f9a4152ba3" 90 | dependencies = [ 91 | "loom 0.5.6", 92 | "tracing", 93 | ] 94 | 95 | [[package]] 96 | name = "crossbeam-deque" 97 | version = "0.8.5" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" 100 | dependencies = [ 101 | "crossbeam-epoch", 102 | "crossbeam-utils", 103 | ] 104 | 105 | [[package]] 106 | name = "crossbeam-epoch" 107 | version = "0.9.18" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" 110 | dependencies = [ 111 | "crossbeam-utils", 112 | ] 113 | 114 | [[package]] 115 | name = "crossbeam-utils" 116 | version = "0.8.19" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" 119 | 120 | [[package]] 121 | name = "either" 122 | version = "1.11.0" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" 125 | 126 | [[package]] 127 | name = "fluxion" 128 | version = "0.9.0" 129 | dependencies = [ 130 | "async-trait", 131 | "maitake-sync", 132 | "rand", 133 | "rayon", 134 | "serde", 135 | "slacktor", 136 | "tokio", 137 | ] 138 | 139 | [[package]] 140 | name = "generator" 141 | version = "0.7.5" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" 144 | dependencies = [ 145 | "cc", 146 | "libc", 147 | "log", 148 | "rustversion", 149 | "windows", 150 | ] 151 | 152 | [[package]] 153 | name = "getrandom" 154 | version = "0.2.14" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" 157 | dependencies = [ 158 | "cfg-if", 159 | "libc", 160 | "wasi", 161 | ] 162 | 163 | [[package]] 164 | name = "gimli" 165 | version = "0.28.1" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" 168 | 169 | [[package]] 170 | name = "hermit-abi" 171 | version = "0.3.9" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 174 | 175 | [[package]] 176 | name = "lazy_static" 177 | version = "1.4.0" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 180 | 181 | [[package]] 182 | name = "libc" 183 | version = "0.2.153" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 186 | 187 | [[package]] 188 | name = "lock_api" 189 | version = "0.4.12" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 192 | dependencies = [ 193 | "autocfg", 194 | "scopeguard", 195 | ] 196 | 197 | [[package]] 198 | name = "log" 199 | version = "0.4.21" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" 202 | 203 | [[package]] 204 | name = "loom" 205 | version = "0.5.6" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" 208 | dependencies = [ 209 | "cfg-if", 210 | "generator", 211 | "scoped-tls", 212 | "tracing", 213 | "tracing-subscriber", 214 | ] 215 | 216 | [[package]] 217 | name = "loom" 218 | version = "0.7.1" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "7e045d70ddfbc984eacfa964ded019534e8f6cbf36f6410aee0ed5cefa5a9175" 221 | dependencies = [ 222 | "cfg-if", 223 | "generator", 224 | "scoped-tls", 225 | "tracing", 226 | "tracing-subscriber", 227 | ] 228 | 229 | [[package]] 230 | name = "maitake-sync" 231 | version = "0.1.1" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "27ff6bc892d1b738a544d20599bce0a1446454edaa0338020a7d1b046d78a80f" 234 | dependencies = [ 235 | "cordyceps", 236 | "loom 0.7.1", 237 | "mycelium-bitfield", 238 | "pin-project", 239 | "portable-atomic", 240 | ] 241 | 242 | [[package]] 243 | name = "matchers" 244 | version = "0.1.0" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 247 | dependencies = [ 248 | "regex-automata 0.1.10", 249 | ] 250 | 251 | [[package]] 252 | name = "memchr" 253 | version = "2.7.2" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" 256 | 257 | [[package]] 258 | name = "miniz_oxide" 259 | version = "0.7.2" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" 262 | dependencies = [ 263 | "adler", 264 | ] 265 | 266 | [[package]] 267 | name = "mio" 268 | version = "0.8.11" 269 | source = "registry+https://github.com/rust-lang/crates.io-index" 270 | checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" 271 | dependencies = [ 272 | "libc", 273 | "wasi", 274 | "windows-sys 0.48.0", 275 | ] 276 | 277 | [[package]] 278 | name = "mycelium-bitfield" 279 | version = "0.1.5" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" 282 | 283 | [[package]] 284 | name = "nu-ansi-term" 285 | version = "0.46.0" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 288 | dependencies = [ 289 | "overload", 290 | "winapi", 291 | ] 292 | 293 | [[package]] 294 | name = "num_cpus" 295 | version = "1.16.0" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 298 | dependencies = [ 299 | "hermit-abi", 300 | "libc", 301 | ] 302 | 303 | [[package]] 304 | name = "object" 305 | version = "0.32.2" 306 | source = "registry+https://github.com/rust-lang/crates.io-index" 307 | checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" 308 | dependencies = [ 309 | "memchr", 310 | ] 311 | 312 | [[package]] 313 | name = "once_cell" 314 | version = "1.19.0" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 317 | 318 | [[package]] 319 | name = "overload" 320 | version = "0.1.1" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 323 | 324 | [[package]] 325 | name = "parking_lot" 326 | version = "0.12.2" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" 329 | dependencies = [ 330 | "lock_api", 331 | "parking_lot_core", 332 | ] 333 | 334 | [[package]] 335 | name = "parking_lot_core" 336 | version = "0.9.10" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 339 | dependencies = [ 340 | "cfg-if", 341 | "libc", 342 | "redox_syscall", 343 | "smallvec", 344 | "windows-targets 0.52.5", 345 | ] 346 | 347 | [[package]] 348 | name = "pin-project" 349 | version = "1.1.5" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" 352 | dependencies = [ 353 | "pin-project-internal", 354 | ] 355 | 356 | [[package]] 357 | name = "pin-project-internal" 358 | version = "1.1.5" 359 | source = "registry+https://github.com/rust-lang/crates.io-index" 360 | checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" 361 | dependencies = [ 362 | "proc-macro2", 363 | "quote", 364 | "syn", 365 | ] 366 | 367 | [[package]] 368 | name = "pin-project-lite" 369 | version = "0.2.14" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 372 | 373 | [[package]] 374 | name = "portable-atomic" 375 | version = "1.6.0" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" 378 | 379 | [[package]] 380 | name = "ppv-lite86" 381 | version = "0.2.17" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 384 | 385 | [[package]] 386 | name = "proc-macro2" 387 | version = "1.0.81" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" 390 | dependencies = [ 391 | "unicode-ident", 392 | ] 393 | 394 | [[package]] 395 | name = "quote" 396 | version = "1.0.36" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 399 | dependencies = [ 400 | "proc-macro2", 401 | ] 402 | 403 | [[package]] 404 | name = "rand" 405 | version = "0.8.5" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 408 | dependencies = [ 409 | "libc", 410 | "rand_chacha", 411 | "rand_core", 412 | ] 413 | 414 | [[package]] 415 | name = "rand_chacha" 416 | version = "0.3.1" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 419 | dependencies = [ 420 | "ppv-lite86", 421 | "rand_core", 422 | ] 423 | 424 | [[package]] 425 | name = "rand_core" 426 | version = "0.6.4" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 429 | dependencies = [ 430 | "getrandom", 431 | ] 432 | 433 | [[package]] 434 | name = "rayon" 435 | version = "1.10.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" 438 | dependencies = [ 439 | "either", 440 | "rayon-core", 441 | ] 442 | 443 | [[package]] 444 | name = "rayon-core" 445 | version = "1.12.1" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" 448 | dependencies = [ 449 | "crossbeam-deque", 450 | "crossbeam-utils", 451 | ] 452 | 453 | [[package]] 454 | name = "redox_syscall" 455 | version = "0.5.1" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" 458 | dependencies = [ 459 | "bitflags", 460 | ] 461 | 462 | [[package]] 463 | name = "regex" 464 | version = "1.10.4" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" 467 | dependencies = [ 468 | "aho-corasick", 469 | "memchr", 470 | "regex-automata 0.4.6", 471 | "regex-syntax 0.8.3", 472 | ] 473 | 474 | [[package]] 475 | name = "regex-automata" 476 | version = "0.1.10" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 479 | dependencies = [ 480 | "regex-syntax 0.6.29", 481 | ] 482 | 483 | [[package]] 484 | name = "regex-automata" 485 | version = "0.4.6" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" 488 | dependencies = [ 489 | "aho-corasick", 490 | "memchr", 491 | "regex-syntax 0.8.3", 492 | ] 493 | 494 | [[package]] 495 | name = "regex-syntax" 496 | version = "0.6.29" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 499 | 500 | [[package]] 501 | name = "regex-syntax" 502 | version = "0.8.3" 503 | source = "registry+https://github.com/rust-lang/crates.io-index" 504 | checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" 505 | 506 | [[package]] 507 | name = "rustc-demangle" 508 | version = "0.1.23" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 511 | 512 | [[package]] 513 | name = "rustversion" 514 | version = "1.0.15" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" 517 | 518 | [[package]] 519 | name = "scoped-tls" 520 | version = "1.0.1" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 523 | 524 | [[package]] 525 | name = "scopeguard" 526 | version = "1.2.0" 527 | source = "registry+https://github.com/rust-lang/crates.io-index" 528 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 529 | 530 | [[package]] 531 | name = "serde" 532 | version = "1.0.198" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" 535 | dependencies = [ 536 | "serde_derive", 537 | ] 538 | 539 | [[package]] 540 | name = "serde_derive" 541 | version = "1.0.198" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" 544 | dependencies = [ 545 | "proc-macro2", 546 | "quote", 547 | "syn", 548 | ] 549 | 550 | [[package]] 551 | name = "sharded-slab" 552 | version = "0.1.7" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 555 | dependencies = [ 556 | "lazy_static", 557 | ] 558 | 559 | [[package]] 560 | name = "signal-hook-registry" 561 | version = "1.4.2" 562 | source = "registry+https://github.com/rust-lang/crates.io-index" 563 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 564 | dependencies = [ 565 | "libc", 566 | ] 567 | 568 | [[package]] 569 | name = "slab" 570 | version = "0.4.9" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 573 | dependencies = [ 574 | "autocfg", 575 | ] 576 | 577 | [[package]] 578 | name = "slacktor" 579 | version = "0.3.0" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "85049d774eb6404c978ac5235117bde9a3ba12807c83f0aafc43ce5bbe54bd99" 582 | dependencies = [ 583 | "slab", 584 | ] 585 | 586 | [[package]] 587 | name = "smallvec" 588 | version = "1.13.2" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 591 | 592 | [[package]] 593 | name = "socket2" 594 | version = "0.5.6" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" 597 | dependencies = [ 598 | "libc", 599 | "windows-sys 0.52.0", 600 | ] 601 | 602 | [[package]] 603 | name = "syn" 604 | version = "2.0.60" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" 607 | dependencies = [ 608 | "proc-macro2", 609 | "quote", 610 | "unicode-ident", 611 | ] 612 | 613 | [[package]] 614 | name = "thread_local" 615 | version = "1.1.8" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" 618 | dependencies = [ 619 | "cfg-if", 620 | "once_cell", 621 | ] 622 | 623 | [[package]] 624 | name = "tokio" 625 | version = "1.37.0" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" 628 | dependencies = [ 629 | "backtrace", 630 | "bytes", 631 | "libc", 632 | "mio", 633 | "num_cpus", 634 | "parking_lot", 635 | "pin-project-lite", 636 | "signal-hook-registry", 637 | "socket2", 638 | "tokio-macros", 639 | "windows-sys 0.48.0", 640 | ] 641 | 642 | [[package]] 643 | name = "tokio-macros" 644 | version = "2.2.0" 645 | source = "registry+https://github.com/rust-lang/crates.io-index" 646 | checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" 647 | dependencies = [ 648 | "proc-macro2", 649 | "quote", 650 | "syn", 651 | ] 652 | 653 | [[package]] 654 | name = "tracing" 655 | version = "0.1.40" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 658 | dependencies = [ 659 | "pin-project-lite", 660 | "tracing-attributes", 661 | "tracing-core", 662 | ] 663 | 664 | [[package]] 665 | name = "tracing-attributes" 666 | version = "0.1.27" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" 669 | dependencies = [ 670 | "proc-macro2", 671 | "quote", 672 | "syn", 673 | ] 674 | 675 | [[package]] 676 | name = "tracing-core" 677 | version = "0.1.32" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 680 | dependencies = [ 681 | "once_cell", 682 | "valuable", 683 | ] 684 | 685 | [[package]] 686 | name = "tracing-log" 687 | version = "0.2.0" 688 | source = "registry+https://github.com/rust-lang/crates.io-index" 689 | checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" 690 | dependencies = [ 691 | "log", 692 | "once_cell", 693 | "tracing-core", 694 | ] 695 | 696 | [[package]] 697 | name = "tracing-subscriber" 698 | version = "0.3.18" 699 | source = "registry+https://github.com/rust-lang/crates.io-index" 700 | checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" 701 | dependencies = [ 702 | "matchers", 703 | "nu-ansi-term", 704 | "once_cell", 705 | "regex", 706 | "sharded-slab", 707 | "smallvec", 708 | "thread_local", 709 | "tracing", 710 | "tracing-core", 711 | "tracing-log", 712 | ] 713 | 714 | [[package]] 715 | name = "unicode-ident" 716 | version = "1.0.12" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 719 | 720 | [[package]] 721 | name = "valuable" 722 | version = "0.1.0" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 725 | 726 | [[package]] 727 | name = "wasi" 728 | version = "0.11.0+wasi-snapshot-preview1" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 731 | 732 | [[package]] 733 | name = "winapi" 734 | version = "0.3.9" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 737 | dependencies = [ 738 | "winapi-i686-pc-windows-gnu", 739 | "winapi-x86_64-pc-windows-gnu", 740 | ] 741 | 742 | [[package]] 743 | name = "winapi-i686-pc-windows-gnu" 744 | version = "0.4.0" 745 | source = "registry+https://github.com/rust-lang/crates.io-index" 746 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 747 | 748 | [[package]] 749 | name = "winapi-x86_64-pc-windows-gnu" 750 | version = "0.4.0" 751 | source = "registry+https://github.com/rust-lang/crates.io-index" 752 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 753 | 754 | [[package]] 755 | name = "windows" 756 | version = "0.48.0" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 759 | dependencies = [ 760 | "windows-targets 0.48.5", 761 | ] 762 | 763 | [[package]] 764 | name = "windows-sys" 765 | version = "0.48.0" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 768 | dependencies = [ 769 | "windows-targets 0.48.5", 770 | ] 771 | 772 | [[package]] 773 | name = "windows-sys" 774 | version = "0.52.0" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 777 | dependencies = [ 778 | "windows-targets 0.52.5", 779 | ] 780 | 781 | [[package]] 782 | name = "windows-targets" 783 | version = "0.48.5" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 786 | dependencies = [ 787 | "windows_aarch64_gnullvm 0.48.5", 788 | "windows_aarch64_msvc 0.48.5", 789 | "windows_i686_gnu 0.48.5", 790 | "windows_i686_msvc 0.48.5", 791 | "windows_x86_64_gnu 0.48.5", 792 | "windows_x86_64_gnullvm 0.48.5", 793 | "windows_x86_64_msvc 0.48.5", 794 | ] 795 | 796 | [[package]] 797 | name = "windows-targets" 798 | version = "0.52.5" 799 | source = "registry+https://github.com/rust-lang/crates.io-index" 800 | checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" 801 | dependencies = [ 802 | "windows_aarch64_gnullvm 0.52.5", 803 | "windows_aarch64_msvc 0.52.5", 804 | "windows_i686_gnu 0.52.5", 805 | "windows_i686_gnullvm", 806 | "windows_i686_msvc 0.52.5", 807 | "windows_x86_64_gnu 0.52.5", 808 | "windows_x86_64_gnullvm 0.52.5", 809 | "windows_x86_64_msvc 0.52.5", 810 | ] 811 | 812 | [[package]] 813 | name = "windows_aarch64_gnullvm" 814 | version = "0.48.5" 815 | source = "registry+https://github.com/rust-lang/crates.io-index" 816 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 817 | 818 | [[package]] 819 | name = "windows_aarch64_gnullvm" 820 | version = "0.52.5" 821 | source = "registry+https://github.com/rust-lang/crates.io-index" 822 | checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" 823 | 824 | [[package]] 825 | name = "windows_aarch64_msvc" 826 | version = "0.48.5" 827 | source = "registry+https://github.com/rust-lang/crates.io-index" 828 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 829 | 830 | [[package]] 831 | name = "windows_aarch64_msvc" 832 | version = "0.52.5" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" 835 | 836 | [[package]] 837 | name = "windows_i686_gnu" 838 | version = "0.48.5" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 841 | 842 | [[package]] 843 | name = "windows_i686_gnu" 844 | version = "0.52.5" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" 847 | 848 | [[package]] 849 | name = "windows_i686_gnullvm" 850 | version = "0.52.5" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" 853 | 854 | [[package]] 855 | name = "windows_i686_msvc" 856 | version = "0.48.5" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 859 | 860 | [[package]] 861 | name = "windows_i686_msvc" 862 | version = "0.52.5" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" 865 | 866 | [[package]] 867 | name = "windows_x86_64_gnu" 868 | version = "0.48.5" 869 | source = "registry+https://github.com/rust-lang/crates.io-index" 870 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 871 | 872 | [[package]] 873 | name = "windows_x86_64_gnu" 874 | version = "0.52.5" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" 877 | 878 | [[package]] 879 | name = "windows_x86_64_gnullvm" 880 | version = "0.48.5" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 883 | 884 | [[package]] 885 | name = "windows_x86_64_gnullvm" 886 | version = "0.52.5" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" 889 | 890 | [[package]] 891 | name = "windows_x86_64_msvc" 892 | version = "0.48.5" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 895 | 896 | [[package]] 897 | name = "windows_x86_64_msvc" 898 | version = "0.52.5" 899 | source = "registry+https://github.com/rust-lang/crates.io-index" 900 | checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" 901 | -------------------------------------------------------------------------------- /fluxion/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fluxion" 3 | license = "MIT OR Apache-2.0" 4 | description = "Fluxion is an actor framework written in rust and designed for distributed systems." 5 | repository = "https://github.com/peperworx/fluxion" 6 | homepage = "https://fluxion.peperworx.com/" 7 | categories = ["concurrency"] 8 | keywords = ["actor", "distributed", "async", "fluxion"] 9 | readme = "./README.md" 10 | version = "0.10.5" 11 | edition = "2021" 12 | 13 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 14 | 15 | [dependencies] 16 | async-trait = "0.1.80" 17 | maitake-sync = "0.1.1" 18 | serde = { version = "1.0.198", default-features = false, optional = true } 19 | slacktor = { version = "0.3.0", features = ["async"] } 20 | fluxion_macro = "0.1.0" 21 | const_format = "0.2.32" 22 | 23 | 24 | [features] 25 | default = [] 26 | foreign = [] 27 | serde = ["dep:serde"] 28 | 29 | [dev-dependencies] 30 | bincode = "1.3.3" 31 | rand = "0.8.5" 32 | rayon = "1.10.0" 33 | serde = { version = "1.0.198", features = ["derive"] } 34 | tokio = { version = "1.37.0", features = ["full"] } 35 | 36 | -------------------------------------------------------------------------------- /fluxion/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | Fluxion 4 | 5 | [![crates.io](https://img.shields.io/crates/l/fluxion?style=for-the-badge)](https://crates.io/crates/fluxion) 6 | [![crates.io](https://img.shields.io/crates/v/fluxion?style=for-the-badge)](https://crates.io/crates/fluxion) 7 | [![docs.rs](https://img.shields.io/docsrs/fluxion?style=for-the-badge)](https://docs.rs/fluxion) 8 | 9 | Distributed actor framework written in Rust. 10 |
11 | 12 | 13 | # About 14 | 15 | Fluxion is an actor framework designed with distributed systems in mind, namely sending messages not just between actors, but also between systems. 16 | 17 | ## Why Fluxion? 18 | 19 | Fluxion is designed for a very specific usecase: creating applications that require extremely flexible plugin solutions and communication between different running instances. If you do not need any of the specific features provided by Fluxion, you are probably best off using a different actor system. Internally, Fluxion is based upon [Slacktor](https://github.com/peperworx/slacktor), which provides a core actor framework and high-performance messaging solution. Slacktor was purpose built for Fluxion, and is provided separately for higher-performance usecases, as well as those that do not need Fluxion's additional features. 20 | 21 | ## Core Features 22 | 23 | Fluxion embraces a few core features, and tries to keep an API that is as as simple and extensible as possible. 24 | 25 | ### No-Std Support 26 | 27 | Fluxion and its dependencies only depend on `core` and `alloc`. This means that Fluxion can be used in `no-std` environments, as long as an allocator is available. 28 | 29 | ### Executor Agnosticism 30 | 31 | Fluxion is structured such that it never needs to spawn any tasks. This means that Fluxion does not need to access any specific executor library and is completely executor agnostic with no boilerplate required. You can use Tokio, async_std, Smol, or even write your own executor and Fluxion will not care. In the provided examples, however, we do use Tokio, as it is the most popular executor. 32 | 33 | ### Foreign Messages 34 | 35 | Fluxion's core feature is being able to send messages between systems, and is conditional on the `foreign` feature. Fluxion accomplishes this by allowing the user to define a "delegate" that responds to requests for specific foreign actors. The delegate returns an implementor of a trait that enables sending messages of a specific type. If the `serde` feature is enabled, then messages will be required to implement serialization functionality to be treated as foreign messages. 36 | 37 | ## Getting Started 38 | 39 | The best way to get started right now is to take a look at the `simple` example. It contains the most bare bones possible example for using Fluxion as an actor system with no special features. For more advanced usage, take a look at [the book](https://fluxion.peperworx.com/book/). 40 | 41 | ## License 42 | 43 | Fluxion is Dual-Licensed under the Apache 2.0 and MIT licenses. -------------------------------------------------------------------------------- /fluxion/examples/benchmark.rs: -------------------------------------------------------------------------------- 1 | /// # Benchmark 2 | /// Extremely simple benchmark for Fluxion's message passing speed. 3 | /// May not be entirely representitive of real usecases. 4 | 5 | 6 | // Imports from Fluxion that are needed for this example 7 | use fluxion::{message, Actor, ActorContext, Delegate, Fluxion, Handler, MessageSender}; 8 | use std::time::Instant; 9 | 10 | 11 | /// # [`TestActor`] 12 | /// For this example, the actor stores a 64-bit integer, which is xored with the data in the message as a result. 13 | /// This 64-bit integer is randomly generated. 14 | struct TestActor(pub u64); 15 | 16 | impl Actor for TestActor { 17 | type Error = (); 18 | } 19 | 20 | /// # [`TestMessage`] 21 | /// The 64-bit integer sent to the actor. 22 | #[message(u64)] 23 | struct TestMessage(pub u64); 24 | 25 | 26 | 27 | impl Handler for TestActor { 28 | #[inline(always)] 29 | async fn handle_message(&self, message: TestMessage, _context: &ActorContext) -> u64 { 30 | // XOR the message's value with the value stored in self. 31 | message.0 ^ self.0 32 | } 33 | } 34 | 35 | 36 | 37 | 38 | #[tokio::main] 39 | async fn main() { 40 | // Create the system 41 | let system = Fluxion::new("system", ()); 42 | 43 | // Add the actor, returning the ID 44 | let id = system.add(TestActor(rand::random())).await.unwrap(); 45 | 46 | // Get a local reference to the actor 47 | let actor = system.get_local::(id).await.unwrap(); 48 | 49 | // Test with 1 billion messages. 50 | // If this takes too long, lower values also 51 | // give pretty accurate results. 52 | let num_messages = 1_000_000_000; 53 | 54 | // Reserve num_messages in the vector. 55 | // If this uses too much ram, then decrease num_messages. 56 | let mut out = Vec::with_capacity(num_messages); 57 | 58 | // Begin timing 59 | let start = Instant::now(); 60 | 61 | // Send num_messages messages. 62 | for i in 0..num_messages { 63 | // Send the message 64 | let Ok(v) = actor.send(TestMessage(i as u64)).await else { 65 | unreachable!("local actors should never fail to send.") 66 | }; 67 | 68 | // Add the message to the output vector 69 | out.push(v); 70 | } 71 | 72 | // Calculate epalsed duration 73 | let elapsed = start.elapsed(); 74 | 75 | // Calculate and print numbers per second. 76 | println!( 77 | "{:.2} messages/sec", 78 | num_messages as f64 / elapsed.as_secs_f64() 79 | ); 80 | } -------------------------------------------------------------------------------- /fluxion/examples/foreign.rs: -------------------------------------------------------------------------------- 1 | //! # Foreign messages 2 | //! This is a rather convoluted example of using foreign messages. It really only exists to show that it can be done. 3 | //! To run this example, make sure to enable the serde and foreign features. 4 | 5 | use std::{collections::HashMap, marker::PhantomData, sync::Arc}; 6 | 7 | 8 | use fluxion::{actor, message, Delegate, Handler, Identifier, LocalRef, Message, MessageID, MessageSendError, MessageSender}; 9 | use maitake_sync::RwLock; 10 | use serde::{Deserialize, Serialize}; 11 | use slacktor::{ActorHandle, Slacktor}; 12 | use tokio::sync::{mpsc, oneshot}; 13 | 14 | 15 | #[actor] 16 | struct ActorA; 17 | 18 | impl Handler for ActorA { 19 | async fn handle_message(&self, _message: MessageA, context: &fluxion::ActorContext) -> ::Result { 20 | println!("Actor {}:{} received {}", context.system().get_id(), context.get_id(), MessageA::ID); 21 | } 22 | } 23 | impl Handler for ActorA { 24 | async fn handle_message(&self, _message: MessageB, context: &fluxion::ActorContext) -> ::Result { 25 | println!("Actor {}:{} received {}", context.system().get_id(), context.get_id(), MessageB::ID); 26 | } 27 | } 28 | 29 | #[actor] 30 | struct ActorB; 31 | 32 | impl Handler for ActorB { 33 | async fn handle_message(&self, _message: MessageA, context: &fluxion::ActorContext) -> ::Result { 34 | println!("Actor {}:{} received {}", context.system().get_id(), context.get_id(), MessageA::ID); 35 | } 36 | } 37 | 38 | impl Handler for ActorB { 39 | async fn handle_message(&self, _message: MessageB, context: &fluxion::ActorContext) -> ::Result { 40 | println!("Actor {}:{} received {}", context.system().get_id(), context.get_id(), MessageB::ID); 41 | } 42 | } 43 | 44 | 45 | #[message] 46 | #[derive(Serialize, Deserialize)] 47 | struct MessageA; 48 | 49 | #[message] 50 | #[derive(Serialize, Deserialize)] 51 | struct MessageB; 52 | 53 | 54 | struct DelegateSender { 55 | actor_id: u64, 56 | other_delegate: ActorHandle, 57 | _phantom: PhantomData, 58 | } 59 | 60 | #[async_trait::async_trait] 61 | impl fluxion::MessageSender for DelegateSender 62 | where M::Result: for<'de> Deserialize<'de> { 63 | 64 | async fn send(&self,message:M) -> Result { 65 | // Send the message 66 | let res = self.other_delegate.send(DelegateMessage(self.actor_id, M::ID.to_string(), bincode::serialize(&message).unwrap())).await; 67 | 68 | // Deserialize the response 69 | Ok(bincode::deserialize(&res).unwrap()) 70 | } 71 | } 72 | 73 | struct DelegateActor(Arc); 74 | 75 | impl slacktor::Actor for DelegateActor {} 76 | 77 | impl slacktor::actor::Handler for DelegateActor { 78 | async fn handle_message(&self, message: DelegateMessage) -> ::Result { 79 | 80 | // Get the channel 81 | let handlers = self.0.actor_handlers.read().await; 82 | let channels = handlers.get(&(message.0, message.1)).unwrap(); 83 | 84 | // Construct the response oneshot 85 | let (response_sender, response) = oneshot::channel(); 86 | 87 | // Send the message 88 | channels.send((message.2, response_sender)).await.unwrap(); 89 | 90 | // Wait for the response and return 91 | response.await.unwrap() 92 | } 93 | } 94 | 95 | struct DelegateMessage(u64, String, Vec); 96 | 97 | impl slacktor::Message for DelegateMessage { 98 | type Result = Vec; 99 | } 100 | 101 | struct SerdeDelegate { 102 | // The system's id 103 | system_id: &'static str, 104 | // Backing slacktor instance 105 | slacktor: Arc>, 106 | // The other delegate's id, 107 | other_id: usize, 108 | // Hashmap of message handling channels for actors 109 | actor_handlers: RwLock, oneshot::Sender>)>>> 110 | } 111 | 112 | 113 | impl SerdeDelegate { 114 | pub fn new(system_id: &'static str, slacktor: Arc>, other_id: usize) -> Self { 115 | Self { 116 | system_id, 117 | slacktor, 118 | other_id, 119 | actor_handlers: Default::default() 120 | } 121 | } 122 | 123 | 124 | /// Registers an actor as being able to receive a specific message type. 125 | pub async fn register_actor_message, M: fluxion::IndeterminateMessage, S: Delegate + AsRef>(&self, actor: LocalRef) 126 | where M::Result: serde::Serialize + for<'de> serde::Deserialize<'de>{ 127 | 128 | let id = actor.get_id(); 129 | 130 | println!("{} is registering actor with id {} to handle message {}", self.system_id, id, M::ID); 131 | 132 | // Create channels 133 | let (send_message, mut receive_message) = mpsc::channel::<(Vec,_)>(64); 134 | 135 | // Spawn task 136 | tokio::spawn(async move { 137 | loop { 138 | let Some(next_message): Option<(Vec, oneshot::Sender>)> = receive_message.recv().await else { 139 | println!("Message handler {}/{} stopped recieving messages.", actor.get_id() ,M::ID); 140 | break; 141 | }; 142 | 143 | // Decode the message 144 | let decoded: M = bincode::deserialize(&next_message.0).unwrap(); 145 | 146 | // Handle the message 147 | let res = actor.send(decoded).await.expect("this delegate doesn't error"); 148 | 149 | // Send the response 150 | next_message.1.send(bincode::serialize(&res).unwrap()).unwrap(); 151 | } 152 | }); 153 | 154 | // Add the handler 155 | self.actor_handlers.write().await.insert((id, M::ID.to_string()), send_message); 156 | 157 | } 158 | } 159 | 160 | impl Delegate for SerdeDelegate { 161 | async fn get_actor<'a, A: Handler, M: fluxion::IndeterminateMessage>(&self, id: Identifier<'a>) -> Option>> 162 | where M::Result: serde::Serialize + for<'de> serde::Deserialize<'de> { 163 | 164 | // We shouldn't be able to return local ids. 165 | // Ignore named IDs for now. 166 | let Identifier::Foreign(id, system) = id else { 167 | return None; 168 | }; 169 | 170 | println!("{} is requesting a foreign actor on system {} with id {} that can handle message {}", self.system_id, system, id, M::ID); 171 | 172 | // Get the other actor on the slacktor system 173 | let slacktor = self.slacktor.read().await; 174 | let other = slacktor.get::(self.other_id)?; 175 | 176 | // Wrap with a message sender and return 177 | Some(Arc::new(DelegateSender { 178 | actor_id: id, 179 | other_delegate: other.clone(), 180 | _phantom: PhantomData, 181 | })) 182 | } 183 | } 184 | 185 | #[tokio::main] 186 | async fn main() { 187 | 188 | // This basic example just uses slacktor as the communication medium between delegates. 189 | // In practice, any system that can provide request/response semantics can be used to create a delegate. 190 | let delegate_backplane = Arc::new(RwLock::new(Slacktor::new())); 191 | let backplane = delegate_backplane.clone(); 192 | let mut backplane = backplane.write().await; 193 | 194 | let delegate_a = Arc::new(SerdeDelegate::new("system_a", delegate_backplane.clone(), 1)); 195 | let delegate_b = Arc::new(SerdeDelegate::new("system_a", delegate_backplane, 0)); 196 | 197 | backplane.spawn(DelegateActor(delegate_a.clone())); 198 | backplane.spawn(DelegateActor(delegate_b.clone())); 199 | 200 | // Drop slacktor, or else the delegates will hang forever. 201 | drop(backplane); 202 | 203 | 204 | // Initialize the two systems 205 | let system_a = fluxion::Fluxion::new("system_a", delegate_a); 206 | let system_b = fluxion::Fluxion::new("system_b", delegate_b); 207 | 208 | // Create both actors on system a 209 | let actor_a = system_a.add(ActorA).await.unwrap(); 210 | system_a.get_delegate().register_actor_message::(system_a.get_local(actor_a).await.unwrap()).await; 211 | system_a.get_delegate().register_actor_message::(system_a.get_local(actor_a).await.unwrap()).await; 212 | let actor_b = system_a.add(ActorB).await.unwrap(); 213 | system_a.get_delegate().register_actor_message::(system_a.get_local(actor_b).await.unwrap()).await; 214 | system_a.get_delegate().register_actor_message::(system_a.get_local(actor_b).await.unwrap()).await; 215 | 216 | 217 | 218 | // Get both actors on system b 219 | let foreign_a = system_b.get::(Identifier::Foreign(actor_a, "system_a")).await.unwrap(); 220 | let foreign_b = system_b.get::(Identifier::Foreign(actor_b, "system_a")).await.unwrap(); 221 | 222 | foreign_a.send(MessageB).await.expect("this delegate doesn't error"); 223 | foreign_b.send(MessageA).await.expect("this delegate doesn't error"); 224 | } -------------------------------------------------------------------------------- /fluxion/examples/simple.rs: -------------------------------------------------------------------------------- 1 | // Imports from Fluxion that are needed for this example 2 | use fluxion::{actor, message, ActorContext, Delegate, Fluxion, Handler, MessageSender}; 3 | 4 | 5 | 6 | /// # [`TestActor`]` 7 | /// A unit struct that serves as our test actor. 8 | /// Fluxion doesn't actually care what type you use as an actor. 9 | /// You can use a unit struct like this, a regular struct, tuple struct, or an enum. 10 | /// You can even use generics, and as long as they satisfy [`Send`] + [`Sync`] + `'static` then they will work. 11 | /// 12 | /// All that actors require is that the `Actor` trait be implemented for them 13 | /// Unless you define custom initialization or deinitialization logic for your actor, 14 | /// the following macro should be used. Otherwise, the [`fluxion::Actor`] trait must 15 | /// be manually implemented. 16 | #[actor] 17 | struct TestActor; 18 | 19 | 20 | /// # [`TestMessage`] 21 | /// A unit struct that serves as out test message. 22 | /// Just like with actors, messages can be any type. 23 | /// They just need to satisfy [`Send`] + [`Sync`] + `'static` 24 | /// If the `serde` feature is enabled, messages that wish to be able to be sent to foreign actors, 25 | /// as well as use the [`Fluxion::get`] method, must implemment `Serialize` and `Deserialize`. 26 | /// Actors that do not implement these traits can still be accessed with [`Fluxion::get_local`]. 27 | /// 28 | /// Optionally, the message's response type may be provided. The actor's ID may also be provided. 29 | /// Here we use the full syntax, but it can be reduced to simply `#[message]`, and the effect will be the same. 30 | /// The default response type is `()` and the default ID for a message is it's full module path. 31 | #[message((), "simple::TestMessage")] 32 | struct TestMessage; 33 | 34 | 35 | 36 | 37 | // Message handlers are also pretty simple 38 | impl Handler for TestActor { 39 | 40 | /// The only real complex bit is this function signature. 41 | /// Even with foreign messages disabled, Fluxion still requies the [`Delegate`] 42 | /// generic so that enabling and disabling the `foreign` feature doesn't completely mess up the API. 43 | /// That is, the only implementation detail that should differentiate foreign and local messages 44 | /// is if they implement serialization (or with no `serde` feature flag, there should be no difference). 45 | async fn handle_message(&self, _message: TestMessage, context: &ActorContext) { 46 | // Both the contents of the message and the `context` are available here. 47 | // The context allows the handler to access this actor's ID, as well as a reference to the system. 48 | println!("Test message received by {}", context.get_id()); 49 | } 50 | } 51 | 52 | 53 | 54 | // Fluxion requires async to run. 55 | // We just use tokio here, as it is the most popular option. 56 | // Fluxion is completely executor agnostic, so you can use async_std, smol, or even write your own executor. 57 | // Additionally, Fluxion is no_std compatible. All that is required is that you provide an allocator, 58 | // and that you call into Fluxion from an async function. 59 | #[tokio::main] 60 | async fn main() { 61 | 62 | // Creating a Fluxion system is easy. 63 | // Here we create it with an empty delegate (the unit type) 64 | // which just means that foreign messages are disabled for this system. 65 | // Any requests for foreign messages will just return [`None`]. 66 | let system = Fluxion::new("system", ()); 67 | 68 | // Adding an actor to the system assigns it with an ID. 69 | let id = system.add(TestActor).await.unwrap(); 70 | 71 | // You can use this ID to retrieve a reference to the actor. 72 | // There are two ways to do this. 73 | 74 | // The first is using the [`Fluxion::get`] method. 75 | // This only works if your actor is compatible with foreign messages. 76 | // The only time that a message will not be compatible with foreign messages is if 77 | // the `serde` feature is enabled, and your message doesn't implement `Serialize` and `Deserialize`. 78 | // The actor ref returned by this method only supports sending a single message type. 79 | // Additionally, the type of the actor must be known when you retrieve it, however 80 | // the returned type doesn not depend on the actor's type. 81 | // This means that you can get the reference in code that knows about the actor's type, 82 | // and then use it in code that only knows about the message's type. 83 | // For example: an external crate that handles database transactions only needs to accept the type 84 | // `Arc>` and doesn't need to know about the actor's type. 85 | let actor_ref = system.get::(id).await.unwrap(); 86 | 87 | // You can send messages to actor refs using the send method. 88 | // This method returns the actor's response to the message. 89 | // In this case, because we have defined the response as the unit type, 90 | // we do not need to unwrap anything. 91 | actor_ref.send(TestMessage).await.expect("local actors will never fail to send"); 92 | 93 | // We can also retrieve an actor reference using the [`Fluxion::get_local`] method. 94 | // This only requires the actor's type, and only works on actors runnign on the local system. 95 | // The returned actor reference can be used for any message type handled by the actor, 96 | // and can be used in the same way as the actor ref returned by the `get` method. 97 | let actor = system.get_local::(id).await.unwrap(); 98 | 99 | // Use in the same way as above 100 | actor.send(TestMessage).await.expect("local actors will never fail to send"); 101 | } -------------------------------------------------------------------------------- /fluxion/src/actor.rs: -------------------------------------------------------------------------------- 1 | //! # Actors 2 | //! This module contains traits and other types and implementations surrounding actors and how they interface with the system. 3 | 4 | use alloc::sync::Arc; 5 | 6 | use crate::{Delegate, Fluxion, Message}; 7 | 8 | 9 | 10 | /// # [`Actor`] 11 | /// This trait defines the interface between the system and the actor. 12 | /// The methods defined in this trait provide the actor's only chances to access itself 13 | /// mutably in an async context. 14 | /// All actors must implement this trait. 15 | pub trait Actor: Send + Sync + 'static { 16 | 17 | /// # [`Error`] 18 | /// This associated type contains the error type that 19 | /// can be returned by methods defined by this trait. 20 | type Error; 21 | 22 | /// # [`initialize`] 23 | /// Called immediately before the actor is added to the system. 24 | fn initialize(&mut self) -> impl core::future::Future> + Send {async { 25 | Ok(()) 26 | }} 27 | 28 | /// # [`deinitialize`] 29 | /// Called immediately after the actor is shut down. 30 | /// This will be the last opportunity the actor has to execute any code in an async context. 31 | fn deinitialize(&self) -> impl core::future::Future + Send {async { 32 | 33 | }} 34 | } 35 | 36 | /// # [`ActorContext`] 37 | /// Provides an actor with access to the system and to metadata about itself 38 | pub struct ActorContext { 39 | /// The underlying system 40 | pub(crate) system: Fluxion, 41 | /// The actor's id 42 | pub(crate) id: u64, 43 | } 44 | 45 | impl ActorContext { 46 | /// # [`ActorContext::get_id`] 47 | /// Returns the id of the actor 48 | #[must_use] 49 | pub fn get_id(&self) -> u64 { 50 | self.id 51 | } 52 | 53 | /// # [`ActorContext::system`] 54 | /// Returns the Fluxion instance that this actor is running on 55 | #[must_use] 56 | pub fn system(&self) -> &Fluxion { 57 | &self.system 58 | } 59 | } 60 | 61 | /// # [`Handler`] 62 | pub trait Handler: Actor { 63 | fn handle_message(&self, message: M, context: &ActorContext) -> impl core::future::Future + Send; 64 | } 65 | 66 | 67 | 68 | 69 | /// Newtype pattern implementing Slacktor's actor trait 70 | /// for implementorrs of our [`Actor`] trait here. 71 | pub(crate) struct ActorWrapper(pub T, pub Arc>); 72 | 73 | impl slacktor::Actor for ActorWrapper { 74 | fn destroy(&self) -> impl core::future::Future + Send { 75 | self.0.deinitialize() 76 | } 77 | } 78 | 79 | impl, M: Message, D: Delegate> slacktor::actor::Handler for ActorWrapper { 80 | #[inline] 81 | fn handle_message(&self, message: M) -> impl core::future::Future::Result> + Send { 82 | self.0.handle_message(message, &self.1) 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /fluxion/src/fluxion.rs: -------------------------------------------------------------------------------- 1 | 2 | use alloc::sync::Arc; 3 | use maitake_sync::RwLock; 4 | use slacktor::Slacktor; 5 | 6 | use crate::{Actor, ActorContext, ActorWrapper, Delegate, Handler, Identifier, IndeterminateMessage, LocalRef, MessageSender}; 7 | use alloc::string::String; 8 | use alloc::collections::BTreeMap; 9 | 10 | 11 | 12 | /// # [`Fluxion`] 13 | /// Contains the core actor management functionality of fluxion 14 | pub struct Fluxion { 15 | /// The underlying slacktor instance. 16 | /// This is wrapped in an [`Arc`] and [`RwLock`] to allow concurrent access from different tasks. 17 | /// The [`RwLock`] is used instead of a mutex because it can be assumed that actor references 18 | /// will be retrieved more often than actors are created. 19 | slacktor: Arc>, 20 | /// A mapping of string actor names to their slacktor ids. 21 | actor_ids: Arc>>, 22 | /// The identifier of this system as a string 23 | system_id: Arc, 24 | /// The foreign delegate of this system 25 | delegate: Arc, 26 | } 27 | 28 | impl Clone for Fluxion { 29 | fn clone(&self) -> Self { 30 | Self { slacktor: self.slacktor.clone(), system_id: self.system_id.clone(), delegate: self.delegate.clone(), actor_ids: self.actor_ids.clone() } 31 | } 32 | } 33 | 34 | impl Fluxion { 35 | /// # [`Fluxion::new`] 36 | /// Creates a new [`Fluxion`] instance with the given system id and delegate 37 | #[must_use] 38 | pub fn new(id: &str, delegate: D) -> Self { 39 | Self { 40 | slacktor: Arc::new(RwLock::new(Slacktor::new())), 41 | system_id: id.into(), 42 | delegate: Arc::new(delegate), 43 | actor_ids: Arc::default(), 44 | } 45 | } 46 | 47 | /// # [`Fluxion::get_delegate`] 48 | /// Gets a reference to the delegate. 49 | #[must_use] 50 | pub fn get_delegate(&self) -> &D { 51 | &self.delegate 52 | } 53 | 54 | /// # [`Fluxion::get_id`] 55 | /// Gets the system's id 56 | #[must_use] 57 | pub fn get_id(&self) -> &str { 58 | &self.system_id 59 | } 60 | 61 | /// # [`Fluxion::get_actor_id`] 62 | /// Retrieve's an actor's ID by its name 63 | #[must_use] 64 | pub async fn get_actor_id(&self, name: &str) -> Option { 65 | self.actor_ids.read().await.get(name).copied() 66 | } 67 | 68 | /// # [`Fluxion::add_named`] 69 | /// Adds an actor to the local instance, returning its id and assigning 70 | /// the given name to it for retrieval by [`Fluxion::get_actor_id`]. 71 | /// This is handy when using actors with static names on a foreign system. 72 | ///
73 | /// Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but 74 | /// will not block any messages. 75 | ///
76 | ///
77 | /// If an actor with a duplicate name is added, it will overwrite the original actor's name. 78 | /// The original actor won't be killed, but it may become inaccessible. 79 | ///
80 | /// 81 | /// # Errors 82 | /// Returns an error if the actor failed to initialize. 83 | /// On an error, the actor will not be spawned, and the name will not be assigned. 84 | pub async fn add_named(&self, name: &str, actor: A) -> Result { 85 | // Add the actor, assigning an id 86 | let id = self.add(actor).await?; 87 | 88 | // Store the actor's name in the actor_ids map 89 | let mut actor_ids = self.actor_ids.write().await; 90 | actor_ids.insert(String::from(name), id as u64); 91 | 92 | // Return the actor's id. 93 | Ok(id) 94 | } 95 | 96 | /// # [`Fluxion::add`] 97 | /// Adds an actor to the local instance, returning its id. 98 | ///
99 | /// Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but 100 | /// will not block any messages. 101 | ///
102 | /// 103 | /// # Errors 104 | /// Returns an error if the actor failed to initialize. 105 | /// On an error, the actor will not be spawned. 106 | pub async fn add(&self, mut actor: A) -> Result { 107 | 108 | // Run the actor's initialization code 109 | actor.initialize().await?; 110 | 111 | // Lock the underlying slacktor instance as write 112 | let mut system = self.slacktor.write().await; 113 | 114 | // Wrap the actor 115 | let actor = ActorWrapper(actor, Arc::new( 116 | ActorContext { 117 | system: self.clone(), 118 | id: system.next_id() 119 | } 120 | )); 121 | 122 | // Spawn the actor on the slacktor instance 123 | let id = system.spawn(actor); 124 | 125 | 126 | // Return the actor's id. 127 | Ok(id as u64) 128 | } 129 | 130 | /// # [`Fluxion::kill`] 131 | /// Given an actor's id, kills the actor 132 | /// 133 | ///
134 | /// Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but 135 | /// will not block any messages. 136 | ///
137 | pub async fn kill(&self, id: u64) { 138 | // Realistically, it should not be possible for this conversion to ever fail. 139 | // If the input id is more than usize::MAX, it is most likely an error on the caller's part, 140 | // as it should be impossible to allocate over usize::MAX actors at all, because 141 | // each actor has an overhead of more than one byte. 142 | // We just fail silently here, as it is the same case as the actor not existing. 143 | let Ok(id) = id.try_into() else { 144 | return; 145 | }; 146 | 147 | // Lock the underylying slacktor instance as write and kill the actor 148 | self.slacktor.write().await.kill::>(id).await; 149 | 150 | // Shrink the slacktor instance 151 | self.slacktor.write().await.shrink(); 152 | } 153 | 154 | 155 | /// # [`Fluxion::get_local`] 156 | /// Gets an actor that is known to reside on the local system. 157 | /// This allows messages that are not serializable to still be used even if Fluxion is compiled with foreign message support. 158 | /// This function also allows retrieving an actor handle that is capable of sending multiple different messages. 159 | pub async fn get_local(&self, id: u64) -> Option> { 160 | // If the id refers to a local actor, lock the slacktor 161 | // instance as read, and retrieve the handle. 162 | // The handle is then cloned and returned 163 | self.slacktor.read().await.get::>( 164 | id.try_into().ok()? // If overflow, then the actor does not exist. 165 | ).cloned() 166 | .map(|handle| LocalRef(handle, id)) 167 | } 168 | 169 | /// # [`Fluxion::get`] 170 | /// Retrieves an actor reference capable of communicating using the given message via the given ID. 171 | #[cfg(feature = "serde")] 172 | pub async fn get<'a, A: Handler, M: IndeterminateMessage>(&self, 173 | #[cfg(feature="foreign")] id: impl Into>, 174 | #[cfg(not(feature="foreign"))] id: impl Into 175 | ) -> Option>> 176 | where M::Result: serde::Serialize + for<'d> serde::Deserialize<'d> { 177 | 178 | match id.into() { 179 | Identifier::Local(id) => { 180 | // Get the local ref and wrap in an arc 181 | self.get_local::(id).await 182 | .map(|h| Arc::new(h) as Arc>) 183 | }, 184 | Identifier::LocalNamed(name) => { 185 | // Get the actor's id by name 186 | let id = self.get_actor_id(name).await?; 187 | 188 | // Get the local ref and wrap in an arc 189 | self.get_local::(id).await 190 | .map(|h| Arc::new(h) as Arc>) 191 | }, 192 | #[cfg(feature = "foreign")] 193 | id => { 194 | // Send the request on to the delegate 195 | self.delegate.get_actor::(id).await 196 | }, 197 | } 198 | } 199 | 200 | /// # [`Fluxion::get`] 201 | /// Retrieves an actor reference capable of communicating using the given message via the given ID. 202 | #[cfg(not(feature = "serde"))] 203 | pub async fn get<'a, A: Handler, M: IndeterminateMessage>(&self, 204 | id: impl Into>, 205 | ) -> Option>> { 206 | 207 | match id.into() { 208 | Identifier::Local(id) => { 209 | // Get the local ref and wrap in an arc 210 | self.get_local::(id).await 211 | .map(|h| Arc::new(h) as Arc>) 212 | }, 213 | Identifier::LocalNamed(name) => { 214 | // Get the actor's id by name 215 | let id = self.get_actor_id(name).await?; 216 | 217 | // Get the local ref and wrap in an arc 218 | self.get_local::(id).await 219 | .map(|h| Arc::new(h) as Arc>) 220 | }, 221 | #[cfg(feature = "foreign")] 222 | id => { 223 | // Send the request on to the delegate 224 | self.delegate.get_actor::(id).await 225 | }, 226 | } 227 | } 228 | 229 | /// # [`Fluxion::shutdown`] 230 | /// Removes all actors from the system and deallocates the underlying slab. 231 | /// 232 | ///
233 | /// Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but 234 | /// will not block any messages. 235 | ///
236 | pub async fn shutdown(&self) { 237 | self.slacktor.write().await.shutdown().await; 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /fluxion/src/foreign.rs: -------------------------------------------------------------------------------- 1 | //! # Foreign Messages 2 | //! This module provides traits and utilities for implementing foreign message handlers. 3 | 4 | #[cfg(feature="foreign")] 5 | use alloc::sync::Arc; 6 | 7 | #[cfg(feature="foreign")] 8 | use crate::{Handler, Identifier, MessageSender, IndeterminateMessage}; 9 | 10 | 11 | 12 | /// # [`Delegate`] 13 | /// A [`Delegate`] is a struct that serves as an interface between one Fluxion instance and every other instance. 14 | /// A [`Delegate`]'s role is simply to provide the Fluxion instance with an implementor of [`ActorRef`] for a given actor ID, and nothing more. 15 | /// This implementation of [`ActorRef`] may wrap a channel, network connection, or simply another [`ActorRef`]. 16 | /// All that matters is that this [`ActorRef`] refers to a foreign actor on the given system with the given id. 17 | /// The [`Delegate`] should return [`None`] if no actor with the given ID can be found or is local. 18 | pub trait Delegate: Send + Sync + 'static { 19 | /// # [`Delegate::get_actor`] 20 | /// Retrieves an [`ActorRef`] for the given foreign actor. 21 | #[cfg(all(feature="foreign", not(feature="serde")))] 22 | fn get_actor, M: IndeterminateMessage>(&self, id: Identifier) -> impl core::future::Future>>> + Send; 23 | 24 | /// # [`Delegate::get_actor`] 25 | /// Retrieves an [`ActorRef`] for the given foreign actor. 26 | #[cfg(all(feature="foreign", feature="serde"))] 27 | fn get_actor, M: IndeterminateMessage>(&self, id: Identifier) -> impl core::future::Future>>> + Send 28 | where M::Result: serde::Serialize + for<'a> serde::Deserialize<'a>; 29 | } 30 | 31 | // Delegate is implemented for () as a no-op 32 | impl Delegate for () { 33 | #[cfg(all(feature="foreign", not(feature="serde")))] 34 | async fn get_actor, M: IndeterminateMessage>(&self, id: Identifier<'_>) -> Option>> { 35 | let _ = id; 36 | None 37 | } 38 | 39 | 40 | #[cfg(all(feature="foreign", feature="serde"))] 41 | async fn get_actor, M: IndeterminateMessage>(&self, id: Identifier<'_>) -> Option>> 42 | where M::Result: serde::Serialize + for<'a> serde::Deserialize<'a> { 43 | let _ = id; 44 | None 45 | } 46 | } 47 | 48 | 49 | // Delegate is automatially implemented for any Arc of an existing delegate 50 | impl Delegate for alloc::sync::Arc { 51 | #[cfg(all(feature="foreign", feature="serde"))] 52 | fn get_actor, M: IndeterminateMessage>(&self, id: Identifier) -> impl core::future::Future>>> + Send 53 | where M::Result: serde::Serialize + for<'a> serde::Deserialize<'a> { 54 | D::get_actor::(self, id) 55 | } 56 | 57 | #[cfg(all(feature="foreign", not(feature="serde")))] 58 | fn get_actor, M: IndeterminateMessage>(&self, id: Identifier) -> impl core::future::Future>>> + Send { 59 | D::get_actor::(self, id) 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /fluxion/src/identifiers.rs: -------------------------------------------------------------------------------- 1 | //! # Identifiers 2 | //! Fluxion needs a way to identify individual actors between systems. 3 | //! This module provides the [`Identifier`] enum, which provides a clean method to distinguish between different actors. 4 | 5 | 6 | /// # [`Identifier`] 7 | /// Identifies an individual actor on a given system. There are two variants: one for actors on the current system, and one on a foreign system. 8 | /// These are called [`Identifier::Local`] and [`Identifier::Foreign`] respectively. 9 | #[derive(Debug)] 10 | pub enum Identifier<'a> { 11 | /// Identifies an actor on the current system. Contains the actor's id as a 64-bit integer. 12 | Local(u64), 13 | /// Identifies an actor on the current system. Contains the actor's name 14 | LocalNamed(&'a str), 15 | /// Identifies an actor on a given foreign system. Contains first the actor's id, then the foreign system's id as a string. 16 | #[cfg(feature = "foreign")] 17 | Foreign(u64, &'a str), 18 | /// Identifies an actor on a given foreign system. Contains first the actor's name, then the foreign system's id as a string. 19 | #[cfg(feature = "foreign")] 20 | ForeignNamed(&'a str, &'a str), 21 | } 22 | 23 | #[cfg(feature = "foreign")] 24 | impl<'a> From for Identifier<'a> { 25 | fn from(value: u64) -> Self { 26 | Identifier::Local(value) 27 | } 28 | } 29 | 30 | #[cfg(not(feature = "foreign"))] 31 | impl From for Identifier<'_> { 32 | fn from(value: u64) -> Self { 33 | Identifier::Local(value) 34 | } 35 | } 36 | 37 | /// # [`MessageID`] 38 | /// Every foreign message is required to have a unique ID. 39 | /// This is automatically populated by the `message` proc macro. 40 | pub trait MessageID { 41 | const ID: &'static str; 42 | } -------------------------------------------------------------------------------- /fluxion/src/lib.rs: -------------------------------------------------------------------------------- 1 | #! [doc = include_str! ("../README.md")] 2 | 3 | 4 | #![cfg_attr(not(test), no_std)] 5 | #![warn(clippy::pedantic)] 6 | #![allow(clippy::module_name_repetitions)] 7 | 8 | 9 | extern crate alloc; 10 | 11 | pub use fluxion_macro::{message, actor}; 12 | pub use const_format::concatcp; 13 | 14 | mod fluxion; 15 | pub use fluxion::*; 16 | 17 | mod identifiers; 18 | pub use identifiers::*; 19 | 20 | mod actor; 21 | pub use actor::*; 22 | 23 | mod message; 24 | pub use message::*; 25 | 26 | mod references; 27 | pub use references::*; 28 | 29 | mod foreign; 30 | pub use foreign::*; 31 | 32 | 33 | pub use slacktor::Message; -------------------------------------------------------------------------------- /fluxion/src/message.rs: -------------------------------------------------------------------------------- 1 | 2 | use core::error::Error; 3 | 4 | use slacktor::Message; 5 | 6 | #[cfg(feature="serde")] 7 | use crate::MessageID; 8 | 9 | /// # [`MessageSendError`] 10 | /// An error type that might be returned during a message send. 11 | #[derive(Debug)] 12 | #[non_exhaustive] 13 | pub enum MessageSendError { 14 | #[cfg(feature = "serde")] 15 | SerializationError { 16 | message: alloc::string::String, 17 | source: alloc::boxed::Box, 18 | }, 19 | #[cfg(feature = "serde")] 20 | DeserializationError { 21 | message: alloc::string::String, 22 | source: alloc::boxed::Box, 23 | }, 24 | #[cfg(feature = "foreign")] 25 | DelegateError { 26 | message: alloc::string::String, 27 | source: alloc::boxed::Box, 28 | }, 29 | UnknownError(alloc::boxed::Box), 30 | } 31 | 32 | impl core::fmt::Display for MessageSendError { 33 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 34 | let message = match self { 35 | #[cfg(feature = "serde")] 36 | MessageSendError::SerializationError { message, source: _ } => message.clone(), 37 | #[cfg(feature = "serde")] 38 | MessageSendError::DeserializationError { message, source: _ } => message.clone(), 39 | #[cfg(feature = "foreign")] 40 | MessageSendError::DelegateError { message, source: _ } => message.clone(), 41 | MessageSendError::UnknownError(e) => alloc::format!("{e}"), 42 | }; 43 | 44 | write!(f, "MessageSendError: {message}") 45 | } 46 | } 47 | 48 | impl core::error::Error for MessageSendError { 49 | fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { 50 | match self { 51 | #[cfg(feature = "serde")] 52 | Self::SerializationError { message: _, source } => Some(source.as_ref()), 53 | #[cfg(feature = "serde")] 54 | Self::DeserializationError { message: _, source } => Some(source.as_ref()), 55 | #[cfg(feature = "foreign")] 56 | Self::DelegateError { message: _, source } => Some(source.as_ref()), 57 | Self::UnknownError(e) => Some(e.as_ref()), 58 | } 59 | } 60 | 61 | fn description(&self) -> &str { 62 | "description() is deprecated; use Display" 63 | } 64 | } 65 | 66 | /// # [`IndeterminateMessage`] 67 | /// An indeterminate message is a message for which it has not yet been determined whether it will be serialized. 68 | /// Because of this, indeterminate messages require serde traits to be implemented, which is not the case with local messages. 69 | #[cfg(feature = "serde")] 70 | pub trait IndeterminateMessage: Message + MessageID + serde::Serialize + for<'a> serde::Deserialize<'a> 71 | where Self: Message + serde::Serialize + for<'a> serde::Deserialize<'a>, 72 | Self::Result: serde::Serialize + for<'a> serde::Deserialize<'a>{} 73 | 74 | #[cfg(feature = "serde")] 75 | impl IndeterminateMessage for T 76 | where T: Message + MessageID + serde::Serialize + for<'a> serde::Deserialize<'a>, 77 | Self::Result: serde::Serialize + for<'a> serde::Deserialize<'a> {} 78 | 79 | 80 | /// # [`IndeterminateMessage`] 81 | /// An indeterminate message is a message for which it has not yet been determined whether it will be serialized. 82 | /// Because of this, indeterminate messages require serde traits to be implemented, which is not the case with local messages. 83 | #[cfg(not(feature = "serde"))] 84 | pub trait IndeterminateMessage: Message {} 85 | 86 | #[cfg(not(feature = "serde"))] 87 | impl IndeterminateMessage for T {} 88 | -------------------------------------------------------------------------------- /fluxion/src/references.rs: -------------------------------------------------------------------------------- 1 | //! # References 2 | //! [`ActorRef`]s, or Actor References, are the primary method through which actors control each other. 3 | 4 | 5 | 6 | 7 | use crate::{Actor, ActorWrapper, Delegate, Handler, Message, MessageSendError}; 8 | use alloc::boxed::Box; 9 | 10 | /// # [`ActorRef`] 11 | /// This trait provides methods for actors to communicate with and control each other. 12 | pub trait ActorRef {} 13 | 14 | /// # [`MessageSender`] 15 | /// This trait provides the ability to send a specific message type to a specific actor. 16 | /// This trait is only necessary because traits with generic methods are not object safe, 17 | /// and we need a way to be generic over multiple types of [`ActorRef`] at once. 18 | /// Sadly, [`async_trait`] is also required for this trait as async fns in traits are not yet object safe either. 19 | #[async_trait::async_trait] 20 | pub trait MessageSender: Send + Sync + 'static { 21 | 22 | 23 | /// Sends the given message and waits for a response. 24 | /// 25 | /// # Errors 26 | /// This may return an error (defined as an associated type) if the message's send fails. 27 | /// For [`LocalRef`], the message send will never fail, however delegates may return an error upon sending. 28 | /// These errors are generally not recoverable, and should be interpreted as meaning that the 29 | /// target actor no longer exists/is no longer accessible. 30 | async fn send(&self, message: M) -> Result; 31 | } 32 | 33 | 34 | pub struct LocalRef(pub(crate) slacktor::ActorHandle>, pub(crate) u64); 35 | 36 | impl LocalRef { 37 | /// # [`LocalRef::get_id`] 38 | /// Retrieves the actor's ID 39 | #[must_use] 40 | pub fn get_id(&self) -> u64 { 41 | self.1 42 | } 43 | } 44 | 45 | impl Clone for LocalRef { 46 | fn clone(&self) -> Self { 47 | Self(self.0.clone(), self.1) 48 | } 49 | } 50 | 51 | #[async_trait::async_trait] 52 | impl, M: Message, D: Delegate> MessageSender for LocalRef { 53 | 54 | #[inline] 55 | async fn send(&self, message: M) -> Result { 56 | Ok(self.0.send(message).await) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /fluxion_macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fluxion_macro" 3 | license = "MIT OR Apache-2.0" 4 | description = "Proc-macro crate for fluxion." 5 | repository = "https://github.com/peperworx/fluxion" 6 | categories = ["concurrency"] 7 | keywords = ["actor", "distributed", "async", "fluxion"] 8 | readme = "../README.md" 9 | version = "0.1.0" 10 | edition = "2021" 11 | 12 | [dependencies] 13 | proc-macro2 = "1.0.86" 14 | quote = "1.0.37" 15 | syn = { version = "2.0.76", features=["extra-traits"] } 16 | 17 | [lib] 18 | proc-macro = true 19 | -------------------------------------------------------------------------------- /fluxion_macro/README.md: -------------------------------------------------------------------------------- 1 | # Fluxion Macro 2 | 3 | Adds simple macros for defining Fluxion actors and messages: 4 | 5 | ```rust 6 | use fluxion_macro::[message,actor]; 7 | 8 | #[actor] 9 | struct MyActor; 10 | 11 | #[message] 12 | struct MyMessage; 13 | 14 | ``` -------------------------------------------------------------------------------- /fluxion_macro/src/lib.rs: -------------------------------------------------------------------------------- 1 | use proc_macro::TokenStream; 2 | use proc_macro2::{Span, TokenStream as TokenStream2}; 3 | use quote::{quote, ToTokens}; 4 | use syn::{parse::Parse, punctuated::Punctuated, token::Comma, DeriveInput, LitStr, Token, Type}; 5 | 6 | 7 | struct MessageParams { 8 | pub result_type: Type, 9 | pub name: Option 10 | } 11 | 12 | impl Parse for MessageParams { 13 | fn parse(input: syn::parse::ParseStream) -> syn::Result { 14 | // Parse the result type 15 | let result_type = input.parse()?; 16 | 17 | // If there is a comma, parse it 18 | let name = if input.peek(Token![,]) { 19 | input.parse::()?; 20 | 21 | Some(input.parse()?) 22 | } else { 23 | None 24 | }; 25 | 26 | Ok(Self { 27 | result_type, name 28 | }) 29 | } 30 | } 31 | 32 | #[proc_macro_attribute] 33 | pub fn message(attr: TokenStream, item: TokenStream) -> TokenStream { 34 | 35 | // Get the parameters 36 | let params = if attr.is_empty() { 37 | MessageParams { 38 | result_type: Type::Tuple(syn::TypeTuple { 39 | paren_token: syn::token::Paren(Span::call_site()), 40 | elems: Punctuated::new() 41 | }), 42 | name: None, 43 | } 44 | } else { 45 | syn::parse_macro_input!(attr as MessageParams) 46 | }; 47 | 48 | 49 | // Get the item's name 50 | let item_name = item.clone(); 51 | let item_name = syn::parse_macro_input!(item_name as DeriveInput).ident; 52 | 53 | // Default the id to the path of the item 54 | // if no id is provided. 55 | let id: TokenStream2 = match params.name { 56 | Some(name) => name.to_token_stream(), 57 | None => { 58 | // Get the name of the item 59 | let name: TokenStream2 = format!("\"{}\"", item_name).parse().expect("this should always succeed parsing as a string"); 60 | 61 | 62 | quote! { 63 | fluxion::concatcp!(module_path!(), "::", #name) 64 | } 65 | } 66 | }; 67 | 68 | 69 | // Convert to tokenstream 2 for quote. 70 | let item: TokenStream2 = item.into(); 71 | 72 | // Extract the result type 73 | let result_type = params.result_type; 74 | 75 | quote! { 76 | #item 77 | 78 | impl fluxion::MessageID for #item_name { 79 | const ID: &'static str = #id; 80 | } 81 | 82 | impl fluxion::Message for #item_name { 83 | type Result = #result_type; 84 | } 85 | }.into() 86 | } 87 | 88 | 89 | #[proc_macro_attribute] 90 | pub fn actor(attr: TokenStream, item: TokenStream) -> TokenStream { 91 | // Get the item's name 92 | let item_name = item.clone(); 93 | let item_name = syn::parse_macro_input!(item_name as DeriveInput).ident; 94 | 95 | // Get the optional error type, defaulting to () 96 | let error_type = if attr.is_empty() { 97 | Type::Tuple(syn::TypeTuple { 98 | paren_token: syn::token::Paren(Span::call_site()), 99 | elems: Punctuated::new() 100 | }) 101 | } else { 102 | syn::parse_macro_input!(attr as Type) 103 | }; 104 | 105 | let item: TokenStream2 = item.into(); 106 | 107 | quote! { 108 | #item 109 | 110 | impl fluxion::Actor for #item_name { 111 | type Error = #error_type; 112 | } 113 | }.into() 114 | } -------------------------------------------------------------------------------- /oranda.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": { 3 | "name": "fluxion", 4 | "readme_path": "./README.md" 5 | }, 6 | "styles": { 7 | "logo": "site/images/fluxion_wide.png", 8 | "theme": "hacker", 9 | "favicon": "site/images/fluxion_square.png", 10 | "additional_css": ["site/css/main.css"] 11 | }, 12 | "components": { 13 | "mdbook": { 14 | "path": "site/docs", 15 | "theme": false 16 | }, 17 | "artifacts": false, 18 | "changelog": { 19 | "read_changelog_file": true 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /site/css/main.css: -------------------------------------------------------------------------------- 1 | header { 2 | width: 100%; 3 | } 4 | 5 | .logo { 6 | width: 80%; 7 | max-width: none; 8 | margin: auto!important; 9 | display: block!important; 10 | } 11 | 12 | #centered { 13 | display: flex; 14 | flex-flow: column nowrap; 15 | align-items: center; 16 | } 17 | 18 | #centered p { 19 | display: block; 20 | } 21 | 22 | .title { 23 | display: none!important; 24 | } 25 | 26 | .nav ul { 27 | justify-content: center!important; 28 | } 29 | 30 | h1, h2, h3, h4, h5, h6 { 31 | color: #dddddd!important; 32 | } 33 | -------------------------------------------------------------------------------- /site/docs/.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | -------------------------------------------------------------------------------- /site/docs/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["Riley Wilton"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "Fluxion" 7 | 8 | [rust] 9 | edition = "2021" 10 | 11 | [output.html.playground] 12 | runnable = false -------------------------------------------------------------------------------- /site/docs/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Foreward](./foreward.md) 4 | - [First Steps](./first_steps.md) 5 | - [Defining Actors and Messages](./actors_and_messages.md) 6 | - [Handling Messages](./handling_messages.md) 7 | - [Foreign Messages](./foreign.md) -------------------------------------------------------------------------------- /site/docs/src/actors_and_messages.md: -------------------------------------------------------------------------------- 1 | # Defining Actors 2 | 3 | Any type that is `Send`, `Sync`, and `'static` can be an actor. Lets go ahead and define a unit struct, and use the `actor` macro to implement the `Actor` trait automatically. 4 | 5 | ```rust 6 | use fluxion::actor; 7 | 8 | #[actor] 9 | struct MyActor; 10 | ``` 11 | 12 | ## Adding the Actor to the System 13 | 14 | Adding actors to the system is rather simple: 15 | 16 | ```rust 17 | let id = system.add(MyActor).await.unwrap(); 18 | ``` 19 | 20 | This runs the actor's initialization method, adds the actor to the system, and returns the actor's ID. 21 | 22 | The actor's ID can be used to retrieve a reference to the actor from the system. There are two ways to retrieve an actor from the system: `get` and `get_local`. We will take a look at `get_local` first: 23 | 24 | ```rust 25 | let actor_ref = system.get_local::(id).await.unwrap(); 26 | ``` 27 | 28 | The `get_local` method requires only the actor's type and ID, and returns a concrete type that depends on the actor's type. This allows a single actor reference to send any message that the actor implements, however, this message must reside on the local system. 29 | 30 | `get`, on the other hand, enables foreign messages, but also requires that the message type is specified. The returned type, however, is abstracted over handlers of the message type. 31 | 32 | To use `get`, we must first define a message type. 33 | 34 | # Defining Messages 35 | 36 | Messages have similar requirements to actors, and we can use a macro to define them as well: 37 | ```rust 38 | #[message(())] 39 | struct MyMessage; 40 | ``` 41 | 42 | The above code defines `MyMessage` as a message with the response type `()`. 43 | Messages also each have an ID, which we can optionally set: 44 | ```rust 45 | #[message((), "my_message")] 46 | struct MyMessage; 47 | ``` 48 | 49 | We will just use the following code, however, as it sets the message's response to the default `()` and the message's ID to its full module path (in this case, `project_name::MyMessage`): 50 | ```rust 51 | #[message] 52 | struct Mymessage; 53 | ``` -------------------------------------------------------------------------------- /site/docs/src/first_steps.md: -------------------------------------------------------------------------------- 1 | # First Steps 2 | 3 | 4 | Lets start by creating a Cargo project (in the current directory) and adding Fluxion: 5 | ```sh 6 | cargo init project_name 7 | cd project_name 8 | cargo add fluxion 9 | ``` 10 | 11 | Fluxion needs to be called from an async context. As Fluxion is executor agnostic, it doesn't matter which library is used. 12 | Here we will be using [Tokio](https://tokio.rs/), although any executor will work: 13 | ```sh 14 | cargo add tokio --features full 15 | ``` 16 | 17 | Next, we need to make the main function async, and import a few helpers from Fluxion, and create the Fluxion system: 18 | 19 | ```rust 20 | use fluxion::Fluxion; 21 | 22 | #[tokio::main] 23 | async fn main() { 24 | // Create the Fluxion system: 25 | let system = Fluxion::new("system_id", ()); 26 | } 27 | ``` 28 | 29 | The above code initializes a Fluxion system with the id "system_id" and the delegate `()`. 30 | 31 | What is a delegate? 32 | 33 | A delegate is an external type that provides methods to retrieve `MessageSender`s, which allow actors to communicate with actors on external systems. The unit type (`()`) is a simple delegate that always returns that no foreign actor was found. Later in this book, we will explore creating our own simple delegate. 34 | 35 | Now that we have a system, we need to add an actor to it, and to do that, we must define an actor. 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /site/docs/src/foreign.md: -------------------------------------------------------------------------------- 1 | # Foreign Messages 2 | 3 | This section has not yet been developed. A (still rather rough) example of foreign messages can be found in the `foreign` example. It requires both the `serde` and the `foreign` feature flags to compile. The example just uses `slacktor` as a basic method to communicate between two delegates, however any other mechanism will work (IPC pipes, sockets, even a serial port), as long as you can implement request/response semantics on top of it. -------------------------------------------------------------------------------- /site/docs/src/foreward.md: -------------------------------------------------------------------------------- 1 | # Foreward 2 | 3 | Fluxion exists to fulfil a very specific usecase: an actor library that can send messages between systems. How these systems are connected does not alter the behavior of Fluxion, nor should it matter to actors running on a Fluxion system. Fluxion is also different from traditional actor libraries in that it does not provide actors mutable access to themselves, nor does it provide "fire and forget" messages. 4 | 5 | Fluxion makes both of these restrictions in the name of performance and extensibility. If Fluxion were to allow actors mutable access to themselves, Fluxion would need to implement a layer of synchronization on top of each actor. This needlessly harms the performance of actors that do not need mutable access. Additionally, actors that do need mutable access to themselves can simply implement their own synchronization where needed. Fluxion doesn't provide "fire and forget" messages, because it would require a dependency on a specific async executor. This is because Fluxion, via [Slacktor](https://github.com/peperworx/slacktor), uses a "simulated messaging" system where raw function calls are used instead of channels. This significantly increases performance. If "fire and forget" messages are required, a user can implement them by spawning a new async task to send the message from. 6 | 7 | Importantly, Fluxion is *not* an actor framework, but an actor *library*. Fluxion will not force your entire application to be designed following a specific pattern, and can be used as much, or as little as you want. 8 | 9 | Due to Fluxion's limited scope and architecture, it tends to be *very* performant, especially when compared to other actor frameworks. Running the `benchmark` example (which is designed to test Fluxion's raw performance, not necessarily the performance of the actual actors implemented), Fluxion acheives a throughput of ~60 million messages per second on an intel i5-9400 compiled with release. The equivalent code running on Actix can only handle ~700,000 messages per second. -------------------------------------------------------------------------------- /site/docs/src/handling_messages.md: -------------------------------------------------------------------------------- 1 | # Handling Messages# Defining and Sending Messages 2 | 3 | Implementing a message handler on an actor is relatively simple: 4 | 5 | ```rust 6 | use fluxion::Handler; 7 | 8 | impl Handler for MyActor { 9 | async fn handle_message(&self, message: TestMessage, context: &ActorContext) { 10 | println!("{:?} received by {}", message, context.get_id()); 11 | } 12 | } 13 | 14 | ``` 15 | 16 | Message handlers have access to the message, and to a context that provides information about the current actor, as well as access to the system to create more actors and send further messages. 17 | 18 | Sending a message is pretty simple. Using the local handle we previously retrieved, we can send any message type that is handled by the actor: 19 | 20 | ```rust 21 | use fluxion::MessageSender; 22 | 23 | actor_ref.send(MyMessage).await; 24 | ``` 25 | 26 | We do not need to unwrap this call, because message sending will never error, and just returns the type dictated by the message's result. In this case, we used `()`. 27 | 28 | 29 | Now we can also retrieve a `MessageSender`, which can only send a specific message type: 30 | 31 | ```rust 32 | let actor_ref = system.get::(id).await.unwrap(); 33 | actor_ref.send(MyMessage).await; 34 | ``` 35 | 36 | We will look closer at `MessageSender`s when we get to foreign messages in the future. Our final code for this section, with thorough comments, can be found in the `simple` example on github. -------------------------------------------------------------------------------- /site/images/fluxion_social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Peperworx/fluxion/f71e425e2dbc2e64bfebe089637880fc16ff70f8/site/images/fluxion_social.png -------------------------------------------------------------------------------- /site/images/fluxion_social.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 40 | 42 | 45 | 49 | 53 | 54 | 57 | 61 | 62 | 71 | 72 | 76 | 81 | 86 | 91 | 96 | Fluxion 107 | 108 | 109 | -------------------------------------------------------------------------------- /site/images/fluxion_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Peperworx/fluxion/f71e425e2dbc2e64bfebe089637880fc16ff70f8/site/images/fluxion_square.png -------------------------------------------------------------------------------- /site/images/fluxion_square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 39 | 41 | 45 | 50 | 55 | 60 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /site/images/fluxion_square_ar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Peperworx/fluxion/f71e425e2dbc2e64bfebe089637880fc16ff70f8/site/images/fluxion_square_ar2.png -------------------------------------------------------------------------------- /site/images/fluxion_square_ar2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 39 | 41 | 45 | 50 | 55 | 60 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /site/images/fluxion_wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Peperworx/fluxion/f71e425e2dbc2e64bfebe089637880fc16ff70f8/site/images/fluxion_wide.png -------------------------------------------------------------------------------- /site/images/fluxion_wide.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 40 | 42 | 45 | 49 | 53 | 54 | 57 | 61 | 62 | 71 | 72 | 76 | 81 | 86 | 91 | 96 | Fluxion 107 | 108 | 109 | --------------------------------------------------------------------------------