wgpu_core::identity

Trait IdentityHandler

Source
pub trait IdentityHandler<I>: Debug {
    type Input: Clone + Debug;

    // Required methods
    fn process(&self, id: Self::Input, backend: Backend) -> I;
    fn free(&self, id: I);
}
Expand description

A type that can build true ids from proto-ids, and free true ids.

For some implementations, the true id is based on the proto-id. The caller is responsible for providing well-allocated proto-ids.

For other implementations, the proto-id carries no information (it’s (), say), and this IdentityHandler type takes care of allocating a fresh true id.

See the module-level documentation for details.

Required Associated Types§

Source

type Input: Clone + Debug

The type of proto-id consumed by this filter, to produce a true id.

Required Methods§

Source

fn process(&self, id: Self::Input, backend: Backend) -> I

Given a proto-id value id, return a true id for backend.

Source

fn free(&self, id: I)

Free the true id id.

Implementations on Foreign Types§

Source§

impl<I: TypedId + Debug> IdentityHandler<I> for Mutex<IdentityManager>

Source§

type Input = ()

Source§

fn process(&self, _id: Self::Input, backend: Backend) -> I

Source§

fn free(&self, id: I)

Implementors§