Struct bevy_utils::intern::Interner
source · pub struct Interner<T: ?Sized + 'static>(/* private fields */);
Expand description
A thread-safe interner which can be used to create Interned<T>
from &T
For details on interning, see the module level docs.
The implementation ensures that two equal values return two equal Interned<T>
values.
To use an Interner<T>
, T
must implement Internable
.
Implementations§
source§impl<T: Internable + ?Sized> Interner<T>
impl<T: Internable + ?Sized> Interner<T>
sourcepub fn intern(&self, value: &T) -> Interned<T>
pub fn intern(&self, value: &T) -> Interned<T>
Return the Interned<T>
corresponding to value
.
If it is called the first time for value
, it will possibly leak the value and return an
Interned<T>
using the obtained static reference. Subsequent calls for the same value
will return Interned<T>
using the same static reference.
Trait Implementations§
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for Interner<T>
impl<T: ?Sized> Send for Interner<T>where
T: Sync,
impl<T: ?Sized> Sync for Interner<T>where
T: Sync,
impl<T: ?Sized> Unpin for Interner<T>
impl<T: ?Sized> UnwindSafe for Interner<T>
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