pub struct Intern<K: EntityRef, V> { /* private fields */ }Expand description
A helper structure to “intern” and deduplicate values of type V with an
identifying key K.
Note that this can also be used where V can’t be intern’d to represent a
flat list of items.
Implementations§
Source§impl<K, V> Intern<K, V>where
K: EntityRef,
impl<K, V> Intern<K, V>where
K: EntityRef,
Sourcepub fn push(&mut self, value: V) -> K
pub fn push(&mut self, value: V) -> K
Inserts the value specified into this set, returning either a fresh
key K if this value hasn’t been seen before or otherwise returning the
previous K used to represent value.
Note that this should only be used for component model items where the
creation of value is not side-effectful.