Skip to content

feat!: extract bevy_mod_scripting_world decoupling world abstractions - #529

Merged
makspll merged 9 commits into
mainfrom
feat/decouple-world-abstractions
Apr 3, 2026
Merged

feat!: extract bevy_mod_scripting_world decoupling world abstractions#529
makspll merged 9 commits into
mainfrom
feat/decouple-world-abstractions

Conversation

@makspll

@makspll makspll commented Mar 28, 2026

Copy link
Copy Markdown
Owner

Summary

The bevy_mod_scripting_bindings crate is bigger than it needs to, it would be ideal to have the ability to extend the world guard in separate crates, this PR is one step towards that.

I extracted the "cached" registry components into something less typed so that I could pull out bevy_mod_scripting_world which doesn't know about these, and instead alot of the functionality is pushed into bevy_mod_scripting_bindings, via the new WorldExtensions trait.

I also removed ReflectAccessId in favor of WorldAccessRange making the world crate a bit more opinionated on what kind of accesses exist

@semanticdiff-com

semanticdiff-com Bot commented Mar 28, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  benches/benchmarks.rs  95% smaller
  crates/bevy_mod_scripting_core/src/extractors.rs  81% smaller
  crates/bevy_mod_scripting_bindings/src/script_value.rs  70% smaller
  crates/bevy_mod_scripting_bindings/src/function/from.rs  62% smaller
  crates/bevy_mod_scripting_bindings/src/function/into.rs  58% smaller
  crates/bevy_mod_scripting_derive/src/derive/debug_with_type_info.rs  57% smaller
  crates/bevy_mod_scripting_functions/src/core.rs  56% smaller
  crates/bevy_mod_scripting_core/src/pipeline/machines.rs  56% smaller
  crates/bevy_mod_scripting_bindings/src/function/from_ref.rs  55% smaller
  crates/bevy_mod_scripting_bindings/src/globals/core.rs  54% smaller
  crates/bevy_mod_scripting_bindings/src/function/namespace.rs  54% smaller
  crates/bevy_mod_scripting_bindings/src/function/into_ref.rs  50% smaller
  crates/bevy_mod_scripting_display/src/printer/mod.rs  50% smaller
  crates/bevy_mod_scripting_bindings/src/path/mod.rs  49% smaller
  crates/bevy_mod_scripting_bindings/src/docgen/info.rs  47% smaller
  crates/bevy_mod_scripting_bindings/src/globals/mod.rs  44% smaller
  crates/bevy_mod_scripting_bindings/src/function/script_function.rs  43% smaller
  crates/bevy_mod_scripting_bindings/src/reference.rs  40% smaller
  crates/bevy_mod_scripting_core/src/handler.rs  36% smaller
  crates/bevy_mod_scripting_display/src/impls/std.rs  34% smaller
  crates/languages/bevy_mod_scripting_lua/src/lib.rs  33% smaller
  crates/bevy_mod_scripting_core/src/commands.rs  29% smaller
  crates/testing_crates/script_integration_test_harness/src/lib.rs  28% smaller
  crates/bevy_mod_scripting_core/src/context.rs  26% smaller
  xtask/src/main.rs  24% smaller
  crates/bevy_mod_scripting_display/src/impls/bevy_ecs.rs  22% smaller
  crates/languages/bevy_mod_scripting_rhai/src/lib.rs  20% smaller
  crates/bevy_mod_scripting_core/src/script_system.rs  15% smaller
  crates/bevy_mod_scripting_display/src/lib.rs  13% smaller
  crates/bevy_mod_scripting_bindings/src/error.rs  12% smaller
  crates/bevy_mod_scripting_bindings/src/script_component.rs  10% smaller
  crates/testing_crates/script_integration_test_harness/src/test_functions.rs  6% smaller
  crates/bevy_mod_scripting_bindings/src/schedule.rs  5% smaller
  crates/bevy_mod_scripting_bindings/src/query.rs  3% smaller
  crates/bevy_mod_scripting_core/src/lib.rs  1% smaller
  crates/bevy_mod_scripting_core/src/error.rs  1% smaller
  Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_bindings/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_bindings/src/access_map.rs  0% smaller
  crates/bevy_mod_scripting_bindings/src/allocator.rs  0% smaller
  crates/bevy_mod_scripting_bindings/src/lib.rs  0% smaller
  crates/bevy_mod_scripting_bindings/src/reflection_extensions.rs  0% smaller
  crates/bevy_mod_scripting_bindings/src/world.rs  0% smaller
  crates/bevy_mod_scripting_bindings/src/world_extensions.rs  0% smaller
  crates/bevy_mod_scripting_core/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_core/src/pipeline/mod.rs  0% smaller
  crates/bevy_mod_scripting_display/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_display/src/impls/bevy_asset.rs  0% smaller
  crates/bevy_mod_scripting_display/src/impls/bevy_platform.rs  0% smaller
  crates/bevy_mod_scripting_display/src/impls/bevy_reflect.rs  0% smaller
  crates/bevy_mod_scripting_display/src/impls/parking_lock.rs  0% smaller
  crates/bevy_mod_scripting_functions/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_world/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_world/src/access_map.rs  0% smaller
  crates/bevy_mod_scripting_world/src/lib.rs  0% smaller
  crates/bevy_mod_scripting_world/src/world.rs  0% smaller
  crates/bindings/bevy_a11y_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_animation_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_asset_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_camera_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_color_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_core_pipeline_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ecs_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_gizmos_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_gltf_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_image_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_input_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_input_focus_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_light_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_math_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_mesh_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_pbr_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_picking_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_post_process_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_reflect_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_render_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_scene_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_sprite_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_sprite_render_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_text_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_time_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_transform_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ui_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ui_render_bms_bindings/Cargo.toml Unsupported file format
  crates/languages/bevy_mod_scripting_lua/Cargo.toml Unsupported file format
  crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs  0% smaller
  crates/languages/bevy_mod_scripting_rhai/Cargo.toml Unsupported file format
  crates/languages/bevy_mod_scripting_rhai/src/bindings/reference.rs  0% smaller
  crates/testing_crates/script_integration_test_harness/Cargo.toml Unsupported file format
  crates/testing_crates/test_utils/src/test_data.rs  0% smaller
  docs/src/ReleaseNotes/0.19-to-0.20.md Unsupported file format
  docs/src/ReleaseNotes/0.20.0.md Unsupported file format
  xtask/src/command.rs  0% smaller
  xtask/templates/bindings_crate.toml.tera Unsupported file format

