1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
use super::*;
/// The GPUTexture class.
/// [`GPUTexture`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct GPUTexture {
inner: Any,
}
impl FromVal for GPUTexture {
fn from_val(v: &Any) -> Self {
GPUTexture {
inner: Any::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for GPUTexture {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for GPUTexture {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for GPUTexture {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for GPUTexture {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<GPUTexture> for Any {
fn from(s: GPUTexture) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&GPUTexture> for Any {
fn from(s: &GPUTexture) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(GPUTexture);
impl GPUTexture {
/// Getter of the `width` attribute.
/// [`GPUTexture.width`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/width)
pub fn width(&self) -> Any {
self.inner.get("width").as_::<Any>()
}
}
impl GPUTexture {
/// Getter of the `height` attribute.
/// [`GPUTexture.height`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/height)
pub fn height(&self) -> Any {
self.inner.get("height").as_::<Any>()
}
}
impl GPUTexture {
/// Getter of the `depthOrArrayLayers` attribute.
/// [`GPUTexture.depthOrArrayLayers`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/depthOrArrayLayers)
pub fn depth_or_array_layers(&self) -> Any {
self.inner.get("depthOrArrayLayers").as_::<Any>()
}
}
impl GPUTexture {
/// Getter of the `mipLevelCount` attribute.
/// [`GPUTexture.mipLevelCount`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/mipLevelCount)
pub fn mip_level_count(&self) -> Any {
self.inner.get("mipLevelCount").as_::<Any>()
}
}
impl GPUTexture {
/// Getter of the `sampleCount` attribute.
/// [`GPUTexture.sampleCount`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/sampleCount)
pub fn sample_count(&self) -> Any {
self.inner.get("sampleCount").as_::<Any>()
}
}
impl GPUTexture {
/// Getter of the `dimension` attribute.
/// [`GPUTexture.dimension`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/dimension)
pub fn dimension(&self) -> GPUTextureDimension {
self.inner.get("dimension").as_::<GPUTextureDimension>()
}
}
impl GPUTexture {
/// Getter of the `format` attribute.
/// [`GPUTexture.format`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/format)
pub fn format(&self) -> GPUTextureFormat {
self.inner.get("format").as_::<GPUTextureFormat>()
}
}
impl GPUTexture {
/// Getter of the `usage` attribute.
/// [`GPUTexture.usage`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/usage)
pub fn usage(&self) -> Any {
self.inner.get("usage").as_::<Any>()
}
}
impl GPUTexture {
/// Getter of the `label` attribute.
/// [`GPUTexture.label`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/label)
pub fn label(&self) -> JsString {
self.inner.get("label").as_::<JsString>()
}
/// Setter of the `label` attribute.
/// [`GPUTexture.label`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/label)
pub fn set_label(&mut self, value: &JsString) {
self.inner.set("label", value);
}
}
impl GPUTexture {
/// The createView method.
/// [`GPUTexture.createView`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/createView)
pub fn create_view(&self) -> GPUTextureView {
self.inner.call("createView", &[]).as_::<GPUTextureView>()
}
}
impl GPUTexture {
/// The createView method.
/// [`GPUTexture.createView`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/createView)
pub fn create_view_with_descriptor(
&self,
descriptor: &GPUTextureViewDescriptor,
) -> GPUTextureView {
self.inner
.call("createView", &[descriptor.into()])
.as_::<GPUTextureView>()
}
}
impl GPUTexture {
/// The destroy method.
/// [`GPUTexture.destroy`](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/destroy)
pub fn destroy(&self) -> Undefined {
self.inner.call("destroy", &[]).as_::<Undefined>()
}
}