wgpu/api/
query_set.rs

1use std::{sync::Arc, thread};
2
3use crate::*;
4
5/// Handle to a query set.
6///
7/// It can be created with [`Device::create_query_set`].
8///
9/// Corresponds to [WebGPU `GPUQuerySet`](https://gpuweb.github.io/gpuweb/#queryset).
10#[derive(Debug)]
11pub struct QuerySet {
12    pub(crate) context: Arc<C>,
13    pub(crate) data: Box<Data>,
14}
15#[cfg(send_sync)]
16#[cfg(send_sync)]
17static_assertions::assert_impl_all!(QuerySet: Send, Sync);
18
19super::impl_partialeq_eq_hash!(QuerySet);
20
21impl Drop for QuerySet {
22    fn drop(&mut self) {
23        if !thread::panicking() {
24            self.context.query_set_drop(self.data.as_ref());
25        }
26    }
27}
28
29/// Describes a [`QuerySet`].
30///
31/// For use with [`Device::create_query_set`].
32///
33/// Corresponds to [WebGPU `GPUQuerySetDescriptor`](
34/// https://gpuweb.github.io/gpuweb/#dictdef-gpuquerysetdescriptor).
35pub type QuerySetDescriptor<'a> = wgt::QuerySetDescriptor<Label<'a>>;
36static_assertions::assert_impl_all!(QuerySetDescriptor<'_>: Send, Sync);