wgpu_types/
tokens.rs

1/// Token of the user agreeing to access experimental features.
2#[derive(Debug, Default, Copy, Clone)]
3pub struct ExperimentalFeatures {
4    enabled: bool,
5}
6
7impl ExperimentalFeatures {
8    /// Uses of [`Features`] prefixed with "EXPERIMENTAL" are disallowed.
9    ///
10    /// [`Features`]: ../wgpu/struct.Features.html
11    pub const fn disabled() -> Self {
12        Self { enabled: false }
13    }
14
15    /// Uses of [`Features`] prefixed with "EXPERIMENTAL" may result
16    /// in undefined behavior when used incorrectly. The exact bounds
17    /// of these issues varies by the feature. These instances are
18    /// inherently bugs in our implementation that we will eventually fix.
19    ///
20    /// By giving access to still work-in-progress APIs, users can get
21    /// access to newer technology sooner, and we can work with users
22    /// to fix bugs quicker.
23    ///
24    /// Look inside our repo at the [`api-specs`] for more information
25    /// on various experimental apis.
26    ///
27    /// # Safety
28    ///
29    /// - You acknowledge that there may be UB-containing bugs in these
30    ///   apis and those may be hit by calling otherwise safe code.
31    /// - You agree to report any such bugs to us, if you find them.
32    ///
33    /// [`Features`]: ../wgpu/struct.Features.html
34    /// [`api-specs`]: https://github.com/gfx-rs/wgpu/tree/trunk/docs/api-specs
35    pub const unsafe fn enabled() -> Self {
36        Self { enabled: true }
37    }
38
39    /// Returns true if the user has agreed to access experimental features.
40    pub const fn is_enabled(&self) -> bool {
41        self.enabled
42    }
43}