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