Open-Source Wikis

/

Bevy

/

Packages

/

bevy_utils

bevyengine/bevy

bevy_utils

Small general utilities used by multiple Bevy crates. Keep this crate small — anything that grows to its own concept gets promoted to its own crate.

Purpose

Cross-crate helpers that don't fit cleanly elsewhere. Includes:

  • default() function — equivalent to Default::default() but shorter.
  • ParallelHashMap — concurrent map used by some scheduler internals.
  • Once — fast static initialization helpers.
  • Internal hashing helpers shared with bevy_platform.

Directory layout

crates/bevy_utils/src/
├── lib.rs
├── default.rs            # default() function
├── parallel_queue.rs     # Lock-free per-thread queues
├── once.rs               # Once-init helpers
├── short_names.rs        # Strip module paths from type names for display
├── synccell.rs, syncunsafecell.rs   # Sync wrappers for !Sync types
└── debug_info.rs         # Compile-time debug info helpers

Key abstractions

Type File Description
default() crates/bevy_utils/src/default.rs default() is shorter than Default::default().
Parallel<T> crates/bevy_utils/src/parallel_queue.rs Per-thread parallel queue.
OnceFlag crates/bevy_utils/src/once.rs Cheap once-shot flag.
get_short_name crates/bevy_utils/src/short_names.rs Strip generics/module paths from a type name.

Integration points

  • Depends on: bevy_platform, sometimes tracing.
  • Depended on by: Many crates. Treat it like a stdlib of small extras.

Entry points for modification

  • Add new helpers sparingly. If a helper grows past ~100 lines or ties to a specific subsystem, consider splitting it into a dedicated crate.

See also

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

bevy_utils – Bevy wiki | Factory