1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type DeviceId = u64;
12
13pub const MAX_CONFIGURATIONS_PER_CAMERA: u32 = 256;
14
15pub const MAX_IDENTIFIER_LENGTH: u32 = 256;
16
17pub const MAX_RESOLUTIONS_PER_STREAM: u32 = 256;
18
19pub const MAX_STREAMS_PER_CONFIGURATION: u32 = 256;
20
21pub const MAX_WATCH_DEVICES_EVENTS: u32 = 256;
22
23#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
27#[repr(u32)]
28pub enum Orientation {
29 Up = 1,
31 Down = 2,
33 Left = 3,
35 Right = 4,
37 UpFlipped = 5,
39 DownFlipped = 6,
41 LeftFlipped = 7,
43 RightFlipped = 8,
45}
46
47impl Orientation {
48 #[inline]
49 pub fn from_primitive(prim: u32) -> Option<Self> {
50 match prim {
51 1 => Some(Self::Up),
52 2 => Some(Self::Down),
53 3 => Some(Self::Left),
54 4 => Some(Self::Right),
55 5 => Some(Self::UpFlipped),
56 6 => Some(Self::DownFlipped),
57 7 => Some(Self::LeftFlipped),
58 8 => Some(Self::RightFlipped),
59 _ => None,
60 }
61 }
62
63 #[inline]
64 pub const fn into_primitive(self) -> u32 {
65 self as u32
66 }
67
68 #[deprecated = "Strict enums should not use `is_unknown`"]
69 #[inline]
70 pub fn is_unknown(&self) -> bool {
71 false
72 }
73}
74
75#[derive(Clone, Debug, PartialEq)]
77pub struct Configuration {
78 pub streams: Vec<StreamProperties>,
80}
81
82impl fidl::Persistable for Configuration {}
83
84#[derive(Clone, Debug, PartialEq)]
85pub struct DeviceGetConfigurations2Response {
86 pub configurations: Vec<Configuration2>,
87}
88
89impl fidl::Persistable for DeviceGetConfigurations2Response {}
90
91#[derive(Clone, Debug, PartialEq)]
92pub struct DeviceGetConfigurationsResponse {
93 pub configurations: Vec<Configuration>,
94}
95
96impl fidl::Persistable for DeviceGetConfigurationsResponse {}
97
98#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
99pub struct DeviceGetIdentifierResponse {
100 pub identifier: Option<String>,
101}
102
103impl fidl::Persistable for DeviceGetIdentifierResponse {}
104
105#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
106#[repr(C)]
107pub struct DeviceSetCurrentConfigurationRequest {
108 pub index: u32,
109}
110
111impl fidl::Persistable for DeviceSetCurrentConfigurationRequest {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114pub struct DeviceSetSoftwareMuteStateRequest {
115 pub muted: bool,
116}
117
118impl fidl::Persistable for DeviceSetSoftwareMuteStateRequest {}
119
120#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
121#[repr(C)]
122pub struct DeviceWatchCurrentConfigurationResponse {
123 pub index: u32,
124}
125
126impl fidl::Persistable for DeviceWatchCurrentConfigurationResponse {}
127
128#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
129pub struct DeviceWatchMuteStateResponse {
130 pub software_muted: bool,
131 pub hardware_muted: bool,
132}
133
134impl fidl::Persistable for DeviceWatchMuteStateResponse {}
135
136#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
137pub struct DeviceWatcherWatchDevicesResponse {
138 pub events: Vec<WatchDevicesEvent>,
139}
140
141impl fidl::Persistable for DeviceWatcherWatchDevicesResponse {}
142
143#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
146#[repr(C)]
147pub struct FrameRate {
148 pub numerator: u32,
150 pub denominator: u32,
152}
153
154impl fidl::Persistable for FrameRate {}
155
156#[derive(Clone, Debug, PartialEq)]
157pub struct StreamGetProperties2Response {
158 pub properties: StreamProperties2,
159}
160
161impl fidl::Persistable for StreamGetProperties2Response {}
162
163#[derive(Clone, Debug, PartialEq)]
164pub struct StreamGetPropertiesResponse {
165 pub properties: StreamProperties,
166}
167
168impl fidl::Persistable for StreamGetPropertiesResponse {}
169
170#[derive(Clone, Debug, PartialEq)]
172pub struct StreamProperties {
173 pub image_format: fidl_fuchsia_sysmem::ImageFormat2,
175 pub frame_rate: FrameRate,
177 pub supports_crop_region: bool,
179}
180
181impl fidl::Persistable for StreamProperties {}
182
183#[derive(Clone, Debug, PartialEq)]
184pub struct StreamSetCropRegionRequest {
185 pub region: Option<Box<fidl_fuchsia_math::RectF>>,
186}
187
188impl fidl::Persistable for StreamSetCropRegionRequest {}
189
190#[derive(Clone, Debug, PartialEq)]
191pub struct StreamSetResolutionRequest {
192 pub coded_size: fidl_fuchsia_math::Size,
193}
194
195impl fidl::Persistable for StreamSetResolutionRequest {}
196
197#[derive(Clone, Debug, PartialEq)]
198pub struct StreamWatchCropRegionResponse {
199 pub region: Option<Box<fidl_fuchsia_math::RectF>>,
200}
201
202impl fidl::Persistable for StreamWatchCropRegionResponse {}
203
204#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
205pub struct StreamWatchOrientationResponse {
206 pub orientation: Orientation,
207}
208
209impl fidl::Persistable for StreamWatchOrientationResponse {}
210
211#[derive(Clone, Debug, PartialEq)]
212pub struct StreamWatchResolutionResponse {
213 pub coded_size: fidl_fuchsia_math::Size,
214}
215
216impl fidl::Persistable for StreamWatchResolutionResponse {}
217
218#[derive(Clone, Debug, Default, PartialEq)]
220pub struct Configuration2 {
221 pub streams: Option<Vec<StreamProperties2>>,
223 #[doc(hidden)]
224 pub __source_breaking: fidl::marker::SourceBreaking,
225}
226
227impl fidl::Persistable for Configuration2 {}
228
229#[derive(Clone, Debug, Default, PartialEq)]
231pub struct StreamProperties2 {
232 pub image_format: Option<fidl_fuchsia_sysmem::ImageFormat2>,
234 pub frame_rate: Option<FrameRate>,
236 pub supports_crop_region: Option<bool>,
238 pub supported_resolutions: Option<Vec<fidl_fuchsia_math::Size>>,
243 #[doc(hidden)]
244 pub __source_breaking: fidl::marker::SourceBreaking,
245}
246
247impl fidl::Persistable for StreamProperties2 {}
248
249#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
250pub enum WatchDevicesEvent {
251 Existing(u64),
253 Added(u64),
255 Removed(u64),
257}
258
259impl WatchDevicesEvent {
260 #[inline]
261 pub fn ordinal(&self) -> u64 {
262 match *self {
263 Self::Existing(_) => 1,
264 Self::Added(_) => 2,
265 Self::Removed(_) => 3,
266 }
267 }
268
269 #[deprecated = "Strict unions should not use `is_unknown`"]
270 #[inline]
271 pub fn is_unknown(&self) -> bool {
272 false
273 }
274}
275
276impl fidl::Persistable for WatchDevicesEvent {}
277
278mod internal {
279 use super::*;
280 unsafe impl fidl::encoding::TypeMarker for Orientation {
281 type Owned = Self;
282
283 #[inline(always)]
284 fn inline_align(_context: fidl::encoding::Context) -> usize {
285 std::mem::align_of::<u32>()
286 }
287
288 #[inline(always)]
289 fn inline_size(_context: fidl::encoding::Context) -> usize {
290 std::mem::size_of::<u32>()
291 }
292
293 #[inline(always)]
294 fn encode_is_copy() -> bool {
295 true
296 }
297
298 #[inline(always)]
299 fn decode_is_copy() -> bool {
300 false
301 }
302 }
303
304 impl fidl::encoding::ValueTypeMarker for Orientation {
305 type Borrowed<'a> = Self;
306 #[inline(always)]
307 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
308 *value
309 }
310 }
311
312 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Orientation {
313 #[inline]
314 unsafe fn encode(
315 self,
316 encoder: &mut fidl::encoding::Encoder<'_, D>,
317 offset: usize,
318 _depth: fidl::encoding::Depth,
319 ) -> fidl::Result<()> {
320 encoder.debug_check_bounds::<Self>(offset);
321 encoder.write_num(self.into_primitive(), offset);
322 Ok(())
323 }
324 }
325
326 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Orientation {
327 #[inline(always)]
328 fn new_empty() -> Self {
329 Self::Up
330 }
331
332 #[inline]
333 unsafe fn decode(
334 &mut self,
335 decoder: &mut fidl::encoding::Decoder<'_, D>,
336 offset: usize,
337 _depth: fidl::encoding::Depth,
338 ) -> fidl::Result<()> {
339 decoder.debug_check_bounds::<Self>(offset);
340 let prim = decoder.read_num::<u32>(offset);
341
342 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
343 Ok(())
344 }
345 }
346
347 impl fidl::encoding::ValueTypeMarker for Configuration {
348 type Borrowed<'a> = &'a Self;
349 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
350 value
351 }
352 }
353
354 unsafe impl fidl::encoding::TypeMarker for Configuration {
355 type Owned = Self;
356
357 #[inline(always)]
358 fn inline_align(_context: fidl::encoding::Context) -> usize {
359 8
360 }
361
362 #[inline(always)]
363 fn inline_size(_context: fidl::encoding::Context) -> usize {
364 16
365 }
366 }
367
368 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Configuration, D>
369 for &Configuration
370 {
371 #[inline]
372 unsafe fn encode(
373 self,
374 encoder: &mut fidl::encoding::Encoder<'_, D>,
375 offset: usize,
376 _depth: fidl::encoding::Depth,
377 ) -> fidl::Result<()> {
378 encoder.debug_check_bounds::<Configuration>(offset);
379 fidl::encoding::Encode::<Configuration, D>::encode(
381 (
382 <fidl::encoding::Vector<StreamProperties, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.streams),
383 ),
384 encoder, offset, _depth
385 )
386 }
387 }
388 unsafe impl<
389 D: fidl::encoding::ResourceDialect,
390 T0: fidl::encoding::Encode<fidl::encoding::Vector<StreamProperties, 256>, D>,
391 > fidl::encoding::Encode<Configuration, D> for (T0,)
392 {
393 #[inline]
394 unsafe fn encode(
395 self,
396 encoder: &mut fidl::encoding::Encoder<'_, D>,
397 offset: usize,
398 depth: fidl::encoding::Depth,
399 ) -> fidl::Result<()> {
400 encoder.debug_check_bounds::<Configuration>(offset);
401 self.0.encode(encoder, offset + 0, depth)?;
405 Ok(())
406 }
407 }
408
409 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration {
410 #[inline(always)]
411 fn new_empty() -> Self {
412 Self { streams: fidl::new_empty!(fidl::encoding::Vector<StreamProperties, 256>, D) }
413 }
414
415 #[inline]
416 unsafe fn decode(
417 &mut self,
418 decoder: &mut fidl::encoding::Decoder<'_, D>,
419 offset: usize,
420 _depth: fidl::encoding::Depth,
421 ) -> fidl::Result<()> {
422 decoder.debug_check_bounds::<Self>(offset);
423 fidl::decode!(fidl::encoding::Vector<StreamProperties, 256>, D, &mut self.streams, decoder, offset + 0, _depth)?;
425 Ok(())
426 }
427 }
428
429 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurations2Response {
430 type Borrowed<'a> = &'a Self;
431 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
432 value
433 }
434 }
435
436 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurations2Response {
437 type Owned = Self;
438
439 #[inline(always)]
440 fn inline_align(_context: fidl::encoding::Context) -> usize {
441 8
442 }
443
444 #[inline(always)]
445 fn inline_size(_context: fidl::encoding::Context) -> usize {
446 16
447 }
448 }
449
450 unsafe impl<D: fidl::encoding::ResourceDialect>
451 fidl::encoding::Encode<DeviceGetConfigurations2Response, D>
452 for &DeviceGetConfigurations2Response
453 {
454 #[inline]
455 unsafe fn encode(
456 self,
457 encoder: &mut fidl::encoding::Encoder<'_, D>,
458 offset: usize,
459 _depth: fidl::encoding::Depth,
460 ) -> fidl::Result<()> {
461 encoder.debug_check_bounds::<DeviceGetConfigurations2Response>(offset);
462 fidl::encoding::Encode::<DeviceGetConfigurations2Response, D>::encode(
464 (
465 <fidl::encoding::Vector<Configuration2, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.configurations),
466 ),
467 encoder, offset, _depth
468 )
469 }
470 }
471 unsafe impl<
472 D: fidl::encoding::ResourceDialect,
473 T0: fidl::encoding::Encode<fidl::encoding::Vector<Configuration2, 256>, D>,
474 > fidl::encoding::Encode<DeviceGetConfigurations2Response, D> for (T0,)
475 {
476 #[inline]
477 unsafe fn encode(
478 self,
479 encoder: &mut fidl::encoding::Encoder<'_, D>,
480 offset: usize,
481 depth: fidl::encoding::Depth,
482 ) -> fidl::Result<()> {
483 encoder.debug_check_bounds::<DeviceGetConfigurations2Response>(offset);
484 self.0.encode(encoder, offset + 0, depth)?;
488 Ok(())
489 }
490 }
491
492 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
493 for DeviceGetConfigurations2Response
494 {
495 #[inline(always)]
496 fn new_empty() -> Self {
497 Self {
498 configurations: fidl::new_empty!(fidl::encoding::Vector<Configuration2, 256>, D),
499 }
500 }
501
502 #[inline]
503 unsafe fn decode(
504 &mut self,
505 decoder: &mut fidl::encoding::Decoder<'_, D>,
506 offset: usize,
507 _depth: fidl::encoding::Depth,
508 ) -> fidl::Result<()> {
509 decoder.debug_check_bounds::<Self>(offset);
510 fidl::decode!(fidl::encoding::Vector<Configuration2, 256>, D, &mut self.configurations, decoder, offset + 0, _depth)?;
512 Ok(())
513 }
514 }
515
516 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationsResponse {
517 type Borrowed<'a> = &'a Self;
518 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
519 value
520 }
521 }
522
523 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationsResponse {
524 type Owned = Self;
525
526 #[inline(always)]
527 fn inline_align(_context: fidl::encoding::Context) -> usize {
528 8
529 }
530
531 #[inline(always)]
532 fn inline_size(_context: fidl::encoding::Context) -> usize {
533 16
534 }
535 }
536
537 unsafe impl<D: fidl::encoding::ResourceDialect>
538 fidl::encoding::Encode<DeviceGetConfigurationsResponse, D>
539 for &DeviceGetConfigurationsResponse
540 {
541 #[inline]
542 unsafe fn encode(
543 self,
544 encoder: &mut fidl::encoding::Encoder<'_, D>,
545 offset: usize,
546 _depth: fidl::encoding::Depth,
547 ) -> fidl::Result<()> {
548 encoder.debug_check_bounds::<DeviceGetConfigurationsResponse>(offset);
549 fidl::encoding::Encode::<DeviceGetConfigurationsResponse, D>::encode(
551 (
552 <fidl::encoding::Vector<Configuration, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.configurations),
553 ),
554 encoder, offset, _depth
555 )
556 }
557 }
558 unsafe impl<
559 D: fidl::encoding::ResourceDialect,
560 T0: fidl::encoding::Encode<fidl::encoding::Vector<Configuration, 256>, D>,
561 > fidl::encoding::Encode<DeviceGetConfigurationsResponse, D> for (T0,)
562 {
563 #[inline]
564 unsafe fn encode(
565 self,
566 encoder: &mut fidl::encoding::Encoder<'_, D>,
567 offset: usize,
568 depth: fidl::encoding::Depth,
569 ) -> fidl::Result<()> {
570 encoder.debug_check_bounds::<DeviceGetConfigurationsResponse>(offset);
571 self.0.encode(encoder, offset + 0, depth)?;
575 Ok(())
576 }
577 }
578
579 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
580 for DeviceGetConfigurationsResponse
581 {
582 #[inline(always)]
583 fn new_empty() -> Self {
584 Self { configurations: fidl::new_empty!(fidl::encoding::Vector<Configuration, 256>, D) }
585 }
586
587 #[inline]
588 unsafe fn decode(
589 &mut self,
590 decoder: &mut fidl::encoding::Decoder<'_, D>,
591 offset: usize,
592 _depth: fidl::encoding::Depth,
593 ) -> fidl::Result<()> {
594 decoder.debug_check_bounds::<Self>(offset);
595 fidl::decode!(fidl::encoding::Vector<Configuration, 256>, D, &mut self.configurations, decoder, offset + 0, _depth)?;
597 Ok(())
598 }
599 }
600
601 impl fidl::encoding::ValueTypeMarker for DeviceGetIdentifierResponse {
602 type Borrowed<'a> = &'a Self;
603 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
604 value
605 }
606 }
607
608 unsafe impl fidl::encoding::TypeMarker for DeviceGetIdentifierResponse {
609 type Owned = Self;
610
611 #[inline(always)]
612 fn inline_align(_context: fidl::encoding::Context) -> usize {
613 8
614 }
615
616 #[inline(always)]
617 fn inline_size(_context: fidl::encoding::Context) -> usize {
618 16
619 }
620 }
621
622 unsafe impl<D: fidl::encoding::ResourceDialect>
623 fidl::encoding::Encode<DeviceGetIdentifierResponse, D> for &DeviceGetIdentifierResponse
624 {
625 #[inline]
626 unsafe fn encode(
627 self,
628 encoder: &mut fidl::encoding::Encoder<'_, D>,
629 offset: usize,
630 _depth: fidl::encoding::Depth,
631 ) -> fidl::Result<()> {
632 encoder.debug_check_bounds::<DeviceGetIdentifierResponse>(offset);
633 fidl::encoding::Encode::<DeviceGetIdentifierResponse, D>::encode(
635 (
636 <fidl::encoding::Optional<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.identifier),
637 ),
638 encoder, offset, _depth
639 )
640 }
641 }
642 unsafe impl<
643 D: fidl::encoding::ResourceDialect,
644 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<256>>, D>,
645 > fidl::encoding::Encode<DeviceGetIdentifierResponse, D> for (T0,)
646 {
647 #[inline]
648 unsafe fn encode(
649 self,
650 encoder: &mut fidl::encoding::Encoder<'_, D>,
651 offset: usize,
652 depth: fidl::encoding::Depth,
653 ) -> fidl::Result<()> {
654 encoder.debug_check_bounds::<DeviceGetIdentifierResponse>(offset);
655 self.0.encode(encoder, offset + 0, depth)?;
659 Ok(())
660 }
661 }
662
663 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
664 for DeviceGetIdentifierResponse
665 {
666 #[inline(always)]
667 fn new_empty() -> Self {
668 Self {
669 identifier: fidl::new_empty!(
670 fidl::encoding::Optional<fidl::encoding::BoundedString<256>>,
671 D
672 ),
673 }
674 }
675
676 #[inline]
677 unsafe fn decode(
678 &mut self,
679 decoder: &mut fidl::encoding::Decoder<'_, D>,
680 offset: usize,
681 _depth: fidl::encoding::Depth,
682 ) -> fidl::Result<()> {
683 decoder.debug_check_bounds::<Self>(offset);
684 fidl::decode!(
686 fidl::encoding::Optional<fidl::encoding::BoundedString<256>>,
687 D,
688 &mut self.identifier,
689 decoder,
690 offset + 0,
691 _depth
692 )?;
693 Ok(())
694 }
695 }
696
697 impl fidl::encoding::ValueTypeMarker for DeviceSetCurrentConfigurationRequest {
698 type Borrowed<'a> = &'a Self;
699 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
700 value
701 }
702 }
703
704 unsafe impl fidl::encoding::TypeMarker for DeviceSetCurrentConfigurationRequest {
705 type Owned = Self;
706
707 #[inline(always)]
708 fn inline_align(_context: fidl::encoding::Context) -> usize {
709 4
710 }
711
712 #[inline(always)]
713 fn inline_size(_context: fidl::encoding::Context) -> usize {
714 4
715 }
716 #[inline(always)]
717 fn encode_is_copy() -> bool {
718 true
719 }
720
721 #[inline(always)]
722 fn decode_is_copy() -> bool {
723 true
724 }
725 }
726
727 unsafe impl<D: fidl::encoding::ResourceDialect>
728 fidl::encoding::Encode<DeviceSetCurrentConfigurationRequest, D>
729 for &DeviceSetCurrentConfigurationRequest
730 {
731 #[inline]
732 unsafe fn encode(
733 self,
734 encoder: &mut fidl::encoding::Encoder<'_, D>,
735 offset: usize,
736 _depth: fidl::encoding::Depth,
737 ) -> fidl::Result<()> {
738 encoder.debug_check_bounds::<DeviceSetCurrentConfigurationRequest>(offset);
739 unsafe {
740 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
742 (buf_ptr as *mut DeviceSetCurrentConfigurationRequest)
743 .write_unaligned((self as *const DeviceSetCurrentConfigurationRequest).read());
744 }
747 Ok(())
748 }
749 }
750 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
751 fidl::encoding::Encode<DeviceSetCurrentConfigurationRequest, D> for (T0,)
752 {
753 #[inline]
754 unsafe fn encode(
755 self,
756 encoder: &mut fidl::encoding::Encoder<'_, D>,
757 offset: usize,
758 depth: fidl::encoding::Depth,
759 ) -> fidl::Result<()> {
760 encoder.debug_check_bounds::<DeviceSetCurrentConfigurationRequest>(offset);
761 self.0.encode(encoder, offset + 0, depth)?;
765 Ok(())
766 }
767 }
768
769 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
770 for DeviceSetCurrentConfigurationRequest
771 {
772 #[inline(always)]
773 fn new_empty() -> Self {
774 Self { index: fidl::new_empty!(u32, D) }
775 }
776
777 #[inline]
778 unsafe fn decode(
779 &mut self,
780 decoder: &mut fidl::encoding::Decoder<'_, D>,
781 offset: usize,
782 _depth: fidl::encoding::Depth,
783 ) -> fidl::Result<()> {
784 decoder.debug_check_bounds::<Self>(offset);
785 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
786 unsafe {
789 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
790 }
791 Ok(())
792 }
793 }
794
795 impl fidl::encoding::ValueTypeMarker for DeviceSetSoftwareMuteStateRequest {
796 type Borrowed<'a> = &'a Self;
797 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
798 value
799 }
800 }
801
802 unsafe impl fidl::encoding::TypeMarker for DeviceSetSoftwareMuteStateRequest {
803 type Owned = Self;
804
805 #[inline(always)]
806 fn inline_align(_context: fidl::encoding::Context) -> usize {
807 1
808 }
809
810 #[inline(always)]
811 fn inline_size(_context: fidl::encoding::Context) -> usize {
812 1
813 }
814 }
815
816 unsafe impl<D: fidl::encoding::ResourceDialect>
817 fidl::encoding::Encode<DeviceSetSoftwareMuteStateRequest, D>
818 for &DeviceSetSoftwareMuteStateRequest
819 {
820 #[inline]
821 unsafe fn encode(
822 self,
823 encoder: &mut fidl::encoding::Encoder<'_, D>,
824 offset: usize,
825 _depth: fidl::encoding::Depth,
826 ) -> fidl::Result<()> {
827 encoder.debug_check_bounds::<DeviceSetSoftwareMuteStateRequest>(offset);
828 fidl::encoding::Encode::<DeviceSetSoftwareMuteStateRequest, D>::encode(
830 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),),
831 encoder,
832 offset,
833 _depth,
834 )
835 }
836 }
837 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
838 fidl::encoding::Encode<DeviceSetSoftwareMuteStateRequest, D> for (T0,)
839 {
840 #[inline]
841 unsafe fn encode(
842 self,
843 encoder: &mut fidl::encoding::Encoder<'_, D>,
844 offset: usize,
845 depth: fidl::encoding::Depth,
846 ) -> fidl::Result<()> {
847 encoder.debug_check_bounds::<DeviceSetSoftwareMuteStateRequest>(offset);
848 self.0.encode(encoder, offset + 0, depth)?;
852 Ok(())
853 }
854 }
855
856 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
857 for DeviceSetSoftwareMuteStateRequest
858 {
859 #[inline(always)]
860 fn new_empty() -> Self {
861 Self { muted: fidl::new_empty!(bool, D) }
862 }
863
864 #[inline]
865 unsafe fn decode(
866 &mut self,
867 decoder: &mut fidl::encoding::Decoder<'_, D>,
868 offset: usize,
869 _depth: fidl::encoding::Depth,
870 ) -> fidl::Result<()> {
871 decoder.debug_check_bounds::<Self>(offset);
872 fidl::decode!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
874 Ok(())
875 }
876 }
877
878 impl fidl::encoding::ValueTypeMarker for DeviceWatchCurrentConfigurationResponse {
879 type Borrowed<'a> = &'a Self;
880 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
881 value
882 }
883 }
884
885 unsafe impl fidl::encoding::TypeMarker for DeviceWatchCurrentConfigurationResponse {
886 type Owned = Self;
887
888 #[inline(always)]
889 fn inline_align(_context: fidl::encoding::Context) -> usize {
890 4
891 }
892
893 #[inline(always)]
894 fn inline_size(_context: fidl::encoding::Context) -> usize {
895 4
896 }
897 #[inline(always)]
898 fn encode_is_copy() -> bool {
899 true
900 }
901
902 #[inline(always)]
903 fn decode_is_copy() -> bool {
904 true
905 }
906 }
907
908 unsafe impl<D: fidl::encoding::ResourceDialect>
909 fidl::encoding::Encode<DeviceWatchCurrentConfigurationResponse, D>
910 for &DeviceWatchCurrentConfigurationResponse
911 {
912 #[inline]
913 unsafe fn encode(
914 self,
915 encoder: &mut fidl::encoding::Encoder<'_, D>,
916 offset: usize,
917 _depth: fidl::encoding::Depth,
918 ) -> fidl::Result<()> {
919 encoder.debug_check_bounds::<DeviceWatchCurrentConfigurationResponse>(offset);
920 unsafe {
921 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
923 (buf_ptr as *mut DeviceWatchCurrentConfigurationResponse).write_unaligned(
924 (self as *const DeviceWatchCurrentConfigurationResponse).read(),
925 );
926 }
929 Ok(())
930 }
931 }
932 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
933 fidl::encoding::Encode<DeviceWatchCurrentConfigurationResponse, D> for (T0,)
934 {
935 #[inline]
936 unsafe fn encode(
937 self,
938 encoder: &mut fidl::encoding::Encoder<'_, D>,
939 offset: usize,
940 depth: fidl::encoding::Depth,
941 ) -> fidl::Result<()> {
942 encoder.debug_check_bounds::<DeviceWatchCurrentConfigurationResponse>(offset);
943 self.0.encode(encoder, offset + 0, depth)?;
947 Ok(())
948 }
949 }
950
951 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
952 for DeviceWatchCurrentConfigurationResponse
953 {
954 #[inline(always)]
955 fn new_empty() -> Self {
956 Self { index: fidl::new_empty!(u32, D) }
957 }
958
959 #[inline]
960 unsafe fn decode(
961 &mut self,
962 decoder: &mut fidl::encoding::Decoder<'_, D>,
963 offset: usize,
964 _depth: fidl::encoding::Depth,
965 ) -> fidl::Result<()> {
966 decoder.debug_check_bounds::<Self>(offset);
967 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
968 unsafe {
971 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
972 }
973 Ok(())
974 }
975 }
976
977 impl fidl::encoding::ValueTypeMarker for DeviceWatchMuteStateResponse {
978 type Borrowed<'a> = &'a Self;
979 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
980 value
981 }
982 }
983
984 unsafe impl fidl::encoding::TypeMarker for DeviceWatchMuteStateResponse {
985 type Owned = Self;
986
987 #[inline(always)]
988 fn inline_align(_context: fidl::encoding::Context) -> usize {
989 1
990 }
991
992 #[inline(always)]
993 fn inline_size(_context: fidl::encoding::Context) -> usize {
994 2
995 }
996 }
997
998 unsafe impl<D: fidl::encoding::ResourceDialect>
999 fidl::encoding::Encode<DeviceWatchMuteStateResponse, D> for &DeviceWatchMuteStateResponse
1000 {
1001 #[inline]
1002 unsafe fn encode(
1003 self,
1004 encoder: &mut fidl::encoding::Encoder<'_, D>,
1005 offset: usize,
1006 _depth: fidl::encoding::Depth,
1007 ) -> fidl::Result<()> {
1008 encoder.debug_check_bounds::<DeviceWatchMuteStateResponse>(offset);
1009 fidl::encoding::Encode::<DeviceWatchMuteStateResponse, D>::encode(
1011 (
1012 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.software_muted),
1013 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.hardware_muted),
1014 ),
1015 encoder,
1016 offset,
1017 _depth,
1018 )
1019 }
1020 }
1021 unsafe impl<
1022 D: fidl::encoding::ResourceDialect,
1023 T0: fidl::encoding::Encode<bool, D>,
1024 T1: fidl::encoding::Encode<bool, D>,
1025 > fidl::encoding::Encode<DeviceWatchMuteStateResponse, D> for (T0, T1)
1026 {
1027 #[inline]
1028 unsafe fn encode(
1029 self,
1030 encoder: &mut fidl::encoding::Encoder<'_, D>,
1031 offset: usize,
1032 depth: fidl::encoding::Depth,
1033 ) -> fidl::Result<()> {
1034 encoder.debug_check_bounds::<DeviceWatchMuteStateResponse>(offset);
1035 self.0.encode(encoder, offset + 0, depth)?;
1039 self.1.encode(encoder, offset + 1, depth)?;
1040 Ok(())
1041 }
1042 }
1043
1044 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1045 for DeviceWatchMuteStateResponse
1046 {
1047 #[inline(always)]
1048 fn new_empty() -> Self {
1049 Self {
1050 software_muted: fidl::new_empty!(bool, D),
1051 hardware_muted: fidl::new_empty!(bool, D),
1052 }
1053 }
1054
1055 #[inline]
1056 unsafe fn decode(
1057 &mut self,
1058 decoder: &mut fidl::encoding::Decoder<'_, D>,
1059 offset: usize,
1060 _depth: fidl::encoding::Depth,
1061 ) -> fidl::Result<()> {
1062 decoder.debug_check_bounds::<Self>(offset);
1063 fidl::decode!(bool, D, &mut self.software_muted, decoder, offset + 0, _depth)?;
1065 fidl::decode!(bool, D, &mut self.hardware_muted, decoder, offset + 1, _depth)?;
1066 Ok(())
1067 }
1068 }
1069
1070 impl fidl::encoding::ValueTypeMarker for DeviceWatcherWatchDevicesResponse {
1071 type Borrowed<'a> = &'a Self;
1072 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1073 value
1074 }
1075 }
1076
1077 unsafe impl fidl::encoding::TypeMarker for DeviceWatcherWatchDevicesResponse {
1078 type Owned = Self;
1079
1080 #[inline(always)]
1081 fn inline_align(_context: fidl::encoding::Context) -> usize {
1082 8
1083 }
1084
1085 #[inline(always)]
1086 fn inline_size(_context: fidl::encoding::Context) -> usize {
1087 16
1088 }
1089 }
1090
1091 unsafe impl<D: fidl::encoding::ResourceDialect>
1092 fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D>
1093 for &DeviceWatcherWatchDevicesResponse
1094 {
1095 #[inline]
1096 unsafe fn encode(
1097 self,
1098 encoder: &mut fidl::encoding::Encoder<'_, D>,
1099 offset: usize,
1100 _depth: fidl::encoding::Depth,
1101 ) -> fidl::Result<()> {
1102 encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
1103 fidl::encoding::Encode::<DeviceWatcherWatchDevicesResponse, D>::encode(
1105 (
1106 <fidl::encoding::Vector<WatchDevicesEvent, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
1107 ),
1108 encoder, offset, _depth
1109 )
1110 }
1111 }
1112 unsafe impl<
1113 D: fidl::encoding::ResourceDialect,
1114 T0: fidl::encoding::Encode<fidl::encoding::Vector<WatchDevicesEvent, 256>, D>,
1115 > fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D> for (T0,)
1116 {
1117 #[inline]
1118 unsafe fn encode(
1119 self,
1120 encoder: &mut fidl::encoding::Encoder<'_, D>,
1121 offset: usize,
1122 depth: fidl::encoding::Depth,
1123 ) -> fidl::Result<()> {
1124 encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
1125 self.0.encode(encoder, offset + 0, depth)?;
1129 Ok(())
1130 }
1131 }
1132
1133 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1134 for DeviceWatcherWatchDevicesResponse
1135 {
1136 #[inline(always)]
1137 fn new_empty() -> Self {
1138 Self { events: fidl::new_empty!(fidl::encoding::Vector<WatchDevicesEvent, 256>, D) }
1139 }
1140
1141 #[inline]
1142 unsafe fn decode(
1143 &mut self,
1144 decoder: &mut fidl::encoding::Decoder<'_, D>,
1145 offset: usize,
1146 _depth: fidl::encoding::Depth,
1147 ) -> fidl::Result<()> {
1148 decoder.debug_check_bounds::<Self>(offset);
1149 fidl::decode!(fidl::encoding::Vector<WatchDevicesEvent, 256>, D, &mut self.events, decoder, offset + 0, _depth)?;
1151 Ok(())
1152 }
1153 }
1154
1155 impl fidl::encoding::ValueTypeMarker for FrameRate {
1156 type Borrowed<'a> = &'a Self;
1157 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1158 value
1159 }
1160 }
1161
1162 unsafe impl fidl::encoding::TypeMarker for FrameRate {
1163 type Owned = Self;
1164
1165 #[inline(always)]
1166 fn inline_align(_context: fidl::encoding::Context) -> usize {
1167 4
1168 }
1169
1170 #[inline(always)]
1171 fn inline_size(_context: fidl::encoding::Context) -> usize {
1172 8
1173 }
1174 #[inline(always)]
1175 fn encode_is_copy() -> bool {
1176 true
1177 }
1178
1179 #[inline(always)]
1180 fn decode_is_copy() -> bool {
1181 true
1182 }
1183 }
1184
1185 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameRate, D>
1186 for &FrameRate
1187 {
1188 #[inline]
1189 unsafe fn encode(
1190 self,
1191 encoder: &mut fidl::encoding::Encoder<'_, D>,
1192 offset: usize,
1193 _depth: fidl::encoding::Depth,
1194 ) -> fidl::Result<()> {
1195 encoder.debug_check_bounds::<FrameRate>(offset);
1196 unsafe {
1197 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1199 (buf_ptr as *mut FrameRate).write_unaligned((self as *const FrameRate).read());
1200 }
1203 Ok(())
1204 }
1205 }
1206 unsafe impl<
1207 D: fidl::encoding::ResourceDialect,
1208 T0: fidl::encoding::Encode<u32, D>,
1209 T1: fidl::encoding::Encode<u32, D>,
1210 > fidl::encoding::Encode<FrameRate, D> for (T0, T1)
1211 {
1212 #[inline]
1213 unsafe fn encode(
1214 self,
1215 encoder: &mut fidl::encoding::Encoder<'_, D>,
1216 offset: usize,
1217 depth: fidl::encoding::Depth,
1218 ) -> fidl::Result<()> {
1219 encoder.debug_check_bounds::<FrameRate>(offset);
1220 self.0.encode(encoder, offset + 0, depth)?;
1224 self.1.encode(encoder, offset + 4, depth)?;
1225 Ok(())
1226 }
1227 }
1228
1229 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameRate {
1230 #[inline(always)]
1231 fn new_empty() -> Self {
1232 Self { numerator: fidl::new_empty!(u32, D), denominator: fidl::new_empty!(u32, D) }
1233 }
1234
1235 #[inline]
1236 unsafe fn decode(
1237 &mut self,
1238 decoder: &mut fidl::encoding::Decoder<'_, D>,
1239 offset: usize,
1240 _depth: fidl::encoding::Depth,
1241 ) -> fidl::Result<()> {
1242 decoder.debug_check_bounds::<Self>(offset);
1243 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1244 unsafe {
1247 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1248 }
1249 Ok(())
1250 }
1251 }
1252
1253 impl fidl::encoding::ValueTypeMarker for StreamGetProperties2Response {
1254 type Borrowed<'a> = &'a Self;
1255 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1256 value
1257 }
1258 }
1259
1260 unsafe impl fidl::encoding::TypeMarker for StreamGetProperties2Response {
1261 type Owned = Self;
1262
1263 #[inline(always)]
1264 fn inline_align(_context: fidl::encoding::Context) -> usize {
1265 8
1266 }
1267
1268 #[inline(always)]
1269 fn inline_size(_context: fidl::encoding::Context) -> usize {
1270 16
1271 }
1272 }
1273
1274 unsafe impl<D: fidl::encoding::ResourceDialect>
1275 fidl::encoding::Encode<StreamGetProperties2Response, D> for &StreamGetProperties2Response
1276 {
1277 #[inline]
1278 unsafe fn encode(
1279 self,
1280 encoder: &mut fidl::encoding::Encoder<'_, D>,
1281 offset: usize,
1282 _depth: fidl::encoding::Depth,
1283 ) -> fidl::Result<()> {
1284 encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1285 fidl::encoding::Encode::<StreamGetProperties2Response, D>::encode(
1287 (<StreamProperties2 as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1288 encoder,
1289 offset,
1290 _depth,
1291 )
1292 }
1293 }
1294 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties2, D>>
1295 fidl::encoding::Encode<StreamGetProperties2Response, D> for (T0,)
1296 {
1297 #[inline]
1298 unsafe fn encode(
1299 self,
1300 encoder: &mut fidl::encoding::Encoder<'_, D>,
1301 offset: usize,
1302 depth: fidl::encoding::Depth,
1303 ) -> fidl::Result<()> {
1304 encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1305 self.0.encode(encoder, offset + 0, depth)?;
1309 Ok(())
1310 }
1311 }
1312
1313 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1314 for StreamGetProperties2Response
1315 {
1316 #[inline(always)]
1317 fn new_empty() -> Self {
1318 Self { properties: fidl::new_empty!(StreamProperties2, D) }
1319 }
1320
1321 #[inline]
1322 unsafe fn decode(
1323 &mut self,
1324 decoder: &mut fidl::encoding::Decoder<'_, D>,
1325 offset: usize,
1326 _depth: fidl::encoding::Depth,
1327 ) -> fidl::Result<()> {
1328 decoder.debug_check_bounds::<Self>(offset);
1329 fidl::decode!(StreamProperties2, D, &mut self.properties, decoder, offset + 0, _depth)?;
1331 Ok(())
1332 }
1333 }
1334
1335 impl fidl::encoding::ValueTypeMarker for StreamGetPropertiesResponse {
1336 type Borrowed<'a> = &'a Self;
1337 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1338 value
1339 }
1340 }
1341
1342 unsafe impl fidl::encoding::TypeMarker for StreamGetPropertiesResponse {
1343 type Owned = Self;
1344
1345 #[inline(always)]
1346 fn inline_align(_context: fidl::encoding::Context) -> usize {
1347 8
1348 }
1349
1350 #[inline(always)]
1351 fn inline_size(_context: fidl::encoding::Context) -> usize {
1352 72
1353 }
1354 }
1355
1356 unsafe impl<D: fidl::encoding::ResourceDialect>
1357 fidl::encoding::Encode<StreamGetPropertiesResponse, D> for &StreamGetPropertiesResponse
1358 {
1359 #[inline]
1360 unsafe fn encode(
1361 self,
1362 encoder: &mut fidl::encoding::Encoder<'_, D>,
1363 offset: usize,
1364 _depth: fidl::encoding::Depth,
1365 ) -> fidl::Result<()> {
1366 encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1367 fidl::encoding::Encode::<StreamGetPropertiesResponse, D>::encode(
1369 (<StreamProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1370 encoder,
1371 offset,
1372 _depth,
1373 )
1374 }
1375 }
1376 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties, D>>
1377 fidl::encoding::Encode<StreamGetPropertiesResponse, D> for (T0,)
1378 {
1379 #[inline]
1380 unsafe fn encode(
1381 self,
1382 encoder: &mut fidl::encoding::Encoder<'_, D>,
1383 offset: usize,
1384 depth: fidl::encoding::Depth,
1385 ) -> fidl::Result<()> {
1386 encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1387 self.0.encode(encoder, offset + 0, depth)?;
1391 Ok(())
1392 }
1393 }
1394
1395 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1396 for StreamGetPropertiesResponse
1397 {
1398 #[inline(always)]
1399 fn new_empty() -> Self {
1400 Self { properties: fidl::new_empty!(StreamProperties, D) }
1401 }
1402
1403 #[inline]
1404 unsafe fn decode(
1405 &mut self,
1406 decoder: &mut fidl::encoding::Decoder<'_, D>,
1407 offset: usize,
1408 _depth: fidl::encoding::Depth,
1409 ) -> fidl::Result<()> {
1410 decoder.debug_check_bounds::<Self>(offset);
1411 fidl::decode!(StreamProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
1413 Ok(())
1414 }
1415 }
1416
1417 impl fidl::encoding::ValueTypeMarker for StreamProperties {
1418 type Borrowed<'a> = &'a Self;
1419 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1420 value
1421 }
1422 }
1423
1424 unsafe impl fidl::encoding::TypeMarker for StreamProperties {
1425 type Owned = Self;
1426
1427 #[inline(always)]
1428 fn inline_align(_context: fidl::encoding::Context) -> usize {
1429 8
1430 }
1431
1432 #[inline(always)]
1433 fn inline_size(_context: fidl::encoding::Context) -> usize {
1434 72
1435 }
1436 }
1437
1438 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties, D>
1439 for &StreamProperties
1440 {
1441 #[inline]
1442 unsafe fn encode(
1443 self,
1444 encoder: &mut fidl::encoding::Encoder<'_, D>,
1445 offset: usize,
1446 _depth: fidl::encoding::Depth,
1447 ) -> fidl::Result<()> {
1448 encoder.debug_check_bounds::<StreamProperties>(offset);
1449 fidl::encoding::Encode::<StreamProperties, D>::encode(
1451 (
1452 <fidl_fuchsia_sysmem::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(
1453 &self.image_format,
1454 ),
1455 <FrameRate as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rate),
1456 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_crop_region),
1457 ),
1458 encoder,
1459 offset,
1460 _depth,
1461 )
1462 }
1463 }
1464 unsafe impl<
1465 D: fidl::encoding::ResourceDialect,
1466 T0: fidl::encoding::Encode<fidl_fuchsia_sysmem::ImageFormat2, D>,
1467 T1: fidl::encoding::Encode<FrameRate, D>,
1468 T2: fidl::encoding::Encode<bool, D>,
1469 > fidl::encoding::Encode<StreamProperties, D> for (T0, T1, T2)
1470 {
1471 #[inline]
1472 unsafe fn encode(
1473 self,
1474 encoder: &mut fidl::encoding::Encoder<'_, D>,
1475 offset: usize,
1476 depth: fidl::encoding::Depth,
1477 ) -> fidl::Result<()> {
1478 encoder.debug_check_bounds::<StreamProperties>(offset);
1479 unsafe {
1482 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
1483 (ptr as *mut u64).write_unaligned(0);
1484 }
1485 self.0.encode(encoder, offset + 0, depth)?;
1487 self.1.encode(encoder, offset + 56, depth)?;
1488 self.2.encode(encoder, offset + 64, depth)?;
1489 Ok(())
1490 }
1491 }
1492
1493 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties {
1494 #[inline(always)]
1495 fn new_empty() -> Self {
1496 Self {
1497 image_format: fidl::new_empty!(fidl_fuchsia_sysmem::ImageFormat2, D),
1498 frame_rate: fidl::new_empty!(FrameRate, D),
1499 supports_crop_region: fidl::new_empty!(bool, D),
1500 }
1501 }
1502
1503 #[inline]
1504 unsafe fn decode(
1505 &mut self,
1506 decoder: &mut fidl::encoding::Decoder<'_, D>,
1507 offset: usize,
1508 _depth: fidl::encoding::Depth,
1509 ) -> fidl::Result<()> {
1510 decoder.debug_check_bounds::<Self>(offset);
1511 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
1513 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1514 let mask = 0xffffffffffffff00u64;
1515 let maskedval = padval & mask;
1516 if maskedval != 0 {
1517 return Err(fidl::Error::NonZeroPadding {
1518 padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
1519 });
1520 }
1521 fidl::decode!(
1522 fidl_fuchsia_sysmem::ImageFormat2,
1523 D,
1524 &mut self.image_format,
1525 decoder,
1526 offset + 0,
1527 _depth
1528 )?;
1529 fidl::decode!(FrameRate, D, &mut self.frame_rate, decoder, offset + 56, _depth)?;
1530 fidl::decode!(bool, D, &mut self.supports_crop_region, decoder, offset + 64, _depth)?;
1531 Ok(())
1532 }
1533 }
1534
1535 impl fidl::encoding::ValueTypeMarker for StreamSetCropRegionRequest {
1536 type Borrowed<'a> = &'a Self;
1537 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1538 value
1539 }
1540 }
1541
1542 unsafe impl fidl::encoding::TypeMarker for StreamSetCropRegionRequest {
1543 type Owned = Self;
1544
1545 #[inline(always)]
1546 fn inline_align(_context: fidl::encoding::Context) -> usize {
1547 8
1548 }
1549
1550 #[inline(always)]
1551 fn inline_size(_context: fidl::encoding::Context) -> usize {
1552 8
1553 }
1554 }
1555
1556 unsafe impl<D: fidl::encoding::ResourceDialect>
1557 fidl::encoding::Encode<StreamSetCropRegionRequest, D> for &StreamSetCropRegionRequest
1558 {
1559 #[inline]
1560 unsafe fn encode(
1561 self,
1562 encoder: &mut fidl::encoding::Encoder<'_, D>,
1563 offset: usize,
1564 _depth: fidl::encoding::Depth,
1565 ) -> fidl::Result<()> {
1566 encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1567 fidl::encoding::Encode::<StreamSetCropRegionRequest, D>::encode(
1569 (
1570 <fidl::encoding::Boxed<fidl_fuchsia_math::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1571 ),
1572 encoder, offset, _depth
1573 )
1574 }
1575 }
1576 unsafe impl<
1577 D: fidl::encoding::ResourceDialect,
1578 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math::RectF>, D>,
1579 > fidl::encoding::Encode<StreamSetCropRegionRequest, D> for (T0,)
1580 {
1581 #[inline]
1582 unsafe fn encode(
1583 self,
1584 encoder: &mut fidl::encoding::Encoder<'_, D>,
1585 offset: usize,
1586 depth: fidl::encoding::Depth,
1587 ) -> fidl::Result<()> {
1588 encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1589 self.0.encode(encoder, offset + 0, depth)?;
1593 Ok(())
1594 }
1595 }
1596
1597 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1598 for StreamSetCropRegionRequest
1599 {
1600 #[inline(always)]
1601 fn new_empty() -> Self {
1602 Self { region: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_math::RectF>, D) }
1603 }
1604
1605 #[inline]
1606 unsafe fn decode(
1607 &mut self,
1608 decoder: &mut fidl::encoding::Decoder<'_, D>,
1609 offset: usize,
1610 _depth: fidl::encoding::Depth,
1611 ) -> fidl::Result<()> {
1612 decoder.debug_check_bounds::<Self>(offset);
1613 fidl::decode!(
1615 fidl::encoding::Boxed<fidl_fuchsia_math::RectF>,
1616 D,
1617 &mut self.region,
1618 decoder,
1619 offset + 0,
1620 _depth
1621 )?;
1622 Ok(())
1623 }
1624 }
1625
1626 impl fidl::encoding::ValueTypeMarker for StreamSetResolutionRequest {
1627 type Borrowed<'a> = &'a Self;
1628 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1629 value
1630 }
1631 }
1632
1633 unsafe impl fidl::encoding::TypeMarker for StreamSetResolutionRequest {
1634 type Owned = Self;
1635
1636 #[inline(always)]
1637 fn inline_align(_context: fidl::encoding::Context) -> usize {
1638 4
1639 }
1640
1641 #[inline(always)]
1642 fn inline_size(_context: fidl::encoding::Context) -> usize {
1643 8
1644 }
1645 }
1646
1647 unsafe impl<D: fidl::encoding::ResourceDialect>
1648 fidl::encoding::Encode<StreamSetResolutionRequest, D> for &StreamSetResolutionRequest
1649 {
1650 #[inline]
1651 unsafe fn encode(
1652 self,
1653 encoder: &mut fidl::encoding::Encoder<'_, D>,
1654 offset: usize,
1655 _depth: fidl::encoding::Depth,
1656 ) -> fidl::Result<()> {
1657 encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1658 fidl::encoding::Encode::<StreamSetResolutionRequest, D>::encode(
1660 (<fidl_fuchsia_math::Size as fidl::encoding::ValueTypeMarker>::borrow(
1661 &self.coded_size,
1662 ),),
1663 encoder,
1664 offset,
1665 _depth,
1666 )
1667 }
1668 }
1669 unsafe impl<
1670 D: fidl::encoding::ResourceDialect,
1671 T0: fidl::encoding::Encode<fidl_fuchsia_math::Size, D>,
1672 > fidl::encoding::Encode<StreamSetResolutionRequest, D> for (T0,)
1673 {
1674 #[inline]
1675 unsafe fn encode(
1676 self,
1677 encoder: &mut fidl::encoding::Encoder<'_, D>,
1678 offset: usize,
1679 depth: fidl::encoding::Depth,
1680 ) -> fidl::Result<()> {
1681 encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1682 self.0.encode(encoder, offset + 0, depth)?;
1686 Ok(())
1687 }
1688 }
1689
1690 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1691 for StreamSetResolutionRequest
1692 {
1693 #[inline(always)]
1694 fn new_empty() -> Self {
1695 Self { coded_size: fidl::new_empty!(fidl_fuchsia_math::Size, D) }
1696 }
1697
1698 #[inline]
1699 unsafe fn decode(
1700 &mut self,
1701 decoder: &mut fidl::encoding::Decoder<'_, D>,
1702 offset: usize,
1703 _depth: fidl::encoding::Depth,
1704 ) -> fidl::Result<()> {
1705 decoder.debug_check_bounds::<Self>(offset);
1706 fidl::decode!(
1708 fidl_fuchsia_math::Size,
1709 D,
1710 &mut self.coded_size,
1711 decoder,
1712 offset + 0,
1713 _depth
1714 )?;
1715 Ok(())
1716 }
1717 }
1718
1719 impl fidl::encoding::ValueTypeMarker for StreamWatchCropRegionResponse {
1720 type Borrowed<'a> = &'a Self;
1721 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1722 value
1723 }
1724 }
1725
1726 unsafe impl fidl::encoding::TypeMarker for StreamWatchCropRegionResponse {
1727 type Owned = Self;
1728
1729 #[inline(always)]
1730 fn inline_align(_context: fidl::encoding::Context) -> usize {
1731 8
1732 }
1733
1734 #[inline(always)]
1735 fn inline_size(_context: fidl::encoding::Context) -> usize {
1736 8
1737 }
1738 }
1739
1740 unsafe impl<D: fidl::encoding::ResourceDialect>
1741 fidl::encoding::Encode<StreamWatchCropRegionResponse, D>
1742 for &StreamWatchCropRegionResponse
1743 {
1744 #[inline]
1745 unsafe fn encode(
1746 self,
1747 encoder: &mut fidl::encoding::Encoder<'_, D>,
1748 offset: usize,
1749 _depth: fidl::encoding::Depth,
1750 ) -> fidl::Result<()> {
1751 encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1752 fidl::encoding::Encode::<StreamWatchCropRegionResponse, D>::encode(
1754 (
1755 <fidl::encoding::Boxed<fidl_fuchsia_math::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1756 ),
1757 encoder, offset, _depth
1758 )
1759 }
1760 }
1761 unsafe impl<
1762 D: fidl::encoding::ResourceDialect,
1763 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math::RectF>, D>,
1764 > fidl::encoding::Encode<StreamWatchCropRegionResponse, D> for (T0,)
1765 {
1766 #[inline]
1767 unsafe fn encode(
1768 self,
1769 encoder: &mut fidl::encoding::Encoder<'_, D>,
1770 offset: usize,
1771 depth: fidl::encoding::Depth,
1772 ) -> fidl::Result<()> {
1773 encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1774 self.0.encode(encoder, offset + 0, depth)?;
1778 Ok(())
1779 }
1780 }
1781
1782 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1783 for StreamWatchCropRegionResponse
1784 {
1785 #[inline(always)]
1786 fn new_empty() -> Self {
1787 Self { region: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_math::RectF>, D) }
1788 }
1789
1790 #[inline]
1791 unsafe fn decode(
1792 &mut self,
1793 decoder: &mut fidl::encoding::Decoder<'_, D>,
1794 offset: usize,
1795 _depth: fidl::encoding::Depth,
1796 ) -> fidl::Result<()> {
1797 decoder.debug_check_bounds::<Self>(offset);
1798 fidl::decode!(
1800 fidl::encoding::Boxed<fidl_fuchsia_math::RectF>,
1801 D,
1802 &mut self.region,
1803 decoder,
1804 offset + 0,
1805 _depth
1806 )?;
1807 Ok(())
1808 }
1809 }
1810
1811 impl fidl::encoding::ValueTypeMarker for StreamWatchOrientationResponse {
1812 type Borrowed<'a> = &'a Self;
1813 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1814 value
1815 }
1816 }
1817
1818 unsafe impl fidl::encoding::TypeMarker for StreamWatchOrientationResponse {
1819 type Owned = Self;
1820
1821 #[inline(always)]
1822 fn inline_align(_context: fidl::encoding::Context) -> usize {
1823 4
1824 }
1825
1826 #[inline(always)]
1827 fn inline_size(_context: fidl::encoding::Context) -> usize {
1828 4
1829 }
1830 }
1831
1832 unsafe impl<D: fidl::encoding::ResourceDialect>
1833 fidl::encoding::Encode<StreamWatchOrientationResponse, D>
1834 for &StreamWatchOrientationResponse
1835 {
1836 #[inline]
1837 unsafe fn encode(
1838 self,
1839 encoder: &mut fidl::encoding::Encoder<'_, D>,
1840 offset: usize,
1841 _depth: fidl::encoding::Depth,
1842 ) -> fidl::Result<()> {
1843 encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1844 fidl::encoding::Encode::<StreamWatchOrientationResponse, D>::encode(
1846 (<Orientation as fidl::encoding::ValueTypeMarker>::borrow(&self.orientation),),
1847 encoder,
1848 offset,
1849 _depth,
1850 )
1851 }
1852 }
1853 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Orientation, D>>
1854 fidl::encoding::Encode<StreamWatchOrientationResponse, D> for (T0,)
1855 {
1856 #[inline]
1857 unsafe fn encode(
1858 self,
1859 encoder: &mut fidl::encoding::Encoder<'_, D>,
1860 offset: usize,
1861 depth: fidl::encoding::Depth,
1862 ) -> fidl::Result<()> {
1863 encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1864 self.0.encode(encoder, offset + 0, depth)?;
1868 Ok(())
1869 }
1870 }
1871
1872 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1873 for StreamWatchOrientationResponse
1874 {
1875 #[inline(always)]
1876 fn new_empty() -> Self {
1877 Self { orientation: fidl::new_empty!(Orientation, D) }
1878 }
1879
1880 #[inline]
1881 unsafe fn decode(
1882 &mut self,
1883 decoder: &mut fidl::encoding::Decoder<'_, D>,
1884 offset: usize,
1885 _depth: fidl::encoding::Depth,
1886 ) -> fidl::Result<()> {
1887 decoder.debug_check_bounds::<Self>(offset);
1888 fidl::decode!(Orientation, D, &mut self.orientation, decoder, offset + 0, _depth)?;
1890 Ok(())
1891 }
1892 }
1893
1894 impl fidl::encoding::ValueTypeMarker for StreamWatchResolutionResponse {
1895 type Borrowed<'a> = &'a Self;
1896 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1897 value
1898 }
1899 }
1900
1901 unsafe impl fidl::encoding::TypeMarker for StreamWatchResolutionResponse {
1902 type Owned = Self;
1903
1904 #[inline(always)]
1905 fn inline_align(_context: fidl::encoding::Context) -> usize {
1906 4
1907 }
1908
1909 #[inline(always)]
1910 fn inline_size(_context: fidl::encoding::Context) -> usize {
1911 8
1912 }
1913 }
1914
1915 unsafe impl<D: fidl::encoding::ResourceDialect>
1916 fidl::encoding::Encode<StreamWatchResolutionResponse, D>
1917 for &StreamWatchResolutionResponse
1918 {
1919 #[inline]
1920 unsafe fn encode(
1921 self,
1922 encoder: &mut fidl::encoding::Encoder<'_, D>,
1923 offset: usize,
1924 _depth: fidl::encoding::Depth,
1925 ) -> fidl::Result<()> {
1926 encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1927 fidl::encoding::Encode::<StreamWatchResolutionResponse, D>::encode(
1929 (<fidl_fuchsia_math::Size as fidl::encoding::ValueTypeMarker>::borrow(
1930 &self.coded_size,
1931 ),),
1932 encoder,
1933 offset,
1934 _depth,
1935 )
1936 }
1937 }
1938 unsafe impl<
1939 D: fidl::encoding::ResourceDialect,
1940 T0: fidl::encoding::Encode<fidl_fuchsia_math::Size, D>,
1941 > fidl::encoding::Encode<StreamWatchResolutionResponse, D> for (T0,)
1942 {
1943 #[inline]
1944 unsafe fn encode(
1945 self,
1946 encoder: &mut fidl::encoding::Encoder<'_, D>,
1947 offset: usize,
1948 depth: fidl::encoding::Depth,
1949 ) -> fidl::Result<()> {
1950 encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1951 self.0.encode(encoder, offset + 0, depth)?;
1955 Ok(())
1956 }
1957 }
1958
1959 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1960 for StreamWatchResolutionResponse
1961 {
1962 #[inline(always)]
1963 fn new_empty() -> Self {
1964 Self { coded_size: fidl::new_empty!(fidl_fuchsia_math::Size, D) }
1965 }
1966
1967 #[inline]
1968 unsafe fn decode(
1969 &mut self,
1970 decoder: &mut fidl::encoding::Decoder<'_, D>,
1971 offset: usize,
1972 _depth: fidl::encoding::Depth,
1973 ) -> fidl::Result<()> {
1974 decoder.debug_check_bounds::<Self>(offset);
1975 fidl::decode!(
1977 fidl_fuchsia_math::Size,
1978 D,
1979 &mut self.coded_size,
1980 decoder,
1981 offset + 0,
1982 _depth
1983 )?;
1984 Ok(())
1985 }
1986 }
1987
1988 impl Configuration2 {
1989 #[inline(always)]
1990 fn max_ordinal_present(&self) -> u64 {
1991 if let Some(_) = self.streams {
1992 return 1;
1993 }
1994 0
1995 }
1996 }
1997
1998 impl fidl::encoding::ValueTypeMarker for Configuration2 {
1999 type Borrowed<'a> = &'a Self;
2000 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2001 value
2002 }
2003 }
2004
2005 unsafe impl fidl::encoding::TypeMarker for Configuration2 {
2006 type Owned = Self;
2007
2008 #[inline(always)]
2009 fn inline_align(_context: fidl::encoding::Context) -> usize {
2010 8
2011 }
2012
2013 #[inline(always)]
2014 fn inline_size(_context: fidl::encoding::Context) -> usize {
2015 16
2016 }
2017 }
2018
2019 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Configuration2, D>
2020 for &Configuration2
2021 {
2022 unsafe fn encode(
2023 self,
2024 encoder: &mut fidl::encoding::Encoder<'_, D>,
2025 offset: usize,
2026 mut depth: fidl::encoding::Depth,
2027 ) -> fidl::Result<()> {
2028 encoder.debug_check_bounds::<Configuration2>(offset);
2029 let max_ordinal: u64 = self.max_ordinal_present();
2031 encoder.write_num(max_ordinal, offset);
2032 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2033 if max_ordinal == 0 {
2035 return Ok(());
2036 }
2037 depth.increment()?;
2038 let envelope_size = 8;
2039 let bytes_len = max_ordinal as usize * envelope_size;
2040 #[allow(unused_variables)]
2041 let offset = encoder.out_of_line_offset(bytes_len);
2042 let mut _prev_end_offset: usize = 0;
2043 if 1 > max_ordinal {
2044 return Ok(());
2045 }
2046
2047 let cur_offset: usize = (1 - 1) * envelope_size;
2050
2051 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2053
2054 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<StreamProperties2, 256>, D>(
2059 self.streams.as_ref().map(<fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2060 encoder, offset + cur_offset, depth
2061 )?;
2062
2063 _prev_end_offset = cur_offset + envelope_size;
2064
2065 Ok(())
2066 }
2067 }
2068
2069 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration2 {
2070 #[inline(always)]
2071 fn new_empty() -> Self {
2072 Self::default()
2073 }
2074
2075 unsafe fn decode(
2076 &mut self,
2077 decoder: &mut fidl::encoding::Decoder<'_, D>,
2078 offset: usize,
2079 mut depth: fidl::encoding::Depth,
2080 ) -> fidl::Result<()> {
2081 decoder.debug_check_bounds::<Self>(offset);
2082 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2083 None => return Err(fidl::Error::NotNullable),
2084 Some(len) => len,
2085 };
2086 if len == 0 {
2088 return Ok(());
2089 };
2090 depth.increment()?;
2091 let envelope_size = 8;
2092 let bytes_len = len * envelope_size;
2093 let offset = decoder.out_of_line_offset(bytes_len)?;
2094 let mut _next_ordinal_to_read = 0;
2096 let mut next_offset = offset;
2097 let end_offset = offset + bytes_len;
2098 _next_ordinal_to_read += 1;
2099 if next_offset >= end_offset {
2100 return Ok(());
2101 }
2102
2103 while _next_ordinal_to_read < 1 {
2105 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2106 _next_ordinal_to_read += 1;
2107 next_offset += envelope_size;
2108 }
2109
2110 let next_out_of_line = decoder.next_out_of_line();
2111 let handles_before = decoder.remaining_handles();
2112 if let Some((inlined, num_bytes, num_handles)) =
2113 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2114 {
2115 let member_inline_size = <fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2116 if inlined != (member_inline_size <= 4) {
2117 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2118 }
2119 let inner_offset;
2120 let mut inner_depth = depth.clone();
2121 if inlined {
2122 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2123 inner_offset = next_offset;
2124 } else {
2125 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2126 inner_depth.increment()?;
2127 }
2128 let val_ref = self.streams.get_or_insert_with(
2129 || fidl::new_empty!(fidl::encoding::Vector<StreamProperties2, 256>, D),
2130 );
2131 fidl::decode!(fidl::encoding::Vector<StreamProperties2, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2132 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2133 {
2134 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2135 }
2136 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2137 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2138 }
2139 }
2140
2141 next_offset += envelope_size;
2142
2143 while next_offset < end_offset {
2145 _next_ordinal_to_read += 1;
2146 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2147 next_offset += envelope_size;
2148 }
2149
2150 Ok(())
2151 }
2152 }
2153
2154 impl StreamProperties2 {
2155 #[inline(always)]
2156 fn max_ordinal_present(&self) -> u64 {
2157 if let Some(_) = self.supported_resolutions {
2158 return 4;
2159 }
2160 if let Some(_) = self.supports_crop_region {
2161 return 3;
2162 }
2163 if let Some(_) = self.frame_rate {
2164 return 2;
2165 }
2166 if let Some(_) = self.image_format {
2167 return 1;
2168 }
2169 0
2170 }
2171 }
2172
2173 impl fidl::encoding::ValueTypeMarker for StreamProperties2 {
2174 type Borrowed<'a> = &'a Self;
2175 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2176 value
2177 }
2178 }
2179
2180 unsafe impl fidl::encoding::TypeMarker for StreamProperties2 {
2181 type Owned = Self;
2182
2183 #[inline(always)]
2184 fn inline_align(_context: fidl::encoding::Context) -> usize {
2185 8
2186 }
2187
2188 #[inline(always)]
2189 fn inline_size(_context: fidl::encoding::Context) -> usize {
2190 16
2191 }
2192 }
2193
2194 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties2, D>
2195 for &StreamProperties2
2196 {
2197 unsafe fn encode(
2198 self,
2199 encoder: &mut fidl::encoding::Encoder<'_, D>,
2200 offset: usize,
2201 mut depth: fidl::encoding::Depth,
2202 ) -> fidl::Result<()> {
2203 encoder.debug_check_bounds::<StreamProperties2>(offset);
2204 let max_ordinal: u64 = self.max_ordinal_present();
2206 encoder.write_num(max_ordinal, offset);
2207 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2208 if max_ordinal == 0 {
2210 return Ok(());
2211 }
2212 depth.increment()?;
2213 let envelope_size = 8;
2214 let bytes_len = max_ordinal as usize * envelope_size;
2215 #[allow(unused_variables)]
2216 let offset = encoder.out_of_line_offset(bytes_len);
2217 let mut _prev_end_offset: usize = 0;
2218 if 1 > max_ordinal {
2219 return Ok(());
2220 }
2221
2222 let cur_offset: usize = (1 - 1) * envelope_size;
2225
2226 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2228
2229 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_sysmem::ImageFormat2, D>(
2234 self.image_format.as_ref().map(
2235 <fidl_fuchsia_sysmem::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow,
2236 ),
2237 encoder,
2238 offset + cur_offset,
2239 depth,
2240 )?;
2241
2242 _prev_end_offset = cur_offset + envelope_size;
2243 if 2 > max_ordinal {
2244 return Ok(());
2245 }
2246
2247 let cur_offset: usize = (2 - 1) * envelope_size;
2250
2251 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2253
2254 fidl::encoding::encode_in_envelope_optional::<FrameRate, D>(
2259 self.frame_rate
2260 .as_ref()
2261 .map(<FrameRate as fidl::encoding::ValueTypeMarker>::borrow),
2262 encoder,
2263 offset + cur_offset,
2264 depth,
2265 )?;
2266
2267 _prev_end_offset = cur_offset + envelope_size;
2268 if 3 > max_ordinal {
2269 return Ok(());
2270 }
2271
2272 let cur_offset: usize = (3 - 1) * envelope_size;
2275
2276 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2278
2279 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2284 self.supports_crop_region
2285 .as_ref()
2286 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2287 encoder,
2288 offset + cur_offset,
2289 depth,
2290 )?;
2291
2292 _prev_end_offset = cur_offset + envelope_size;
2293 if 4 > max_ordinal {
2294 return Ok(());
2295 }
2296
2297 let cur_offset: usize = (4 - 1) * envelope_size;
2300
2301 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2303
2304 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math::Size, 256>, D>(
2309 self.supported_resolutions.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math::Size, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2310 encoder, offset + cur_offset, depth
2311 )?;
2312
2313 _prev_end_offset = cur_offset + envelope_size;
2314
2315 Ok(())
2316 }
2317 }
2318
2319 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties2 {
2320 #[inline(always)]
2321 fn new_empty() -> Self {
2322 Self::default()
2323 }
2324
2325 unsafe fn decode(
2326 &mut self,
2327 decoder: &mut fidl::encoding::Decoder<'_, D>,
2328 offset: usize,
2329 mut depth: fidl::encoding::Depth,
2330 ) -> fidl::Result<()> {
2331 decoder.debug_check_bounds::<Self>(offset);
2332 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2333 None => return Err(fidl::Error::NotNullable),
2334 Some(len) => len,
2335 };
2336 if len == 0 {
2338 return Ok(());
2339 };
2340 depth.increment()?;
2341 let envelope_size = 8;
2342 let bytes_len = len * envelope_size;
2343 let offset = decoder.out_of_line_offset(bytes_len)?;
2344 let mut _next_ordinal_to_read = 0;
2346 let mut next_offset = offset;
2347 let end_offset = offset + bytes_len;
2348 _next_ordinal_to_read += 1;
2349 if next_offset >= end_offset {
2350 return Ok(());
2351 }
2352
2353 while _next_ordinal_to_read < 1 {
2355 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2356 _next_ordinal_to_read += 1;
2357 next_offset += envelope_size;
2358 }
2359
2360 let next_out_of_line = decoder.next_out_of_line();
2361 let handles_before = decoder.remaining_handles();
2362 if let Some((inlined, num_bytes, num_handles)) =
2363 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2364 {
2365 let member_inline_size =
2366 <fidl_fuchsia_sysmem::ImageFormat2 as fidl::encoding::TypeMarker>::inline_size(
2367 decoder.context,
2368 );
2369 if inlined != (member_inline_size <= 4) {
2370 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2371 }
2372 let inner_offset;
2373 let mut inner_depth = depth.clone();
2374 if inlined {
2375 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2376 inner_offset = next_offset;
2377 } else {
2378 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2379 inner_depth.increment()?;
2380 }
2381 let val_ref = self
2382 .image_format
2383 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_sysmem::ImageFormat2, D));
2384 fidl::decode!(
2385 fidl_fuchsia_sysmem::ImageFormat2,
2386 D,
2387 val_ref,
2388 decoder,
2389 inner_offset,
2390 inner_depth
2391 )?;
2392 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2393 {
2394 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2395 }
2396 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2397 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2398 }
2399 }
2400
2401 next_offset += envelope_size;
2402 _next_ordinal_to_read += 1;
2403 if next_offset >= end_offset {
2404 return Ok(());
2405 }
2406
2407 while _next_ordinal_to_read < 2 {
2409 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2410 _next_ordinal_to_read += 1;
2411 next_offset += envelope_size;
2412 }
2413
2414 let next_out_of_line = decoder.next_out_of_line();
2415 let handles_before = decoder.remaining_handles();
2416 if let Some((inlined, num_bytes, num_handles)) =
2417 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2418 {
2419 let member_inline_size =
2420 <FrameRate as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2421 if inlined != (member_inline_size <= 4) {
2422 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2423 }
2424 let inner_offset;
2425 let mut inner_depth = depth.clone();
2426 if inlined {
2427 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2428 inner_offset = next_offset;
2429 } else {
2430 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2431 inner_depth.increment()?;
2432 }
2433 let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(FrameRate, D));
2434 fidl::decode!(FrameRate, D, val_ref, decoder, inner_offset, inner_depth)?;
2435 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2436 {
2437 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2438 }
2439 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2440 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2441 }
2442 }
2443
2444 next_offset += envelope_size;
2445 _next_ordinal_to_read += 1;
2446 if next_offset >= end_offset {
2447 return Ok(());
2448 }
2449
2450 while _next_ordinal_to_read < 3 {
2452 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2453 _next_ordinal_to_read += 1;
2454 next_offset += envelope_size;
2455 }
2456
2457 let next_out_of_line = decoder.next_out_of_line();
2458 let handles_before = decoder.remaining_handles();
2459 if let Some((inlined, num_bytes, num_handles)) =
2460 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2461 {
2462 let member_inline_size =
2463 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2464 if inlined != (member_inline_size <= 4) {
2465 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2466 }
2467 let inner_offset;
2468 let mut inner_depth = depth.clone();
2469 if inlined {
2470 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2471 inner_offset = next_offset;
2472 } else {
2473 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2474 inner_depth.increment()?;
2475 }
2476 let val_ref =
2477 self.supports_crop_region.get_or_insert_with(|| fidl::new_empty!(bool, D));
2478 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2479 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2480 {
2481 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2482 }
2483 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2484 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2485 }
2486 }
2487
2488 next_offset += envelope_size;
2489 _next_ordinal_to_read += 1;
2490 if next_offset >= end_offset {
2491 return Ok(());
2492 }
2493
2494 while _next_ordinal_to_read < 4 {
2496 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2497 _next_ordinal_to_read += 1;
2498 next_offset += envelope_size;
2499 }
2500
2501 let next_out_of_line = decoder.next_out_of_line();
2502 let handles_before = decoder.remaining_handles();
2503 if let Some((inlined, num_bytes, num_handles)) =
2504 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2505 {
2506 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_math::Size, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2507 if inlined != (member_inline_size <= 4) {
2508 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2509 }
2510 let inner_offset;
2511 let mut inner_depth = depth.clone();
2512 if inlined {
2513 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2514 inner_offset = next_offset;
2515 } else {
2516 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2517 inner_depth.increment()?;
2518 }
2519 let val_ref = self.supported_resolutions.get_or_insert_with(
2520 || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math::Size, 256>, D),
2521 );
2522 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math::Size, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2523 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2524 {
2525 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2526 }
2527 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2528 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2529 }
2530 }
2531
2532 next_offset += envelope_size;
2533
2534 while next_offset < end_offset {
2536 _next_ordinal_to_read += 1;
2537 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2538 next_offset += envelope_size;
2539 }
2540
2541 Ok(())
2542 }
2543 }
2544
2545 impl fidl::encoding::ValueTypeMarker for WatchDevicesEvent {
2546 type Borrowed<'a> = &'a Self;
2547 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2548 value
2549 }
2550 }
2551
2552 unsafe impl fidl::encoding::TypeMarker for WatchDevicesEvent {
2553 type Owned = Self;
2554
2555 #[inline(always)]
2556 fn inline_align(_context: fidl::encoding::Context) -> usize {
2557 8
2558 }
2559
2560 #[inline(always)]
2561 fn inline_size(_context: fidl::encoding::Context) -> usize {
2562 16
2563 }
2564 }
2565
2566 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchDevicesEvent, D>
2567 for &WatchDevicesEvent
2568 {
2569 #[inline]
2570 unsafe fn encode(
2571 self,
2572 encoder: &mut fidl::encoding::Encoder<'_, D>,
2573 offset: usize,
2574 _depth: fidl::encoding::Depth,
2575 ) -> fidl::Result<()> {
2576 encoder.debug_check_bounds::<WatchDevicesEvent>(offset);
2577 encoder.write_num::<u64>(self.ordinal(), offset);
2578 match self {
2579 WatchDevicesEvent::Existing(ref val) => {
2580 fidl::encoding::encode_in_envelope::<u64, D>(
2581 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2582 encoder,
2583 offset + 8,
2584 _depth,
2585 )
2586 }
2587 WatchDevicesEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
2588 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2589 encoder,
2590 offset + 8,
2591 _depth,
2592 ),
2593 WatchDevicesEvent::Removed(ref val) => {
2594 fidl::encoding::encode_in_envelope::<u64, D>(
2595 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2596 encoder,
2597 offset + 8,
2598 _depth,
2599 )
2600 }
2601 }
2602 }
2603 }
2604
2605 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchDevicesEvent {
2606 #[inline(always)]
2607 fn new_empty() -> Self {
2608 Self::Existing(fidl::new_empty!(u64, D))
2609 }
2610
2611 #[inline]
2612 unsafe fn decode(
2613 &mut self,
2614 decoder: &mut fidl::encoding::Decoder<'_, D>,
2615 offset: usize,
2616 mut depth: fidl::encoding::Depth,
2617 ) -> fidl::Result<()> {
2618 decoder.debug_check_bounds::<Self>(offset);
2619 #[allow(unused_variables)]
2620 let next_out_of_line = decoder.next_out_of_line();
2621 let handles_before = decoder.remaining_handles();
2622 let (ordinal, inlined, num_bytes, num_handles) =
2623 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2624
2625 let member_inline_size = match ordinal {
2626 1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2627 2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2628 3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2629 _ => return Err(fidl::Error::UnknownUnionTag),
2630 };
2631
2632 if inlined != (member_inline_size <= 4) {
2633 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2634 }
2635 let _inner_offset;
2636 if inlined {
2637 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2638 _inner_offset = offset + 8;
2639 } else {
2640 depth.increment()?;
2641 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2642 }
2643 match ordinal {
2644 1 => {
2645 #[allow(irrefutable_let_patterns)]
2646 if let WatchDevicesEvent::Existing(_) = self {
2647 } else {
2649 *self = WatchDevicesEvent::Existing(fidl::new_empty!(u64, D));
2651 }
2652 #[allow(irrefutable_let_patterns)]
2653 if let WatchDevicesEvent::Existing(ref mut val) = self {
2654 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2655 } else {
2656 unreachable!()
2657 }
2658 }
2659 2 => {
2660 #[allow(irrefutable_let_patterns)]
2661 if let WatchDevicesEvent::Added(_) = self {
2662 } else {
2664 *self = WatchDevicesEvent::Added(fidl::new_empty!(u64, D));
2666 }
2667 #[allow(irrefutable_let_patterns)]
2668 if let WatchDevicesEvent::Added(ref mut val) = self {
2669 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2670 } else {
2671 unreachable!()
2672 }
2673 }
2674 3 => {
2675 #[allow(irrefutable_let_patterns)]
2676 if let WatchDevicesEvent::Removed(_) = self {
2677 } else {
2679 *self = WatchDevicesEvent::Removed(fidl::new_empty!(u64, D));
2681 }
2682 #[allow(irrefutable_let_patterns)]
2683 if let WatchDevicesEvent::Removed(ref mut val) = self {
2684 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2685 } else {
2686 unreachable!()
2687 }
2688 }
2689 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2690 }
2691 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2692 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2693 }
2694 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2695 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2696 }
2697 Ok(())
2698 }
2699 }
2700}