[][src]Struct wgpu_conveyor::BindGroupCache

pub struct BindGroupCache<Key: Hash + Eq + Clone> { /* fields omitted */ }

Bind group cache. Corresponds to a single bind group.

If you use multiple bind groups in a single cache, you will likely have cache misses constantly.

Implementations

impl<Key: Hash + Eq + Clone> BindGroupCache<Key>[src]

#[must_use]pub fn new() -> Self[src]

Create a bind group cache with default size 4.

#[must_use]pub fn with_capacity(size: usize) -> Self[src]

Create a bind group cache with given size.

pub fn clear(&mut self)[src]

Empty cache to force repopulation

pub fn create_bind_group<'a, Set, BindGroupFn>(
    &mut self,
    buffers: Set,
    use_cache: bool,
    bind_group_fn: BindGroupFn
) -> Key where
    Set: AutomatedBufferSet<'a, Key = Key>,
    BindGroupFn: FnOnce(&Set::Value) -> BindGroup
[src]

Using the set of AutomatedBuffers provided in buffers, create or retrieve a bind group and return the key to call get with.

If a bind group is not found, bind_group_fn will be called with the resolved BeltBufferId for the given buffers.

This result will then be cached.

use_cache, if false, will always call the function and overwrite the value (if any) in the cache. This is useful if bind groups are changing every invocation.

pub fn get(&self, key: &Key) -> Option<&BindGroup>[src]

Trait Implementations

impl<Key: Hash + Eq + Clone> Default for BindGroupCache<Key>[src]

Auto Trait Implementations

impl<Key> !RefUnwindSafe for BindGroupCache<Key>

impl<Key> Send for BindGroupCache<Key> where
    Key: Send

impl<Key> Sync for BindGroupCache<Key> where
    Key: Sync

impl<Key> Unpin for BindGroupCache<Key>

impl<Key> !UnwindSafe for BindGroupCache<Key>

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.