[][src]Struct wgpu_core::track::ResourceTracker

pub struct ResourceTracker<S: ResourceState> { /* fields omitted */ }

A tracker for all resources of a given type.

Methods

impl<S: ResourceState> ResourceTracker<S>[src]

pub fn new(backend: Backend) -> Self[src]

Create a new empty tracker.

pub fn remove(&mut self, id: S::Id) -> bool[src]

Remove an id from the tracked map.

pub fn remove_abandoned(&mut self, id: S::Id) -> bool[src]

Removes the resource from the tracker if we are holding the last reference.

pub fn optimize(&mut self)[src]

Try to optimize the internal representation.

pub fn used<'a>(&'a self) -> impl 'a + Iterator<Item = S::Id>[src]

Return an iterator over used resources keys.

pub fn is_empty(&self) -> bool[src]

Returns true if the tracker is empty.

pub fn init(
    &mut self,
    id: S::Id,
    ref_count: RefCount,
    state: S
) -> Result<(), &S>
[src]

Initialize a resource to be used.

Returns false if the resource is already registered.

pub fn query(&self, id: S::Id, selector: S::Selector) -> Option<S::Usage>[src]

Query the usage of a resource selector.

Returns Some(Usage) only if this usage is consistent across the given selector.

pub fn change_extend(
    &mut self,
    id: S::Id,
    ref_count: &RefCount,
    selector: S::Selector,
    usage: S::Usage
) -> Result<(), PendingTransition<S>>
[src]

Extend the usage of a specified resource.

Returns conflicting transition as an error.

pub fn change_replace(
    &mut self,
    id: S::Id,
    ref_count: &RefCount,
    selector: S::Selector,
    usage: S::Usage
) -> Drain<PendingTransition<S>>
[src]

Replace the usage of a specified resource.

pub fn merge_extend(&mut self, other: &Self) -> Result<(), PendingTransition<S>>[src]

Merge another tracker into self by extending the current states without any transitions.

pub fn merge_replace<'a>(
    &'a mut self,
    other: &'a Self
) -> Drain<PendingTransition<S>>
[src]

Merge another tracker, adding it's transitions to self. Transitions the current usage to the new one.

pub fn use_extend<'a, T: 'a + Borrow<RefCount>>(
    &mut self,
    storage: &'a Storage<T, S::Id>,
    id: S::Id,
    selector: S::Selector,
    usage: S::Usage
) -> Result<&'a T, S::Usage>
[src]

Use a given resource provided by an Id with the specified usage. Combines storage access by 'Id' with the transition that extends the last read-only usage, if possible.

Returns the old usage as an error if there is a conflict.

pub fn use_replace<'a, T: 'a + Borrow<RefCount>>(
    &mut self,
    storage: &'a Storage<T, S::Id>,
    id: S::Id,
    selector: S::Selector,
    usage: S::Usage
) -> (&'a T, Drain<PendingTransition<S>>)
[src]

Use a given resource provided by an Id with the specified usage. Combines storage access by 'Id' with the transition that replaces the last usage with a new one, returning an iterator over these transitions.

Trait Implementations

impl<S: ResourceState + Debug> Debug for ResourceTracker<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for ResourceTracker<S> where
    S: RefUnwindSafe,
    <S as ResourceState>::Id: RefUnwindSafe,
    <S as ResourceState>::Selector: RefUnwindSafe,
    <S as ResourceState>::Usage: RefUnwindSafe

impl<S> Send for ResourceTracker<S> where
    S: Send,
    <S as ResourceState>::Id: Send,
    <S as ResourceState>::Selector: Send,
    <S as ResourceState>::Usage: Send

impl<S> Sync for ResourceTracker<S> where
    S: Sync,
    <S as ResourceState>::Id: Sync,
    <S as ResourceState>::Selector: Sync,
    <S as ResourceState>::Usage: Sync

impl<S> Unpin for ResourceTracker<S> where
    S: Unpin,
    <S as ResourceState>::Id: Unpin,
    <S as ResourceState>::Selector: Unpin,
    <S as ResourceState>::Usage: Unpin

impl<S> UnwindSafe for ResourceTracker<S> where
    S: UnwindSafe,
    <S as ResourceState>::Id: UnwindSafe,
    <S as ResourceState>::Selector: UnwindSafe,
    <S as ResourceState>::Usage: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.