wgpu_core/
storage.rs

1use alloc::sync::Arc;
2
3use crate::id::Marker;
4use crate::resource::ResourceType;
5use wgpu_sync::Mutex;
6
7/// Not a public API. For use only by `player`.
8#[doc(hidden)]
9pub trait StorageItem: ResourceType {
10    type Marker: Marker;
11}
12
13impl<T: ResourceType> ResourceType for Arc<T> {
14    const TYPE: &'static str = T::TYPE;
15}
16
17impl<T: StorageItem> StorageItem for Arc<T> {
18    type Marker = T::Marker;
19}
20
21impl<T: ResourceType> ResourceType for Mutex<T> {
22    const TYPE: &'static str = T::TYPE;
23}
24
25impl<T: StorageItem> StorageItem for Mutex<T> {
26    type Marker = T::Marker;
27}
28
29#[macro_export]
30macro_rules! impl_storage_item {
31    ($ty:ident) => {
32        impl $crate::storage::StorageItem for $ty {
33            type Marker = $crate::id::markers::$ty;
34        }
35    };
36}