pub(crate) struct StatelessTracker<A: HalApi, T, Id: TypedId> {
    metadata: ResourceMetadata<A>,
    _phantom: PhantomData<(T, Id)>,
}
Expand description

Stores all resource state within a command buffer or device.

Fields§

§metadata: ResourceMetadata<A>§_phantom: PhantomData<(T, Id)>

Implementations§

source§

impl<A: HalApi, T: Resource, Id: TypedId> StatelessTracker<A, T, Id>

source

pub fn new() -> Self

source

fn tracker_assert_in_bounds(&self, index: usize)

source

pub fn set_size(&mut self, size: usize)

Sets the size of all the vectors inside the tracker.

Must be called with the highest possible Resource ID of this type before all unsafe functions are called.

source

fn allow_index(&mut self, index: usize)

Extend the vectors to let the given index be valid.

source

pub fn used(&self) -> impl Iterator<Item = Valid<Id>> + '_

Returns a list of all resources tracked.

source

pub fn insert_single(&mut self, id: Valid<Id>, ref_count: RefCount)

Inserts a single resource into the resource tracker.

If the resource already exists in the tracker, it will be overwritten.

If the ID is higher than the length of internal vectors, the vectors will be extended. A call to set_size is not needed.

source

pub fn add_single<'a>( &mut self, storage: &'a Storage<T, Id>, id: Id ) -> Option<&'a T>

Adds the given resource to the tracker.

If the ID is higher than the length of internal vectors, the vectors will be extended. A call to set_size is not needed.

source

pub fn add_from_tracker(&mut self, other: &Self)

Adds the given resources from the given tracker.

If the ID is higher than the length of internal vectors, the vectors will be extended. A call to set_size is not needed.

source

pub fn remove_abandoned(&mut self, id: Valid<Id>) -> bool

Removes the given resource from the tracker iff we have the last reference to the resource and the epoch matches.

Returns true if the resource was removed.

If the ID is higher than the length of internal vectors, false will be returned.

Auto Trait Implementations§

§

impl<A, T, Id> RefUnwindSafe for StatelessTracker<A, T, Id>where A: RefUnwindSafe, Id: RefUnwindSafe, T: RefUnwindSafe,

§

impl<A, T, Id> Send for StatelessTracker<A, T, Id>where A: Send, Id: Send, T: Send,

§

impl<A, T, Id> Sync for StatelessTracker<A, T, Id>where A: Sync, Id: Sync, T: Sync,

§

impl<A, T, Id> Unpin for StatelessTracker<A, T, Id>where A: Unpin, Id: Unpin, T: Unpin,

§

impl<A, T, Id> UnwindSafe for StatelessTracker<A, T, Id>where A: UnwindSafe, Id: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WasmNotSend for Twhere T: Send,

source§

impl<T> WasmNotSync for Twhere T: Sync,