@github-actions

github-actions Bot commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchfeat/decouple-world-abstractions
Testbedlinux-gha

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

🚨 2 Alerts

🐰 View full continuous benchmarking report in Bencher

@makspll

makspll commented Mar 28, 2026

Copy link
Copy Markdown
Owner Author

Hmm not sure why the benches are alerting, when running locally this shows as an improvement, at least in the Mut::from benchmark:
image

@makspll

makspll commented Mar 28, 2026

Copy link
Copy Markdown
Owner Author

Claiming access for example looks to have sped up (probably because of the change from a dictionary to a list):
image

@makspll makspll closed this Mar 28, 2026
@makspll makspll reopened this Mar 28, 2026
@makspll makspll closed this Mar 28, 2026
@makspll makspll reopened this Mar 28, 2026
@makspll makspll closed this Mar 28, 2026
@makspll makspll reopened this Mar 28, 2026
@makspll makspll closed this Mar 28, 2026
@makspll makspll reopened this Mar 28, 2026
@makspll makspll closed this Mar 29, 2026
@makspll makspll reopened this Mar 29, 2026
@makspll makspll closed this Mar 29, 2026
@makspll makspll reopened this Mar 29, 2026
@makspll
makspll force-pushed the feat/decouple-world-abstractions branch from 3f9ee5e to fb7fb0b Compare April 2, 2026 18:41
@makspll makspll closed this Apr 2, 2026
@makspll makspll reopened this Apr 2, 2026
@makspll makspll closed this Apr 2, 2026
@makspll makspll reopened this Apr 2, 2026
@makspll
makspll force-pushed the feat/decouple-world-abstractions branch from fb7fb0b to c7e7aeb Compare April 2, 2026 21:38
@makspll
makspll enabled auto-merge (squash) April 3, 2026 17:39
@makspll
makspll disabled auto-merge April 3, 2026 17:39
@makspll makspll changed the title feat!: decouple world abstractions, improve domain boundaries feat!: extract bevy_mod_scripting_world decoupling world abstractions Apr 3, 2026
@makspll
makspll enabled auto-merge (squash) April 3, 2026 17:39
@makspll
makspll merged commit a429d54 into main Apr 3, 2026
28 of 29 checks passed
@makspll
makspll deleted the feat/decouple-world-abstractions branch April 3, 2026 18:29
@github-actions github-actions Bot mentioned this pull request Apr 2, 2026
This was referenced Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant