Provides a thread-safe interner for static deduplication of immutable values, enabling fast reference equality.
// Source: https://github.com/bevyengine/bevy | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
//! Provides types used to statically intern immutable values.
//!
//! Interning is a pattern used to save memory by deduplicating identical values,
//! speed up code by shrinking the stack size of large types,
//! and make comparisons for any type as fast as integers.
use alloc::{borrow::ToOwned, boxed::Box};
use core::{fmt::Debug, hash::Hash, ops::Deref};
use bevy_platform::{
collections::HashSet,
hash::FixedHasher,
sync::{PoisonError, RwLock},
};
#[cfg(feature = "bevy_reflect")]
use bevy_reflect::Reflect;
/// An interned value. Will stay valid until the end of the program and will not drop.
///
/// For details on interning, see [the module l
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key