Skip to content

Commit e714cb0

Browse files
andyleisersonErichDonGubler
authored andcommitted
[deno] Format with Deno's rustfmt config
1 parent 099a95b commit e714cb0

24 files changed

+5705
-5478
lines changed

deno_webgpu/adapter.rs

Lines changed: 366 additions & 360 deletions
Large diffs are not rendered by default.

deno_webgpu/bind_group.rs

Lines changed: 64 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -20,97 +20,103 @@ use crate::texture::GPUTextureView;
2020
use crate::Instance;
2121

2222
pub struct GPUBindGroup {
23-
pub instance: Instance,
24-
pub id: wgpu_core::id::BindGroupId,
25-
pub label: String,
23+
pub instance: Instance,
24+
pub id: wgpu_core::id::BindGroupId,
25+
pub label: String,
2626
}
2727

2828
impl Drop for GPUBindGroup {
29-
fn drop(&mut self) {
30-
self.instance.bind_group_drop(self.id);
31-
}
29+
fn drop(&mut self) {
30+
self.instance.bind_group_drop(self.id);
31+
}
3232
}
3333

3434
impl WebIdlInterfaceConverter for GPUBindGroup {
35-
const NAME: &'static str = "GPUBindGroup";
35+
const NAME: &'static str = "GPUBindGroup";
3636
}
3737

3838
impl GarbageCollected for GPUBindGroup {}
3939

4040
#[op2]
4141
impl GPUBindGroup {
42-
#[getter]
43-
#[string]
44-
fn label(&self) -> String {
45-
self.label.clone()
46-
}
47-
#[setter]
48-
#[string]
49-
fn label(&self, #[webidl] _label: String) {
50-
// TODO(@crowlKats): no-op, needs wpgu to implement changing the label
51-
}
42+
#[getter]
43+
#[string]
44+
fn label(&self) -> String {
45+
self.label.clone()
46+
}
47+
#[setter]
48+
#[string]
49+
fn label(&self, #[webidl] _label: String) {
50+
// TODO(@crowlKats): no-op, needs wpgu to implement changing the label
51+
}
5252
}
5353

5454
#[derive(WebIDL)]
5555
#[webidl(dictionary)]
5656
pub(crate) struct GPUBindGroupDescriptor {
57-
#[webidl(default = String::new())]
58-
pub label: String,
57+
#[webidl(default = String::new())]
58+
pub label: String,
5959

60-
pub layout: Ptr<super::bind_group_layout::GPUBindGroupLayout>,
61-
pub entries: Vec<GPUBindGroupEntry>,
60+
pub layout: Ptr<super::bind_group_layout::GPUBindGroupLayout>,
61+
pub entries: Vec<GPUBindGroupEntry>,
6262
}
6363

6464
#[derive(WebIDL)]
6565
#[webidl(dictionary)]
6666
pub(crate) struct GPUBindGroupEntry {
67-
#[options(enforce_range = true)]
68-
pub binding: u32,
69-
pub resource: GPUBindingResource,
67+
#[options(enforce_range = true)]
68+
pub binding: u32,
69+
pub resource: GPUBindingResource,
7070
}
7171

7272
#[derive(WebIDL)]
7373
#[webidl(dictionary)]
7474
pub(crate) struct GPUBufferBinding {
75-
pub buffer: Ptr<GPUBuffer>,
76-
#[webidl(default = 0)]
77-
#[options(enforce_range = true)]
78-
pub offset: u64,
79-
#[options(enforce_range = true)]
80-
pub size: Option<u64>,
75+
pub buffer: Ptr<GPUBuffer>,
76+
#[webidl(default = 0)]
77+
#[options(enforce_range = true)]
78+
pub offset: u64,
79+
#[options(enforce_range = true)]
80+
pub size: Option<u64>,
8181
}
8282

8383
pub(crate) enum GPUBindingResource {
84-
Sampler(Ptr<GPUSampler>),
85-
TextureView(Ptr<GPUTextureView>),
86-
BufferBinding(GPUBufferBinding),
84+
Sampler(Ptr<GPUSampler>),
85+
TextureView(Ptr<GPUTextureView>),
86+
BufferBinding(GPUBufferBinding),
8787
}
8888

8989
impl<'a> WebIdlConverter<'a> for GPUBindingResource {
90-
type Options = ();
90+
type Options = ();
9191

92-
fn convert<'b>(
93-
scope: &mut HandleScope<'a>,
94-
value: Local<'a, Value>,
95-
prefix: Cow<'static, str>,
96-
context: ContextFn<'b>,
97-
options: &Self::Options,
98-
) -> Result<Self, WebIdlError> {
99-
<Ptr<GPUSampler>>::convert(scope, value, prefix.clone(), context.borrowed(), options)
100-
.map(Self::Sampler)
101-
.or_else(|_| {
102-
<Ptr<GPUTextureView>>::convert(
103-
scope,
104-
value,
105-
prefix.clone(),
106-
context.borrowed(),
107-
options,
108-
)
109-
.map(Self::TextureView)
110-
})
111-
.or_else(|_| {
112-
GPUBufferBinding::convert(scope, value, prefix, context, options)
113-
.map(Self::BufferBinding)
114-
})
115-
}
92+
fn convert<'b>(
93+
scope: &mut HandleScope<'a>,
94+
value: Local<'a, Value>,
95+
prefix: Cow<'static, str>,
96+
context: ContextFn<'b>,
97+
options: &Self::Options,
98+
) -> Result<Self, WebIdlError> {
99+
<Ptr<GPUSampler>>::convert(
100+
scope,
101+
value,
102+
prefix.clone(),
103+
context.borrowed(),
104+
options,
105+
)
106+
.map(Self::Sampler)
107+
.or_else(|_| {
108+
<Ptr<GPUTextureView>>::convert(
109+
scope,
110+
value,
111+
prefix.clone(),
112+
context.borrowed(),
113+
options,
114+
)
115+
.map(Self::TextureView)
116+
})
117+
.or_else(|_| {
118+
GPUBufferBinding::convert(scope, value, prefix, context, options)
119+
.map(Self::BufferBinding)
120+
})
121+
}
116122
}

0 commit comments

Comments
 (0)