pub struct Interner<I: Internable> {
map: FastHashMap<I::Key, ItemDetails<I>>,
free_list: Vec<usize>,
update_list: UpdateList<I::Key>,
current_epoch: Epoch,
local_data: Vec<I::InternData>,
}
Expand description
The main interning data structure. This lives in the scene builder thread, and handles hashing and interning unique data structures. It also manages a free-list for the items in the data store, which is synchronized via an update list of additions / removals.
Fields§
§map: FastHashMap<I::Key, ItemDetails<I>>
Uniquely map an interning key to a handle
free_list: Vec<usize>
List of free slots in the data store for re-use.
update_list: UpdateList<I::Key>
Pending list of updates that need to be applied.
current_epoch: Epoch
The current epoch for the interner.
local_data: Vec<I::InternData>
The information associated with each interned item that can be accessed by the interner.
Implementations§
source§impl<I: Internable> Interner<I>
impl<I: Internable> Interner<I>
sourcepub fn intern<F>(&mut self, data: &I::Key, fun: F) -> Handle<I>where
F: FnOnce() -> I::InternData,
pub fn intern<F>(&mut self, data: &I::Key, fun: F) -> Handle<I>where
F: FnOnce() -> I::InternData,
Intern a data structure, and return a handle to that data. The handle can then be stored in the frame builder, and safely accessed via the data store that lives in the frame builder thread. The provided closure is invoked to build the local data about an interned structure if the key isn’t already interned.
sourcepub fn end_frame_and_get_pending_updates(&mut self) -> UpdateList<I::Key>
pub fn end_frame_and_get_pending_updates(&mut self) -> UpdateList<I::Key>
Retrieve the pending list of updates for an interner that need to be applied to the data store. Also run a GC step that removes old entries.
Trait Implementations§
source§impl AsMut<Interner<BackdropCapture>> for Interners
impl AsMut<Interner<BackdropCapture>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<BackdropCapture>
fn as_mut(&mut self) -> &mut Interner<BackdropCapture>
source§impl AsMut<Interner<BackdropRender>> for Interners
impl AsMut<Interner<BackdropRender>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<BackdropRender>
fn as_mut(&mut self) -> &mut Interner<BackdropRender>
source§impl AsMut<Interner<ClipIntern>> for Interners
impl AsMut<Interner<ClipIntern>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<ClipIntern>
fn as_mut(&mut self) -> &mut Interner<ClipIntern>
source§impl AsMut<Interner<ConicGradient>> for Interners
impl AsMut<Interner<ConicGradient>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<ConicGradient>
fn as_mut(&mut self) -> &mut Interner<ConicGradient>
source§impl AsMut<Interner<FilterDataIntern>> for Interners
impl AsMut<Interner<FilterDataIntern>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<FilterDataIntern>
fn as_mut(&mut self) -> &mut Interner<FilterDataIntern>
source§impl AsMut<Interner<ImageBorder>> for Interners
impl AsMut<Interner<ImageBorder>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<ImageBorder>
fn as_mut(&mut self) -> &mut Interner<ImageBorder>
source§impl AsMut<Interner<LineDecoration>> for Interners
impl AsMut<Interner<LineDecoration>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<LineDecoration>
fn as_mut(&mut self) -> &mut Interner<LineDecoration>
source§impl AsMut<Interner<LinearGradient>> for Interners
impl AsMut<Interner<LinearGradient>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<LinearGradient>
fn as_mut(&mut self) -> &mut Interner<LinearGradient>
source§impl AsMut<Interner<NormalBorderPrim>> for Interners
impl AsMut<Interner<NormalBorderPrim>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<NormalBorderPrim>
fn as_mut(&mut self) -> &mut Interner<NormalBorderPrim>
source§impl AsMut<Interner<PolygonIntern>> for Interners
impl AsMut<Interner<PolygonIntern>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<PolygonIntern>
fn as_mut(&mut self) -> &mut Interner<PolygonIntern>
source§impl AsMut<Interner<PrimitiveKeyKind>> for Interners
impl AsMut<Interner<PrimitiveKeyKind>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<PrimitiveKeyKind>
fn as_mut(&mut self) -> &mut Interner<PrimitiveKeyKind>
source§impl AsMut<Interner<RadialGradient>> for Interners
impl AsMut<Interner<RadialGradient>> for Interners
source§fn as_mut(&mut self) -> &mut Interner<RadialGradient>
fn as_mut(&mut self) -> &mut Interner<RadialGradient>
source§impl<I: Internable> Default for Interner<I>
impl<I: Internable> Default for Interner<I>
source§impl<I: Internable> Index<Handle<I>> for Interner<I>
impl<I: Internable> Index<Handle<I>> for Interner<I>
Retrieve the local data for an item from the interner via handle
§type Output = <I as Internable>::InternData
type Output = <I as Internable>::InternData
source§impl<I> MallocSizeOf for Interner<I>where
I: MallocSizeOf + Internable,
impl<I> MallocSizeOf for Interner<I>where
I: MallocSizeOf + Internable,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl<I> Freeze for Interner<I>
impl<I> RefUnwindSafe for Interner<I>where
<I as Internable>::InternData: RefUnwindSafe,
<I as Internable>::Key: RefUnwindSafe,
I: RefUnwindSafe,
impl<I> Send for Interner<I>
impl<I> Sync for Interner<I>
impl<I> Unpin for Interner<I>
impl<I> UnwindSafe for Interner<I>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more