Struct wgpu_core::track::TrackerIndexAllocator
source · struct TrackerIndexAllocator {
unused: Vec<TrackerIndex>,
next_index: TrackerIndex,
}
Expand description
wgpu-core internally use some array-like storage for tracking resources. To that end, there needs to be a uniquely assigned index for each live resource of a certain type. This index is separate from the resource ID for various reasons:
- There can be multiple resource IDs pointing the the same resource.
- IDs of dead handles can be recycled while resources are internally held alive (and tracked).
- The plan is to remove IDs in the long run (#5121).
In order to produce these tracker indices, there is a shared TrackerIndexAllocator per resource type. Indices have the same lifetime as the internal resource they are associated to (alloc happens when creating the resource and free is called when the resource is dropped).
Fields§
§unused: Vec<TrackerIndex>
§next_index: TrackerIndex
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrackerIndexAllocator
impl RefUnwindSafe for TrackerIndexAllocator
impl Send for TrackerIndexAllocator
impl Sync for TrackerIndexAllocator
impl Unpin for TrackerIndexAllocator
impl UnwindSafe for TrackerIndexAllocator
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