Crate bevy_utils

Source
Expand description

General utilities for first-party Bevy engine crates.

Re-exports§

pub use hashbrown;
pub use tracing;

Modules§

futures
Utilities for working with Futures.
prelude
synccell
A reimplementation of the currently unstable std::sync::Exclusive
syncunsafecell
A reimplementation of the currently unstable std::cell::SyncUnsafeCell

Macros§

all_tuples
Helper macro to generate tuple pyramids. Useful to generate scaffolding to work around Rust lacking variadics. Invoking all_tuples!(impl_foo, start, end, P, Q, ..) invokes impl_foo providing ident tuples through arity start..=end.
all_tuples_with_size
debug_once
Call debug! once per call site.
detailed_trace
Like tracing::trace, but conditional on cargo feature detailed_trace.
error_once
Call error! once per call site.
info_once
Call info! once per call site.
once
Call some expression only once per call site.
trace_once
Call trace! once per call site.
warn_once
Call warn! once per call site.

Structs§

AHasher
A Hasher for hashing an arbitrary stream of bytes.
Duration
A Duration type to represent a span of time, typically used for system timeouts.
EntityHash
A BuildHasher that results in a EntityHasher.
EntityHasher
A very fast hash that is only designed to work on generational indices like Entity. It will panic if attempting to hash a type containing non-u64 fields.
FixedState
A hasher builder that will create a fixed hasher.
Hashed
A pre-hashed value of a specific type. Pre-hashing enables memoization of hashes that are expensive to compute. It also enables faster PartialEq comparisons by short circuiting on hash equality. See PassHash and PassHasher for a “pass through” BuildHasher and Hasher implementation designed to work with Hashed See PreHashMap for a hashmap pre-configured to use Hashed keys.
Instant
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
NoOpHash
BuildHasher for types that already contain a high-quality hash.
OnDrop
A type which calls a function when dropped. This can be used to ensure that cleanup code is run even in case of a panic.
Parallel
A cohesive set of thread-local values of a given type.
PassHash
A BuildHasher that results in a PassHasher.
PassHasher
A no-op hash that only works on u64s. Will panic if attempting to hash a type containing non-u64 fields.
RandomState
Provides a Hasher factory. This is typically used (e.g. by HashMap) to create AHashers in order to hash the keys of the map. See build_hasher below.
SystemTime
A measurement of the system clock, useful for talking to external entities like the file system or other processes.
SystemTimeError
An error returned from the duration_since and elapsed methods on SystemTime, used to learn how far in the opposite direction a system time lies.
TryFromFloatSecsError
An error which can be returned when converting a floating-point value of seconds into a Duration.

Enums§

CowArc
Much like a Cow, but owned values are Arc-ed to make clones cheap. This should be used for values that are cloned for use across threads and change rarely (if ever).

Traits§

ConditionalSend
Use ConditionalSend to mark an optional Send trait bound. Useful as on certain platforms (eg. WASM), futures aren’t Send.
ConditionalSendFuture
Use ConditionalSendFuture for a future with an optional Send trait bound, as on certain platforms (eg. WASM), futures aren’t Send.
PreHashMapExt
Extension methods intended to add functionality to PreHashMap.

Functions§

dbg
Calls the tracing::debug! macro on a value.
default
An ergonomic abbreviation for Default::default() to make initializing structs easier. This is especially helpful when combined with “struct update syntax”.
error
Processes a Result by calling the tracing::error! macro in case of an Err value.
get_short_name
Shortens a type name to remove all module paths.
info
Calls the tracing::info! macro on a value.
warn
Processes a Result by calling the tracing::warn! macro in case of an Err value.

Type Aliases§

BoxedFuture
An owned and dynamically typed Future used when you can’t statically type your result or need to add some indirection.
EntityHashMap
A HashMap pre-configured to use EntityHash hashing. Iteration order only depends on the order of insertions and deletions.
EntityHashSet
A HashSet pre-configured to use EntityHash hashing. Iteration order only depends on the order of insertions and deletions.
Entry
A shortcut alias for hashbrown::hash_map::Entry.
HashMap
A HashMap implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps.
HashSet
A HashSet implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps.
PreHashMap
A HashMap pre-configured to use Hashed keys and PassHash passthrough hashing. Iteration order only depends on the order of insertions and deletions.
StableHashMapDeprecated
A stable hash map implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps.
StableHashSetDeprecated
A stable hash set implementing aHash, a high speed keyed hashing algorithm intended for use in in-memory hashmaps.
TypeIdMap
A specialized hashmap type with Key of TypeId Iteration order only depends on the order of insertions and deletions.