quickgpu/builders/
texture_view_descriptor_builder.rs

1// The code in this file is generated by a script. Do not edit it directly.
2//
3
4pub use super::super::Nested;
5pub use std::{borrow::Cow, num::NonZeroU32, ops::Range};
6pub trait Field {}
7pub trait IsOptional {}
8#[doc = "\nBuilder for [`wgpu::TextureViewDescriptor`]\n        \nSet all required fields and any optional fields, then call `build()`.\n\nBuilder field setters:\n  - [format](TextureViewDescriptorBuilder::format) Optional, defaults to `None`\n  - [dimension](TextureViewDescriptorBuilder::dimension) Optional, defaults to `None`\n  - [usage](TextureViewDescriptorBuilder::usage) Optional, defaults to `None`\n  - [aspect](TextureViewDescriptorBuilder::aspect) Optional, defaults to [wgpu::TextureAspect::All]\n  - [base_mip_level](TextureViewDescriptorBuilder::base_mip_level) Optional, defaults to `0u32`\n  - [mip_level_count](TextureViewDescriptorBuilder::mip_level_count) Optional, defaults to `None`\n  - [base_array_layer](TextureViewDescriptorBuilder::base_array_layer) Optional, defaults to `0u32`\n  - [array_layer_count](TextureViewDescriptorBuilder::array_layer_count) Optional, defaults to `None`\n"]
9pub struct TextureViewDescriptorBuilder<'a, CS: State<'a>> {
10    label: CS::Label,
11    format: CS::Format,
12    dimension: CS::Dimension,
13    usage: CS::Usage,
14    aspect: CS::Aspect,
15    base_mip_level: CS::BaseMipLevel,
16    mip_level_count: CS::MipLevelCount,
17    base_array_layer: CS::BaseArrayLayer,
18    array_layer_count: CS::ArrayLayerCount,
19}
20impl<'a> TextureViewDescriptorBuilder<'a, Empty> {
21    pub fn new() -> TextureViewDescriptorBuilder<'a, Empty> {
22        TextureViewDescriptorBuilder {
23            label: LabelEmpty,
24            format: FormatEmpty,
25            dimension: DimensionEmpty,
26            usage: UsageEmpty,
27            aspect: AspectEmpty,
28            base_mip_level: BaseMipLevelEmpty,
29            mip_level_count: MipLevelCountEmpty,
30            base_array_layer: BaseArrayLayerEmpty,
31            array_layer_count: ArrayLayerCountEmpty,
32        }
33    }
34}
35#[doc = "\nReturns [TextureViewDescriptorBuilder] for building [`wgpu::TextureViewDescriptor`]\n        \nSet all required fields and any optional fields, then call `build()`.\n\nBuilder field setters:\n  - [format](TextureViewDescriptorBuilder::format) Optional, defaults to `None`\n  - [dimension](TextureViewDescriptorBuilder::dimension) Optional, defaults to `None`\n  - [usage](TextureViewDescriptorBuilder::usage) Optional, defaults to `None`\n  - [aspect](TextureViewDescriptorBuilder::aspect) Optional, defaults to [wgpu::TextureAspect::All]\n  - [base_mip_level](TextureViewDescriptorBuilder::base_mip_level) Optional, defaults to `0u32`\n  - [mip_level_count](TextureViewDescriptorBuilder::mip_level_count) Optional, defaults to `None`\n  - [base_array_layer](TextureViewDescriptorBuilder::base_array_layer) Optional, defaults to `0u32`\n  - [array_layer_count](TextureViewDescriptorBuilder::array_layer_count) Optional, defaults to `None`\n"]
36pub fn texture_view_descriptor<'a>(
37    label: wgpu::Label<'a>,
38) -> TextureViewDescriptorBuilder<'a, SetLabel<Empty>> {
39    TextureViewDescriptorBuilder::new().label(label)
40}
41pub struct LabelEmpty;
42impl Field for LabelEmpty {}
43pub trait LabelIsEmpty {}
44impl LabelIsEmpty for LabelEmpty {}
45pub trait IsSetLabel<'a> {
46    fn get(self) -> wgpu::Label<'a>;
47}
48impl<'a> IsSetLabel<'a> for LabelEmpty {
49    fn get(self) -> wgpu::Label<'a> {
50        None
51    }
52}
53pub struct LabelValue<'a>(pub wgpu::Label<'a>);
54impl<'a> Field for LabelValue<'a> {}
55impl<'a> IsSetLabel<'a> for LabelValue<'a> {
56    fn get(self) -> wgpu::Label<'a> {
57        self.0
58    }
59}
60pub struct FormatEmpty;
61impl Field for FormatEmpty {}
62pub trait FormatIsEmpty {}
63impl FormatIsEmpty for FormatEmpty {}
64pub trait IsSetFormat {
65    fn get(self) -> Option<wgpu::TextureFormat>;
66}
67impl IsSetFormat for FormatEmpty {
68    fn get(self) -> Option<wgpu::TextureFormat> {
69        None
70    }
71}
72pub struct FormatValue(pub Option<wgpu::TextureFormat>);
73impl Field for FormatValue {}
74impl IsSetFormat for FormatValue {
75    fn get(self) -> Option<wgpu::TextureFormat> {
76        self.0
77    }
78}
79pub struct DimensionEmpty;
80impl Field for DimensionEmpty {}
81pub trait DimensionIsEmpty {}
82impl DimensionIsEmpty for DimensionEmpty {}
83pub trait IsSetDimension {
84    fn get(self) -> Option<wgpu::TextureViewDimension>;
85}
86impl IsSetDimension for DimensionEmpty {
87    fn get(self) -> Option<wgpu::TextureViewDimension> {
88        None
89    }
90}
91pub struct DimensionValue(pub Option<wgpu::TextureViewDimension>);
92impl Field for DimensionValue {}
93impl IsSetDimension for DimensionValue {
94    fn get(self) -> Option<wgpu::TextureViewDimension> {
95        self.0
96    }
97}
98pub struct UsageEmpty;
99impl Field for UsageEmpty {}
100pub trait UsageIsEmpty {}
101impl UsageIsEmpty for UsageEmpty {}
102pub trait IsSetUsage {
103    fn get(self) -> Option<wgpu::TextureUsages>;
104}
105impl IsSetUsage for UsageEmpty {
106    fn get(self) -> Option<wgpu::TextureUsages> {
107        None
108    }
109}
110pub struct UsageValue(pub Option<wgpu::TextureUsages>);
111impl Field for UsageValue {}
112impl IsSetUsage for UsageValue {
113    fn get(self) -> Option<wgpu::TextureUsages> {
114        self.0
115    }
116}
117pub struct AspectEmpty;
118impl Field for AspectEmpty {}
119pub trait AspectIsEmpty {}
120impl AspectIsEmpty for AspectEmpty {}
121pub trait IsSetAspect {
122    fn get(self) -> wgpu::TextureAspect;
123}
124impl IsSetAspect for AspectEmpty {
125    fn get(self) -> wgpu::TextureAspect {
126        wgpu::TextureAspect::All
127    }
128}
129pub struct AspectValue(pub wgpu::TextureAspect);
130impl Field for AspectValue {}
131impl IsSetAspect for AspectValue {
132    fn get(self) -> wgpu::TextureAspect {
133        self.0
134    }
135}
136pub struct BaseMipLevelEmpty;
137impl Field for BaseMipLevelEmpty {}
138pub trait BaseMipLevelIsEmpty {}
139impl BaseMipLevelIsEmpty for BaseMipLevelEmpty {}
140pub trait IsSetBaseMipLevel {
141    fn get(self) -> u32;
142}
143impl IsSetBaseMipLevel for BaseMipLevelEmpty {
144    fn get(self) -> u32 {
145        0u32
146    }
147}
148pub struct BaseMipLevelValue(pub u32);
149impl Field for BaseMipLevelValue {}
150impl IsSetBaseMipLevel for BaseMipLevelValue {
151    fn get(self) -> u32 {
152        self.0
153    }
154}
155pub struct MipLevelCountEmpty;
156impl Field for MipLevelCountEmpty {}
157pub trait MipLevelCountIsEmpty {}
158impl MipLevelCountIsEmpty for MipLevelCountEmpty {}
159pub trait IsSetMipLevelCount {
160    fn get(self) -> Option<u32>;
161}
162impl IsSetMipLevelCount for MipLevelCountEmpty {
163    fn get(self) -> Option<u32> {
164        None
165    }
166}
167pub struct MipLevelCountValue(pub Option<u32>);
168impl Field for MipLevelCountValue {}
169impl IsSetMipLevelCount for MipLevelCountValue {
170    fn get(self) -> Option<u32> {
171        self.0
172    }
173}
174pub struct BaseArrayLayerEmpty;
175impl Field for BaseArrayLayerEmpty {}
176pub trait BaseArrayLayerIsEmpty {}
177impl BaseArrayLayerIsEmpty for BaseArrayLayerEmpty {}
178pub trait IsSetBaseArrayLayer {
179    fn get(self) -> u32;
180}
181impl IsSetBaseArrayLayer for BaseArrayLayerEmpty {
182    fn get(self) -> u32 {
183        0u32
184    }
185}
186pub struct BaseArrayLayerValue(pub u32);
187impl Field for BaseArrayLayerValue {}
188impl IsSetBaseArrayLayer for BaseArrayLayerValue {
189    fn get(self) -> u32 {
190        self.0
191    }
192}
193pub struct ArrayLayerCountEmpty;
194impl Field for ArrayLayerCountEmpty {}
195pub trait ArrayLayerCountIsEmpty {}
196impl ArrayLayerCountIsEmpty for ArrayLayerCountEmpty {}
197pub trait IsSetArrayLayerCount {
198    fn get(self) -> Option<u32>;
199}
200impl IsSetArrayLayerCount for ArrayLayerCountEmpty {
201    fn get(self) -> Option<u32> {
202        None
203    }
204}
205pub struct ArrayLayerCountValue(pub Option<u32>);
206impl Field for ArrayLayerCountValue {}
207impl IsSetArrayLayerCount for ArrayLayerCountValue {
208    fn get(self) -> Option<u32> {
209        self.0
210    }
211}
212pub trait State<'a> {
213    type Label: Field;
214    type Format: Field;
215    type Dimension: Field;
216    type Usage: Field;
217    type Aspect: Field;
218    type BaseMipLevel: Field;
219    type MipLevelCount: Field;
220    type BaseArrayLayer: Field;
221    type ArrayLayerCount: Field;
222}
223pub struct Empty;
224impl<'a> State<'a> for Empty {
225    type Label = LabelEmpty;
226    type Format = FormatEmpty;
227    type Dimension = DimensionEmpty;
228    type Usage = UsageEmpty;
229    type Aspect = AspectEmpty;
230    type BaseMipLevel = BaseMipLevelEmpty;
231    type MipLevelCount = MipLevelCountEmpty;
232    type BaseArrayLayer = BaseArrayLayerEmpty;
233    type ArrayLayerCount = ArrayLayerCountEmpty;
234}
235pub struct SetLabel<CS>(CS);
236impl<'a, CS: State<'a>> State<'a> for SetLabel<CS> {
237    type Label = LabelValue<'a>;
238    type Format = CS::Format;
239    type Dimension = CS::Dimension;
240    type Usage = CS::Usage;
241    type Aspect = CS::Aspect;
242    type BaseMipLevel = CS::BaseMipLevel;
243    type MipLevelCount = CS::MipLevelCount;
244    type BaseArrayLayer = CS::BaseArrayLayer;
245    type ArrayLayerCount = CS::ArrayLayerCount;
246}
247pub struct SetFormat<CS>(CS);
248impl<'a, CS: State<'a>> State<'a> for SetFormat<CS> {
249    type Label = CS::Label;
250    type Format = FormatValue;
251    type Dimension = CS::Dimension;
252    type Usage = CS::Usage;
253    type Aspect = CS::Aspect;
254    type BaseMipLevel = CS::BaseMipLevel;
255    type MipLevelCount = CS::MipLevelCount;
256    type BaseArrayLayer = CS::BaseArrayLayer;
257    type ArrayLayerCount = CS::ArrayLayerCount;
258}
259pub struct SetDimension<CS>(CS);
260impl<'a, CS: State<'a>> State<'a> for SetDimension<CS> {
261    type Label = CS::Label;
262    type Format = CS::Format;
263    type Dimension = DimensionValue;
264    type Usage = CS::Usage;
265    type Aspect = CS::Aspect;
266    type BaseMipLevel = CS::BaseMipLevel;
267    type MipLevelCount = CS::MipLevelCount;
268    type BaseArrayLayer = CS::BaseArrayLayer;
269    type ArrayLayerCount = CS::ArrayLayerCount;
270}
271pub struct SetUsage<CS>(CS);
272impl<'a, CS: State<'a>> State<'a> for SetUsage<CS> {
273    type Label = CS::Label;
274    type Format = CS::Format;
275    type Dimension = CS::Dimension;
276    type Usage = UsageValue;
277    type Aspect = CS::Aspect;
278    type BaseMipLevel = CS::BaseMipLevel;
279    type MipLevelCount = CS::MipLevelCount;
280    type BaseArrayLayer = CS::BaseArrayLayer;
281    type ArrayLayerCount = CS::ArrayLayerCount;
282}
283pub struct SetAspect<CS>(CS);
284impl<'a, CS: State<'a>> State<'a> for SetAspect<CS> {
285    type Label = CS::Label;
286    type Format = CS::Format;
287    type Dimension = CS::Dimension;
288    type Usage = CS::Usage;
289    type Aspect = AspectValue;
290    type BaseMipLevel = CS::BaseMipLevel;
291    type MipLevelCount = CS::MipLevelCount;
292    type BaseArrayLayer = CS::BaseArrayLayer;
293    type ArrayLayerCount = CS::ArrayLayerCount;
294}
295pub struct SetBaseMipLevel<CS>(CS);
296impl<'a, CS: State<'a>> State<'a> for SetBaseMipLevel<CS> {
297    type Label = CS::Label;
298    type Format = CS::Format;
299    type Dimension = CS::Dimension;
300    type Usage = CS::Usage;
301    type Aspect = CS::Aspect;
302    type BaseMipLevel = BaseMipLevelValue;
303    type MipLevelCount = CS::MipLevelCount;
304    type BaseArrayLayer = CS::BaseArrayLayer;
305    type ArrayLayerCount = CS::ArrayLayerCount;
306}
307pub struct SetMipLevelCount<CS>(CS);
308impl<'a, CS: State<'a>> State<'a> for SetMipLevelCount<CS> {
309    type Label = CS::Label;
310    type Format = CS::Format;
311    type Dimension = CS::Dimension;
312    type Usage = CS::Usage;
313    type Aspect = CS::Aspect;
314    type BaseMipLevel = CS::BaseMipLevel;
315    type MipLevelCount = MipLevelCountValue;
316    type BaseArrayLayer = CS::BaseArrayLayer;
317    type ArrayLayerCount = CS::ArrayLayerCount;
318}
319pub struct SetBaseArrayLayer<CS>(CS);
320impl<'a, CS: State<'a>> State<'a> for SetBaseArrayLayer<CS> {
321    type Label = CS::Label;
322    type Format = CS::Format;
323    type Dimension = CS::Dimension;
324    type Usage = CS::Usage;
325    type Aspect = CS::Aspect;
326    type BaseMipLevel = CS::BaseMipLevel;
327    type MipLevelCount = CS::MipLevelCount;
328    type BaseArrayLayer = BaseArrayLayerValue;
329    type ArrayLayerCount = CS::ArrayLayerCount;
330}
331pub struct SetArrayLayerCount<CS>(CS);
332impl<'a, CS: State<'a>> State<'a> for SetArrayLayerCount<CS> {
333    type Label = CS::Label;
334    type Format = CS::Format;
335    type Dimension = CS::Dimension;
336    type Usage = CS::Usage;
337    type Aspect = CS::Aspect;
338    type BaseMipLevel = CS::BaseMipLevel;
339    type MipLevelCount = CS::MipLevelCount;
340    type BaseArrayLayer = CS::BaseArrayLayer;
341    type ArrayLayerCount = ArrayLayerCountValue;
342}
343impl<'a, CS: State<'a>> TextureViewDescriptorBuilder<'a, CS> {
344    #[doc = "Setter for [wgpu::TextureViewDescriptor::label]. Optional, defaults to `None`.\n"]
345    pub fn label(self, label: wgpu::Label<'a>) -> TextureViewDescriptorBuilder<'a, SetLabel<CS>>
346    where
347        CS::Label: LabelIsEmpty,
348    {
349        TextureViewDescriptorBuilder {
350            label: LabelValue(label),
351            format: self.format,
352            dimension: self.dimension,
353            usage: self.usage,
354            aspect: self.aspect,
355            base_mip_level: self.base_mip_level,
356            mip_level_count: self.mip_level_count,
357            base_array_layer: self.base_array_layer,
358            array_layer_count: self.array_layer_count,
359        }
360    }
361    #[doc = "Setter for [wgpu::TextureViewDescriptor::format]. Optional, defaults to `None`.\n"]
362    pub fn format(
363        self,
364        format: wgpu::TextureFormat,
365    ) -> TextureViewDescriptorBuilder<'a, SetFormat<CS>>
366    where
367        CS::Format: FormatIsEmpty,
368    {
369        TextureViewDescriptorBuilder {
370            label: self.label,
371            format: FormatValue(Some(format)),
372            dimension: self.dimension,
373            usage: self.usage,
374            aspect: self.aspect,
375            base_mip_level: self.base_mip_level,
376            mip_level_count: self.mip_level_count,
377            base_array_layer: self.base_array_layer,
378            array_layer_count: self.array_layer_count,
379        }
380    }
381    #[doc = "Setter for [wgpu::TextureViewDescriptor::format]. Optional, defaults to `None`.\n"]
382    pub fn maybe_format(
383        self,
384        format: Option<wgpu::TextureFormat>,
385    ) -> TextureViewDescriptorBuilder<'a, SetFormat<CS>>
386    where
387        CS::Format: FormatIsEmpty,
388    {
389        TextureViewDescriptorBuilder {
390            label: self.label,
391            format: FormatValue(format),
392            dimension: self.dimension,
393            usage: self.usage,
394            aspect: self.aspect,
395            base_mip_level: self.base_mip_level,
396            mip_level_count: self.mip_level_count,
397            base_array_layer: self.base_array_layer,
398            array_layer_count: self.array_layer_count,
399        }
400    }
401    #[doc = "Setter for [wgpu::TextureViewDescriptor::dimension]. Optional, defaults to `None`.\n"]
402    pub fn dimension(
403        self,
404        dimension: wgpu::TextureViewDimension,
405    ) -> TextureViewDescriptorBuilder<'a, SetDimension<CS>>
406    where
407        CS::Dimension: DimensionIsEmpty,
408    {
409        TextureViewDescriptorBuilder {
410            label: self.label,
411            format: self.format,
412            dimension: DimensionValue(Some(dimension)),
413            usage: self.usage,
414            aspect: self.aspect,
415            base_mip_level: self.base_mip_level,
416            mip_level_count: self.mip_level_count,
417            base_array_layer: self.base_array_layer,
418            array_layer_count: self.array_layer_count,
419        }
420    }
421    #[doc = "Setter for [wgpu::TextureViewDescriptor::dimension]. Optional, defaults to `None`.\n"]
422    pub fn maybe_dimension(
423        self,
424        dimension: Option<wgpu::TextureViewDimension>,
425    ) -> TextureViewDescriptorBuilder<'a, SetDimension<CS>>
426    where
427        CS::Dimension: DimensionIsEmpty,
428    {
429        TextureViewDescriptorBuilder {
430            label: self.label,
431            format: self.format,
432            dimension: DimensionValue(dimension),
433            usage: self.usage,
434            aspect: self.aspect,
435            base_mip_level: self.base_mip_level,
436            mip_level_count: self.mip_level_count,
437            base_array_layer: self.base_array_layer,
438            array_layer_count: self.array_layer_count,
439        }
440    }
441    #[doc = "Setter for [wgpu::TextureViewDescriptor::usage]. Optional, defaults to `None`.\n"]
442    pub fn usage(self, usage: wgpu::TextureUsages) -> TextureViewDescriptorBuilder<'a, SetUsage<CS>>
443    where
444        CS::Usage: UsageIsEmpty,
445    {
446        TextureViewDescriptorBuilder {
447            label: self.label,
448            format: self.format,
449            dimension: self.dimension,
450            usage: UsageValue(Some(usage)),
451            aspect: self.aspect,
452            base_mip_level: self.base_mip_level,
453            mip_level_count: self.mip_level_count,
454            base_array_layer: self.base_array_layer,
455            array_layer_count: self.array_layer_count,
456        }
457    }
458    #[doc = "Setter for [wgpu::TextureViewDescriptor::usage]. Optional, defaults to `None`.\n"]
459    pub fn maybe_usage(
460        self,
461        usage: Option<wgpu::TextureUsages>,
462    ) -> TextureViewDescriptorBuilder<'a, SetUsage<CS>>
463    where
464        CS::Usage: UsageIsEmpty,
465    {
466        TextureViewDescriptorBuilder {
467            label: self.label,
468            format: self.format,
469            dimension: self.dimension,
470            usage: UsageValue(usage),
471            aspect: self.aspect,
472            base_mip_level: self.base_mip_level,
473            mip_level_count: self.mip_level_count,
474            base_array_layer: self.base_array_layer,
475            array_layer_count: self.array_layer_count,
476        }
477    }
478    #[doc = "Setter for [wgpu::TextureViewDescriptor::aspect]. Optional, defaults to [wgpu::TextureAspect::All].\n"]
479    pub fn aspect(
480        self,
481        aspect: wgpu::TextureAspect,
482    ) -> TextureViewDescriptorBuilder<'a, SetAspect<CS>>
483    where
484        CS::Aspect: AspectIsEmpty,
485    {
486        TextureViewDescriptorBuilder {
487            label: self.label,
488            format: self.format,
489            dimension: self.dimension,
490            usage: self.usage,
491            aspect: AspectValue(aspect),
492            base_mip_level: self.base_mip_level,
493            mip_level_count: self.mip_level_count,
494            base_array_layer: self.base_array_layer,
495            array_layer_count: self.array_layer_count,
496        }
497    }
498    #[doc = "Setter for [wgpu::TextureViewDescriptor::base_mip_level]. Optional, defaults to `0u32`.\n"]
499    pub fn base_mip_level(
500        self,
501        base_mip_level: u32,
502    ) -> TextureViewDescriptorBuilder<'a, SetBaseMipLevel<CS>>
503    where
504        CS::BaseMipLevel: BaseMipLevelIsEmpty,
505    {
506        TextureViewDescriptorBuilder {
507            label: self.label,
508            format: self.format,
509            dimension: self.dimension,
510            usage: self.usage,
511            aspect: self.aspect,
512            base_mip_level: BaseMipLevelValue(base_mip_level),
513            mip_level_count: self.mip_level_count,
514            base_array_layer: self.base_array_layer,
515            array_layer_count: self.array_layer_count,
516        }
517    }
518    #[doc = "Setter for [wgpu::TextureViewDescriptor::mip_level_count]. Optional, defaults to `None`.\n"]
519    pub fn mip_level_count(
520        self,
521        mip_level_count: u32,
522    ) -> TextureViewDescriptorBuilder<'a, SetMipLevelCount<CS>>
523    where
524        CS::MipLevelCount: MipLevelCountIsEmpty,
525    {
526        TextureViewDescriptorBuilder {
527            label: self.label,
528            format: self.format,
529            dimension: self.dimension,
530            usage: self.usage,
531            aspect: self.aspect,
532            base_mip_level: self.base_mip_level,
533            mip_level_count: MipLevelCountValue(Some(mip_level_count)),
534            base_array_layer: self.base_array_layer,
535            array_layer_count: self.array_layer_count,
536        }
537    }
538    #[doc = "Setter for [wgpu::TextureViewDescriptor::mip_level_count]. Optional, defaults to `None`.\n"]
539    pub fn maybe_mip_level_count(
540        self,
541        mip_level_count: Option<u32>,
542    ) -> TextureViewDescriptorBuilder<'a, SetMipLevelCount<CS>>
543    where
544        CS::MipLevelCount: MipLevelCountIsEmpty,
545    {
546        TextureViewDescriptorBuilder {
547            label: self.label,
548            format: self.format,
549            dimension: self.dimension,
550            usage: self.usage,
551            aspect: self.aspect,
552            base_mip_level: self.base_mip_level,
553            mip_level_count: MipLevelCountValue(mip_level_count),
554            base_array_layer: self.base_array_layer,
555            array_layer_count: self.array_layer_count,
556        }
557    }
558    #[doc = "Setter for [wgpu::TextureViewDescriptor::base_array_layer]. Optional, defaults to `0u32`.\n"]
559    pub fn base_array_layer(
560        self,
561        base_array_layer: u32,
562    ) -> TextureViewDescriptorBuilder<'a, SetBaseArrayLayer<CS>>
563    where
564        CS::BaseArrayLayer: BaseArrayLayerIsEmpty,
565    {
566        TextureViewDescriptorBuilder {
567            label: self.label,
568            format: self.format,
569            dimension: self.dimension,
570            usage: self.usage,
571            aspect: self.aspect,
572            base_mip_level: self.base_mip_level,
573            mip_level_count: self.mip_level_count,
574            base_array_layer: BaseArrayLayerValue(base_array_layer),
575            array_layer_count: self.array_layer_count,
576        }
577    }
578    #[doc = "Setter for [wgpu::TextureViewDescriptor::array_layer_count]. Optional, defaults to `None`.\n"]
579    pub fn array_layer_count(
580        self,
581        array_layer_count: u32,
582    ) -> TextureViewDescriptorBuilder<'a, SetArrayLayerCount<CS>>
583    where
584        CS::ArrayLayerCount: ArrayLayerCountIsEmpty,
585    {
586        TextureViewDescriptorBuilder {
587            label: self.label,
588            format: self.format,
589            dimension: self.dimension,
590            usage: self.usage,
591            aspect: self.aspect,
592            base_mip_level: self.base_mip_level,
593            mip_level_count: self.mip_level_count,
594            base_array_layer: self.base_array_layer,
595            array_layer_count: ArrayLayerCountValue(Some(array_layer_count)),
596        }
597    }
598    #[doc = "Setter for [wgpu::TextureViewDescriptor::array_layer_count]. Optional, defaults to `None`.\n"]
599    pub fn maybe_array_layer_count(
600        self,
601        array_layer_count: Option<u32>,
602    ) -> TextureViewDescriptorBuilder<'a, SetArrayLayerCount<CS>>
603    where
604        CS::ArrayLayerCount: ArrayLayerCountIsEmpty,
605    {
606        TextureViewDescriptorBuilder {
607            label: self.label,
608            format: self.format,
609            dimension: self.dimension,
610            usage: self.usage,
611            aspect: self.aspect,
612            base_mip_level: self.base_mip_level,
613            mip_level_count: self.mip_level_count,
614            base_array_layer: self.base_array_layer,
615            array_layer_count: ArrayLayerCountValue(array_layer_count),
616        }
617    }
618}
619pub trait Complete<'a>:
620    State<
621    'a,
622    Label: IsSetLabel<'a>,
623    Format: IsSetFormat,
624    Dimension: IsSetDimension,
625    Usage: IsSetUsage,
626    Aspect: IsSetAspect,
627    BaseMipLevel: IsSetBaseMipLevel,
628    MipLevelCount: IsSetMipLevelCount,
629    BaseArrayLayer: IsSetBaseArrayLayer,
630    ArrayLayerCount: IsSetArrayLayerCount,
631>
632{
633}
634impl<
635        'a,
636        CS: State<
637            'a,
638            Label: IsSetLabel<'a>,
639            Format: IsSetFormat,
640            Dimension: IsSetDimension,
641            Usage: IsSetUsage,
642            Aspect: IsSetAspect,
643            BaseMipLevel: IsSetBaseMipLevel,
644            MipLevelCount: IsSetMipLevelCount,
645            BaseArrayLayer: IsSetBaseArrayLayer,
646            ArrayLayerCount: IsSetArrayLayerCount,
647        >,
648    > Complete<'a> for CS
649{
650}
651impl<'a, CS: Complete<'a>> TextureViewDescriptorBuilder<'a, CS> {
652    pub fn build(self) -> wgpu::TextureViewDescriptor<'a> {
653        wgpu::TextureViewDescriptor {
654            label: IsSetLabel::get(self.label),
655            format: IsSetFormat::get(self.format),
656            dimension: IsSetDimension::get(self.dimension),
657            usage: IsSetUsage::get(self.usage),
658            aspect: IsSetAspect::get(self.aspect),
659            base_mip_level: IsSetBaseMipLevel::get(self.base_mip_level),
660            mip_level_count: IsSetMipLevelCount::get(self.mip_level_count),
661            base_array_layer: IsSetBaseArrayLayer::get(self.base_array_layer),
662            array_layer_count: IsSetArrayLayerCount::get(self.array_layer_count),
663        }
664    }
665}
666#[cfg(test)]
667mod tests {
668    #[allow(unused_imports)]
669    #[allow(unused_imports)]
670    use std::num::NonZeroU32;
671    #[test]
672    pub fn test_default() {
673        assert_eq!(
674            format!(
675                "{:#?}",
676                super::texture_view_descriptor(Option::<&str>::None).build()
677            ),
678            format!("{:#?}", wgpu::TextureViewDescriptor::default()),
679        );
680    }
681}