Comments (4)
Workaround:
trait Foo {
fn foo() -> BoxedSystem {
Box::new(IntoSystem::into_system(|| {}))
}
}
from bevy.
This bug applies to run conditions as well, but BoxedCondition
is not a proper workaround because it doesn't impl Condition
. You have to use .run_if_dyn
instead of .run_if
, but .run_if_dyn
is a real pain to use because it doesn't return Self
:
fn my_system() {}
fn always_box() -> BoxedCondition {
Box::new(IntoSystem::into_system(|| true))
}
fn foo(app: &mut App) {
app.add_systems(Update, my_system.run_if(always_box())); // Does not compile
app.add_systems(Update, {
let mut configs = my_system.into_configs();
configs.run_if_dyn(always_box());
configs
}); // Does compile
}
from bevy.
I think you need fn foo() -> impl Fn() + Sync + Send + 'static {
.
System
requires those trait bounds, and for ConcreteFoo
the compiler can see the actual type and validate them. But for GenericFoo
it has to protect against something like
struct EvilFoo;
impl Foo for EvilFoo {
fn foo() -> impl Fn() {
let x = Cell::new(0);
// This is not `Sync` and so cannot be a `System`.
move || {
x.set(0);
}
}
}
from bevy.
Interesting. That works. I guess this isn't a bug in Rust or Bevy, but it is surprising.
from bevy.
Related Issues (20)
- Add `World::resource_scope_by_id` HOT 2
- Image loading docs are not clear enough about required feature flags HOT 6
- Squircle / Superellipse for UI / Gizmos / Mesh HOT 7
- Parent device is lost HOT 2
- Add additional names to GLTF entities for easier querying HOT 1
- Bevy_ui outlines should respect BorderRadius.
- Textures not displaying properly if normal/base texture transforms don't align
- `winit::TabLeft`/`Event::Suspended` doesn't function as intended on WASM HOT 6
- Panic if changing browser zoom in WASM with an overridden scale factor HOT 2
- ECS: Assets on web keep re-downloading (help: banging head against the wall) HOT 1
- Segfault `SIGSEGV (Address boundary error)` when running examples on main HOT 6
- Lack of Doc Comments in some Render Related Files
- Exit not correctly tearing down graphics stack?? HOT 2
- RenderAssetUsages::RENDER_WORLD assets are not cleaned when their handles are dropped HOT 3
- Ui border is 1 pixel too large, or is getting aliased. HOT 11
- Audio getting progressively worse. (By default) HOT 9
- Text styles should be inheritable HOT 2
- Support user interaction in `ci_testing` HOT 1
- UI Node's transform is sometimes incorrectly calculated HOT 17
- Setting 'Specular Transmission' to a value higher than 0.0 on a standard material (or ext material) -> it wont write to depth buffer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bevy.