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.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for Intern<K, V>
impl<K, V> RefUnwindSafe for Intern<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Intern<K, V>
impl<K, V> Sync for Intern<K, V>
impl<K, V> Unpin for Intern<K, V>
impl<K, V> UnwindSafe for Intern<K, V>where
V: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more