https://github.com/bd103/bevy_command_non_send
Insert and remove non-Send resources using Commands in Bevy.
https://github.com/bd103/bevy_command_non_send
Last synced: 2 months ago
JSON representation
Insert and remove non-Send resources using Commands in Bevy.
- Host: GitHub
- URL: https://github.com/bd103/bevy_command_non_send
- Owner: BD103
- License: apache-2.0
- Created: 2024-03-30T04:59:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-30T22:37:21.000Z (about 1 year ago)
- Last Synced: 2025-01-26T11:42:25.246Z (4 months ago)
- Language: Rust
- Homepage: https://bd103.github.io/bevy_command_non_send/bevy_command_non_send
- Size: 1.04 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# `bevy_command_non_send`
This is a small utility library for manipulating non-`Send` resources using [`Commands`] in [Bevy].
[`Commands`]: https://docs.rs/bevy/0.13.1/bevy/ecs/system/struct.Commands.html
[Bevy]: https://bevyengine.org## Installation
This library is not added on crates.io, so you will need to depend on the Git repository directly.
```bash
$ cargo add --git https://github.com/BD103/bevy_command_non_send bevy_command_non_send
```Alternatively, you can add it directly to `Cargo.toml`:
```toml
[dependencies]
bevy_command_non_send = { version = "0.x", git = "https://github.com/BD103/bevy_command_non_send" }
```## Usage
Please see the [docs] for the API reference. You most likely want to imports the `CommandsExt` trait, which adds several methods on top of `Commands`:
[docs]: https://bd103.github.io/bevy_command_non_send/bevy_command_non_send/
```rust
use bevy::prelude::*;
use bevy_command_non_send::CommandsExt;struct MyNonSend(*const u8);
fn create_my_non_send(mut commands: Commands) {
// `insert_non_send_resource` is a method imported with `CommandsExt`.
commands.insert_non_send_resource(|| {
MyNonSend(std::ptr::null())
});
}App::new()
.add_systems(Startup, create_my_non_send)
.run();
```## Bevy Compatibility
|Bevy|`bevy_command_non_send`|
|-|-|
|0.13|0.1|## License
`bevy_command_non_send` is dual-licensed under either
- [MIT License] ()
- [Apache 2.0 License] ()at your option.
[MIT License]: https://github.com/BD103/bevy_command_non_send/blob/main/LICENSE-MIT
[Apache 2.0 License]: https://github.com/BD103/bevy_command_non_send/blob/main/LICENSE-APACHE## Contributing
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.