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_common::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_common::RectF>>,
180}
181
182impl fidl::Persistable for StreamSetCropRegionRequest {}
183
184#[derive(Clone, Debug, PartialEq)]
185pub struct StreamSetResolutionRequest {
186 pub coded_size: fidl_fuchsia_math_common::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_common::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_common::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_common::ImageFormat2>,
228 pub frame_rate: Option<FrameRate>,
230 pub supports_crop_region: Option<bool>,
232 pub supported_resolutions: Option<Vec<fidl_fuchsia_math_common::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
266pub mod device_ordinals {
267 pub const GET_IDENTIFIER: u64 = 0x1417d1af92667e47;
268 pub const GET_CONFIGURATIONS: u64 = 0x26c7a180d8eef786;
269 pub const GET_CONFIGURATIONS2: u64 = 0x2667155e740fb9ff;
270 pub const WATCH_CURRENT_CONFIGURATION: u64 = 0x7a82832a127834b7;
271 pub const SET_CURRENT_CONFIGURATION: u64 = 0x11d65c8f92593b87;
272 pub const WATCH_MUTE_STATE: u64 = 0x2bafd68e6e7ef2fb;
273 pub const SET_SOFTWARE_MUTE_STATE: u64 = 0x6bb19cb687f560a5;
274 pub const CONNECT_TO_STREAM: u64 = 0x290a86763174c4c3;
275 pub const REBIND: u64 = 0x24811b7cee5c51c3;
276}
277
278pub mod device_watcher_ordinals {
279 pub const WATCH_DEVICES: u64 = 0x5f38542e295e8575;
280 pub const CONNECT_TO_DEVICE: u64 = 0x5f175a8283b26b2d;
281}
282
283pub mod stream__ordinals {
284 pub const GET_PROPERTIES: u64 = 0x13662921504b55f7;
285 pub const GET_PROPERTIES2: u64 = 0x70346d69a8cbc391;
286 pub const SET_CROP_REGION: u64 = 0x72dde73bf7a94302;
287 pub const WATCH_CROP_REGION: u64 = 0x4c28250035dbbb90;
288 pub const SET_RESOLUTION: u64 = 0x6ef2c207ff2b74e3;
289 pub const WATCH_RESOLUTION: u64 = 0x6c7b28be2b72ea7f;
290 pub const SET_BUFFER_COLLECTION2: u64 = 0x6691d2eed219c8e6;
291 pub const SET_BUFFER_COLLECTION: u64 = 0x730ab5c4ee023c6d;
292 pub const WATCH_BUFFER_COLLECTION2: u64 = 0x60c9daa36b3d2cf1;
293 pub const WATCH_BUFFER_COLLECTION: u64 = 0x35d855a45e19e5d6;
294 pub const WATCH_ORIENTATION: u64 = 0x1f0d1cd93daa1dd4;
295 pub const GET_NEXT_FRAME: u64 = 0x4b06b8dfbcbdc658;
296 pub const GET_NEXT_FRAME2: u64 = 0x7142a7a6aa6a6f10;
297 pub const REBIND: u64 = 0x75b84fa09b68dbef;
298}
299
300mod internal {
301 use super::*;
302 unsafe impl fidl::encoding::TypeMarker for Orientation {
303 type Owned = Self;
304
305 #[inline(always)]
306 fn inline_align(_context: fidl::encoding::Context) -> usize {
307 std::mem::align_of::<u32>()
308 }
309
310 #[inline(always)]
311 fn inline_size(_context: fidl::encoding::Context) -> usize {
312 std::mem::size_of::<u32>()
313 }
314
315 #[inline(always)]
316 fn encode_is_copy() -> bool {
317 true
318 }
319
320 #[inline(always)]
321 fn decode_is_copy() -> bool {
322 false
323 }
324 }
325
326 impl fidl::encoding::ValueTypeMarker for Orientation {
327 type Borrowed<'a> = Self;
328 #[inline(always)]
329 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
330 *value
331 }
332 }
333
334 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Orientation {
335 #[inline]
336 unsafe fn encode(
337 self,
338 encoder: &mut fidl::encoding::Encoder<'_, D>,
339 offset: usize,
340 _depth: fidl::encoding::Depth,
341 ) -> fidl::Result<()> {
342 encoder.debug_check_bounds::<Self>(offset);
343 encoder.write_num(self.into_primitive(), offset);
344 Ok(())
345 }
346 }
347
348 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Orientation {
349 #[inline(always)]
350 fn new_empty() -> Self {
351 Self::Up
352 }
353
354 #[inline]
355 unsafe fn decode(
356 &mut self,
357 decoder: &mut fidl::encoding::Decoder<'_, D>,
358 offset: usize,
359 _depth: fidl::encoding::Depth,
360 ) -> fidl::Result<()> {
361 decoder.debug_check_bounds::<Self>(offset);
362 let prim = decoder.read_num::<u32>(offset);
363
364 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
365 Ok(())
366 }
367 }
368
369 impl fidl::encoding::ValueTypeMarker for Configuration {
370 type Borrowed<'a> = &'a Self;
371 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
372 value
373 }
374 }
375
376 unsafe impl fidl::encoding::TypeMarker for Configuration {
377 type Owned = Self;
378
379 #[inline(always)]
380 fn inline_align(_context: fidl::encoding::Context) -> usize {
381 8
382 }
383
384 #[inline(always)]
385 fn inline_size(_context: fidl::encoding::Context) -> usize {
386 16
387 }
388 }
389
390 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Configuration, D>
391 for &Configuration
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 fidl::encoding::Encode::<Configuration, D>::encode(
403 (
404 <fidl::encoding::Vector<StreamProperties, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.streams),
405 ),
406 encoder, offset, _depth
407 )
408 }
409 }
410 unsafe impl<
411 D: fidl::encoding::ResourceDialect,
412 T0: fidl::encoding::Encode<fidl::encoding::Vector<StreamProperties, 256>, D>,
413 > fidl::encoding::Encode<Configuration, D> for (T0,)
414 {
415 #[inline]
416 unsafe fn encode(
417 self,
418 encoder: &mut fidl::encoding::Encoder<'_, D>,
419 offset: usize,
420 depth: fidl::encoding::Depth,
421 ) -> fidl::Result<()> {
422 encoder.debug_check_bounds::<Configuration>(offset);
423 self.0.encode(encoder, offset + 0, depth)?;
427 Ok(())
428 }
429 }
430
431 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration {
432 #[inline(always)]
433 fn new_empty() -> Self {
434 Self { streams: fidl::new_empty!(fidl::encoding::Vector<StreamProperties, 256>, D) }
435 }
436
437 #[inline]
438 unsafe fn decode(
439 &mut self,
440 decoder: &mut fidl::encoding::Decoder<'_, D>,
441 offset: usize,
442 _depth: fidl::encoding::Depth,
443 ) -> fidl::Result<()> {
444 decoder.debug_check_bounds::<Self>(offset);
445 fidl::decode!(fidl::encoding::Vector<StreamProperties, 256>, D, &mut self.streams, decoder, offset + 0, _depth)?;
447 Ok(())
448 }
449 }
450
451 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurations2Response {
452 type Borrowed<'a> = &'a Self;
453 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
454 value
455 }
456 }
457
458 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurations2Response {
459 type Owned = Self;
460
461 #[inline(always)]
462 fn inline_align(_context: fidl::encoding::Context) -> usize {
463 8
464 }
465
466 #[inline(always)]
467 fn inline_size(_context: fidl::encoding::Context) -> usize {
468 16
469 }
470 }
471
472 unsafe impl<D: fidl::encoding::ResourceDialect>
473 fidl::encoding::Encode<DeviceGetConfigurations2Response, D>
474 for &DeviceGetConfigurations2Response
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 fidl::encoding::Encode::<DeviceGetConfigurations2Response, D>::encode(
486 (
487 <fidl::encoding::Vector<Configuration2, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.configurations),
488 ),
489 encoder, offset, _depth
490 )
491 }
492 }
493 unsafe impl<
494 D: fidl::encoding::ResourceDialect,
495 T0: fidl::encoding::Encode<fidl::encoding::Vector<Configuration2, 256>, D>,
496 > fidl::encoding::Encode<DeviceGetConfigurations2Response, D> for (T0,)
497 {
498 #[inline]
499 unsafe fn encode(
500 self,
501 encoder: &mut fidl::encoding::Encoder<'_, D>,
502 offset: usize,
503 depth: fidl::encoding::Depth,
504 ) -> fidl::Result<()> {
505 encoder.debug_check_bounds::<DeviceGetConfigurations2Response>(offset);
506 self.0.encode(encoder, offset + 0, depth)?;
510 Ok(())
511 }
512 }
513
514 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
515 for DeviceGetConfigurations2Response
516 {
517 #[inline(always)]
518 fn new_empty() -> Self {
519 Self {
520 configurations: fidl::new_empty!(fidl::encoding::Vector<Configuration2, 256>, D),
521 }
522 }
523
524 #[inline]
525 unsafe fn decode(
526 &mut self,
527 decoder: &mut fidl::encoding::Decoder<'_, D>,
528 offset: usize,
529 _depth: fidl::encoding::Depth,
530 ) -> fidl::Result<()> {
531 decoder.debug_check_bounds::<Self>(offset);
532 fidl::decode!(fidl::encoding::Vector<Configuration2, 256>, D, &mut self.configurations, decoder, offset + 0, _depth)?;
534 Ok(())
535 }
536 }
537
538 impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationsResponse {
539 type Borrowed<'a> = &'a Self;
540 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
541 value
542 }
543 }
544
545 unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationsResponse {
546 type Owned = Self;
547
548 #[inline(always)]
549 fn inline_align(_context: fidl::encoding::Context) -> usize {
550 8
551 }
552
553 #[inline(always)]
554 fn inline_size(_context: fidl::encoding::Context) -> usize {
555 16
556 }
557 }
558
559 unsafe impl<D: fidl::encoding::ResourceDialect>
560 fidl::encoding::Encode<DeviceGetConfigurationsResponse, D>
561 for &DeviceGetConfigurationsResponse
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 fidl::encoding::Encode::<DeviceGetConfigurationsResponse, D>::encode(
573 (
574 <fidl::encoding::Vector<Configuration, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.configurations),
575 ),
576 encoder, offset, _depth
577 )
578 }
579 }
580 unsafe impl<
581 D: fidl::encoding::ResourceDialect,
582 T0: fidl::encoding::Encode<fidl::encoding::Vector<Configuration, 256>, D>,
583 > fidl::encoding::Encode<DeviceGetConfigurationsResponse, D> for (T0,)
584 {
585 #[inline]
586 unsafe fn encode(
587 self,
588 encoder: &mut fidl::encoding::Encoder<'_, D>,
589 offset: usize,
590 depth: fidl::encoding::Depth,
591 ) -> fidl::Result<()> {
592 encoder.debug_check_bounds::<DeviceGetConfigurationsResponse>(offset);
593 self.0.encode(encoder, offset + 0, depth)?;
597 Ok(())
598 }
599 }
600
601 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
602 for DeviceGetConfigurationsResponse
603 {
604 #[inline(always)]
605 fn new_empty() -> Self {
606 Self { configurations: fidl::new_empty!(fidl::encoding::Vector<Configuration, 256>, D) }
607 }
608
609 #[inline]
610 unsafe fn decode(
611 &mut self,
612 decoder: &mut fidl::encoding::Decoder<'_, D>,
613 offset: usize,
614 _depth: fidl::encoding::Depth,
615 ) -> fidl::Result<()> {
616 decoder.debug_check_bounds::<Self>(offset);
617 fidl::decode!(fidl::encoding::Vector<Configuration, 256>, D, &mut self.configurations, decoder, offset + 0, _depth)?;
619 Ok(())
620 }
621 }
622
623 impl fidl::encoding::ValueTypeMarker for DeviceGetIdentifierResponse {
624 type Borrowed<'a> = &'a Self;
625 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
626 value
627 }
628 }
629
630 unsafe impl fidl::encoding::TypeMarker for DeviceGetIdentifierResponse {
631 type Owned = Self;
632
633 #[inline(always)]
634 fn inline_align(_context: fidl::encoding::Context) -> usize {
635 8
636 }
637
638 #[inline(always)]
639 fn inline_size(_context: fidl::encoding::Context) -> usize {
640 16
641 }
642 }
643
644 unsafe impl<D: fidl::encoding::ResourceDialect>
645 fidl::encoding::Encode<DeviceGetIdentifierResponse, D> for &DeviceGetIdentifierResponse
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 fidl::encoding::Encode::<DeviceGetIdentifierResponse, D>::encode(
657 (
658 <fidl::encoding::Optional<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.identifier),
659 ),
660 encoder, offset, _depth
661 )
662 }
663 }
664 unsafe impl<
665 D: fidl::encoding::ResourceDialect,
666 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<256>>, D>,
667 > fidl::encoding::Encode<DeviceGetIdentifierResponse, D> for (T0,)
668 {
669 #[inline]
670 unsafe fn encode(
671 self,
672 encoder: &mut fidl::encoding::Encoder<'_, D>,
673 offset: usize,
674 depth: fidl::encoding::Depth,
675 ) -> fidl::Result<()> {
676 encoder.debug_check_bounds::<DeviceGetIdentifierResponse>(offset);
677 self.0.encode(encoder, offset + 0, depth)?;
681 Ok(())
682 }
683 }
684
685 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
686 for DeviceGetIdentifierResponse
687 {
688 #[inline(always)]
689 fn new_empty() -> Self {
690 Self {
691 identifier: fidl::new_empty!(
692 fidl::encoding::Optional<fidl::encoding::BoundedString<256>>,
693 D
694 ),
695 }
696 }
697
698 #[inline]
699 unsafe fn decode(
700 &mut self,
701 decoder: &mut fidl::encoding::Decoder<'_, D>,
702 offset: usize,
703 _depth: fidl::encoding::Depth,
704 ) -> fidl::Result<()> {
705 decoder.debug_check_bounds::<Self>(offset);
706 fidl::decode!(
708 fidl::encoding::Optional<fidl::encoding::BoundedString<256>>,
709 D,
710 &mut self.identifier,
711 decoder,
712 offset + 0,
713 _depth
714 )?;
715 Ok(())
716 }
717 }
718
719 impl fidl::encoding::ValueTypeMarker for DeviceSetCurrentConfigurationRequest {
720 type Borrowed<'a> = &'a Self;
721 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
722 value
723 }
724 }
725
726 unsafe impl fidl::encoding::TypeMarker for DeviceSetCurrentConfigurationRequest {
727 type Owned = Self;
728
729 #[inline(always)]
730 fn inline_align(_context: fidl::encoding::Context) -> usize {
731 4
732 }
733
734 #[inline(always)]
735 fn inline_size(_context: fidl::encoding::Context) -> usize {
736 4
737 }
738 #[inline(always)]
739 fn encode_is_copy() -> bool {
740 true
741 }
742
743 #[inline(always)]
744 fn decode_is_copy() -> bool {
745 true
746 }
747 }
748
749 unsafe impl<D: fidl::encoding::ResourceDialect>
750 fidl::encoding::Encode<DeviceSetCurrentConfigurationRequest, D>
751 for &DeviceSetCurrentConfigurationRequest
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 unsafe {
762 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
764 (buf_ptr as *mut DeviceSetCurrentConfigurationRequest)
765 .write_unaligned((self as *const DeviceSetCurrentConfigurationRequest).read());
766 }
769 Ok(())
770 }
771 }
772 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
773 fidl::encoding::Encode<DeviceSetCurrentConfigurationRequest, D> for (T0,)
774 {
775 #[inline]
776 unsafe fn encode(
777 self,
778 encoder: &mut fidl::encoding::Encoder<'_, D>,
779 offset: usize,
780 depth: fidl::encoding::Depth,
781 ) -> fidl::Result<()> {
782 encoder.debug_check_bounds::<DeviceSetCurrentConfigurationRequest>(offset);
783 self.0.encode(encoder, offset + 0, depth)?;
787 Ok(())
788 }
789 }
790
791 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
792 for DeviceSetCurrentConfigurationRequest
793 {
794 #[inline(always)]
795 fn new_empty() -> Self {
796 Self { index: fidl::new_empty!(u32, D) }
797 }
798
799 #[inline]
800 unsafe fn decode(
801 &mut self,
802 decoder: &mut fidl::encoding::Decoder<'_, D>,
803 offset: usize,
804 _depth: fidl::encoding::Depth,
805 ) -> fidl::Result<()> {
806 decoder.debug_check_bounds::<Self>(offset);
807 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
808 unsafe {
811 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
812 }
813 Ok(())
814 }
815 }
816
817 impl fidl::encoding::ValueTypeMarker for DeviceSetSoftwareMuteStateRequest {
818 type Borrowed<'a> = &'a Self;
819 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
820 value
821 }
822 }
823
824 unsafe impl fidl::encoding::TypeMarker for DeviceSetSoftwareMuteStateRequest {
825 type Owned = Self;
826
827 #[inline(always)]
828 fn inline_align(_context: fidl::encoding::Context) -> usize {
829 1
830 }
831
832 #[inline(always)]
833 fn inline_size(_context: fidl::encoding::Context) -> usize {
834 1
835 }
836 }
837
838 unsafe impl<D: fidl::encoding::ResourceDialect>
839 fidl::encoding::Encode<DeviceSetSoftwareMuteStateRequest, D>
840 for &DeviceSetSoftwareMuteStateRequest
841 {
842 #[inline]
843 unsafe fn encode(
844 self,
845 encoder: &mut fidl::encoding::Encoder<'_, D>,
846 offset: usize,
847 _depth: fidl::encoding::Depth,
848 ) -> fidl::Result<()> {
849 encoder.debug_check_bounds::<DeviceSetSoftwareMuteStateRequest>(offset);
850 fidl::encoding::Encode::<DeviceSetSoftwareMuteStateRequest, D>::encode(
852 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),),
853 encoder,
854 offset,
855 _depth,
856 )
857 }
858 }
859 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
860 fidl::encoding::Encode<DeviceSetSoftwareMuteStateRequest, D> for (T0,)
861 {
862 #[inline]
863 unsafe fn encode(
864 self,
865 encoder: &mut fidl::encoding::Encoder<'_, D>,
866 offset: usize,
867 depth: fidl::encoding::Depth,
868 ) -> fidl::Result<()> {
869 encoder.debug_check_bounds::<DeviceSetSoftwareMuteStateRequest>(offset);
870 self.0.encode(encoder, offset + 0, depth)?;
874 Ok(())
875 }
876 }
877
878 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
879 for DeviceSetSoftwareMuteStateRequest
880 {
881 #[inline(always)]
882 fn new_empty() -> Self {
883 Self { muted: fidl::new_empty!(bool, D) }
884 }
885
886 #[inline]
887 unsafe fn decode(
888 &mut self,
889 decoder: &mut fidl::encoding::Decoder<'_, D>,
890 offset: usize,
891 _depth: fidl::encoding::Depth,
892 ) -> fidl::Result<()> {
893 decoder.debug_check_bounds::<Self>(offset);
894 fidl::decode!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
896 Ok(())
897 }
898 }
899
900 impl fidl::encoding::ValueTypeMarker for DeviceWatchCurrentConfigurationResponse {
901 type Borrowed<'a> = &'a Self;
902 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
903 value
904 }
905 }
906
907 unsafe impl fidl::encoding::TypeMarker for DeviceWatchCurrentConfigurationResponse {
908 type Owned = Self;
909
910 #[inline(always)]
911 fn inline_align(_context: fidl::encoding::Context) -> usize {
912 4
913 }
914
915 #[inline(always)]
916 fn inline_size(_context: fidl::encoding::Context) -> usize {
917 4
918 }
919 #[inline(always)]
920 fn encode_is_copy() -> bool {
921 true
922 }
923
924 #[inline(always)]
925 fn decode_is_copy() -> bool {
926 true
927 }
928 }
929
930 unsafe impl<D: fidl::encoding::ResourceDialect>
931 fidl::encoding::Encode<DeviceWatchCurrentConfigurationResponse, D>
932 for &DeviceWatchCurrentConfigurationResponse
933 {
934 #[inline]
935 unsafe fn encode(
936 self,
937 encoder: &mut fidl::encoding::Encoder<'_, D>,
938 offset: usize,
939 _depth: fidl::encoding::Depth,
940 ) -> fidl::Result<()> {
941 encoder.debug_check_bounds::<DeviceWatchCurrentConfigurationResponse>(offset);
942 unsafe {
943 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
945 (buf_ptr as *mut DeviceWatchCurrentConfigurationResponse).write_unaligned(
946 (self as *const DeviceWatchCurrentConfigurationResponse).read(),
947 );
948 }
951 Ok(())
952 }
953 }
954 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
955 fidl::encoding::Encode<DeviceWatchCurrentConfigurationResponse, D> for (T0,)
956 {
957 #[inline]
958 unsafe fn encode(
959 self,
960 encoder: &mut fidl::encoding::Encoder<'_, D>,
961 offset: usize,
962 depth: fidl::encoding::Depth,
963 ) -> fidl::Result<()> {
964 encoder.debug_check_bounds::<DeviceWatchCurrentConfigurationResponse>(offset);
965 self.0.encode(encoder, offset + 0, depth)?;
969 Ok(())
970 }
971 }
972
973 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
974 for DeviceWatchCurrentConfigurationResponse
975 {
976 #[inline(always)]
977 fn new_empty() -> Self {
978 Self { index: fidl::new_empty!(u32, D) }
979 }
980
981 #[inline]
982 unsafe fn decode(
983 &mut self,
984 decoder: &mut fidl::encoding::Decoder<'_, D>,
985 offset: usize,
986 _depth: fidl::encoding::Depth,
987 ) -> fidl::Result<()> {
988 decoder.debug_check_bounds::<Self>(offset);
989 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
990 unsafe {
993 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
994 }
995 Ok(())
996 }
997 }
998
999 impl fidl::encoding::ValueTypeMarker for DeviceWatchMuteStateResponse {
1000 type Borrowed<'a> = &'a Self;
1001 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1002 value
1003 }
1004 }
1005
1006 unsafe impl fidl::encoding::TypeMarker for DeviceWatchMuteStateResponse {
1007 type Owned = Self;
1008
1009 #[inline(always)]
1010 fn inline_align(_context: fidl::encoding::Context) -> usize {
1011 1
1012 }
1013
1014 #[inline(always)]
1015 fn inline_size(_context: fidl::encoding::Context) -> usize {
1016 2
1017 }
1018 }
1019
1020 unsafe impl<D: fidl::encoding::ResourceDialect>
1021 fidl::encoding::Encode<DeviceWatchMuteStateResponse, D> for &DeviceWatchMuteStateResponse
1022 {
1023 #[inline]
1024 unsafe fn encode(
1025 self,
1026 encoder: &mut fidl::encoding::Encoder<'_, D>,
1027 offset: usize,
1028 _depth: fidl::encoding::Depth,
1029 ) -> fidl::Result<()> {
1030 encoder.debug_check_bounds::<DeviceWatchMuteStateResponse>(offset);
1031 fidl::encoding::Encode::<DeviceWatchMuteStateResponse, D>::encode(
1033 (
1034 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.software_muted),
1035 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.hardware_muted),
1036 ),
1037 encoder,
1038 offset,
1039 _depth,
1040 )
1041 }
1042 }
1043 unsafe impl<
1044 D: fidl::encoding::ResourceDialect,
1045 T0: fidl::encoding::Encode<bool, D>,
1046 T1: fidl::encoding::Encode<bool, D>,
1047 > fidl::encoding::Encode<DeviceWatchMuteStateResponse, D> for (T0, T1)
1048 {
1049 #[inline]
1050 unsafe fn encode(
1051 self,
1052 encoder: &mut fidl::encoding::Encoder<'_, D>,
1053 offset: usize,
1054 depth: fidl::encoding::Depth,
1055 ) -> fidl::Result<()> {
1056 encoder.debug_check_bounds::<DeviceWatchMuteStateResponse>(offset);
1057 self.0.encode(encoder, offset + 0, depth)?;
1061 self.1.encode(encoder, offset + 1, depth)?;
1062 Ok(())
1063 }
1064 }
1065
1066 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1067 for DeviceWatchMuteStateResponse
1068 {
1069 #[inline(always)]
1070 fn new_empty() -> Self {
1071 Self {
1072 software_muted: fidl::new_empty!(bool, D),
1073 hardware_muted: fidl::new_empty!(bool, D),
1074 }
1075 }
1076
1077 #[inline]
1078 unsafe fn decode(
1079 &mut self,
1080 decoder: &mut fidl::encoding::Decoder<'_, D>,
1081 offset: usize,
1082 _depth: fidl::encoding::Depth,
1083 ) -> fidl::Result<()> {
1084 decoder.debug_check_bounds::<Self>(offset);
1085 fidl::decode!(bool, D, &mut self.software_muted, decoder, offset + 0, _depth)?;
1087 fidl::decode!(bool, D, &mut self.hardware_muted, decoder, offset + 1, _depth)?;
1088 Ok(())
1089 }
1090 }
1091
1092 impl fidl::encoding::ValueTypeMarker for DeviceWatcherWatchDevicesResponse {
1093 type Borrowed<'a> = &'a Self;
1094 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1095 value
1096 }
1097 }
1098
1099 unsafe impl fidl::encoding::TypeMarker for DeviceWatcherWatchDevicesResponse {
1100 type Owned = Self;
1101
1102 #[inline(always)]
1103 fn inline_align(_context: fidl::encoding::Context) -> usize {
1104 8
1105 }
1106
1107 #[inline(always)]
1108 fn inline_size(_context: fidl::encoding::Context) -> usize {
1109 16
1110 }
1111 }
1112
1113 unsafe impl<D: fidl::encoding::ResourceDialect>
1114 fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D>
1115 for &DeviceWatcherWatchDevicesResponse
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 fidl::encoding::Encode::<DeviceWatcherWatchDevicesResponse, D>::encode(
1127 (
1128 <fidl::encoding::Vector<WatchDevicesEvent, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
1129 ),
1130 encoder, offset, _depth
1131 )
1132 }
1133 }
1134 unsafe impl<
1135 D: fidl::encoding::ResourceDialect,
1136 T0: fidl::encoding::Encode<fidl::encoding::Vector<WatchDevicesEvent, 256>, D>,
1137 > fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D> for (T0,)
1138 {
1139 #[inline]
1140 unsafe fn encode(
1141 self,
1142 encoder: &mut fidl::encoding::Encoder<'_, D>,
1143 offset: usize,
1144 depth: fidl::encoding::Depth,
1145 ) -> fidl::Result<()> {
1146 encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
1147 self.0.encode(encoder, offset + 0, depth)?;
1151 Ok(())
1152 }
1153 }
1154
1155 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1156 for DeviceWatcherWatchDevicesResponse
1157 {
1158 #[inline(always)]
1159 fn new_empty() -> Self {
1160 Self { events: fidl::new_empty!(fidl::encoding::Vector<WatchDevicesEvent, 256>, D) }
1161 }
1162
1163 #[inline]
1164 unsafe fn decode(
1165 &mut self,
1166 decoder: &mut fidl::encoding::Decoder<'_, D>,
1167 offset: usize,
1168 _depth: fidl::encoding::Depth,
1169 ) -> fidl::Result<()> {
1170 decoder.debug_check_bounds::<Self>(offset);
1171 fidl::decode!(fidl::encoding::Vector<WatchDevicesEvent, 256>, D, &mut self.events, decoder, offset + 0, _depth)?;
1173 Ok(())
1174 }
1175 }
1176
1177 impl fidl::encoding::ValueTypeMarker for FrameRate {
1178 type Borrowed<'a> = &'a Self;
1179 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1180 value
1181 }
1182 }
1183
1184 unsafe impl fidl::encoding::TypeMarker for FrameRate {
1185 type Owned = Self;
1186
1187 #[inline(always)]
1188 fn inline_align(_context: fidl::encoding::Context) -> usize {
1189 4
1190 }
1191
1192 #[inline(always)]
1193 fn inline_size(_context: fidl::encoding::Context) -> usize {
1194 8
1195 }
1196 #[inline(always)]
1197 fn encode_is_copy() -> bool {
1198 true
1199 }
1200
1201 #[inline(always)]
1202 fn decode_is_copy() -> bool {
1203 true
1204 }
1205 }
1206
1207 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameRate, D>
1208 for &FrameRate
1209 {
1210 #[inline]
1211 unsafe fn encode(
1212 self,
1213 encoder: &mut fidl::encoding::Encoder<'_, D>,
1214 offset: usize,
1215 _depth: fidl::encoding::Depth,
1216 ) -> fidl::Result<()> {
1217 encoder.debug_check_bounds::<FrameRate>(offset);
1218 unsafe {
1219 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1221 (buf_ptr as *mut FrameRate).write_unaligned((self as *const FrameRate).read());
1222 }
1225 Ok(())
1226 }
1227 }
1228 unsafe impl<
1229 D: fidl::encoding::ResourceDialect,
1230 T0: fidl::encoding::Encode<u32, D>,
1231 T1: fidl::encoding::Encode<u32, D>,
1232 > fidl::encoding::Encode<FrameRate, D> for (T0, T1)
1233 {
1234 #[inline]
1235 unsafe fn encode(
1236 self,
1237 encoder: &mut fidl::encoding::Encoder<'_, D>,
1238 offset: usize,
1239 depth: fidl::encoding::Depth,
1240 ) -> fidl::Result<()> {
1241 encoder.debug_check_bounds::<FrameRate>(offset);
1242 self.0.encode(encoder, offset + 0, depth)?;
1246 self.1.encode(encoder, offset + 4, depth)?;
1247 Ok(())
1248 }
1249 }
1250
1251 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameRate {
1252 #[inline(always)]
1253 fn new_empty() -> Self {
1254 Self { numerator: fidl::new_empty!(u32, D), denominator: fidl::new_empty!(u32, D) }
1255 }
1256
1257 #[inline]
1258 unsafe fn decode(
1259 &mut self,
1260 decoder: &mut fidl::encoding::Decoder<'_, D>,
1261 offset: usize,
1262 _depth: fidl::encoding::Depth,
1263 ) -> fidl::Result<()> {
1264 decoder.debug_check_bounds::<Self>(offset);
1265 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1266 unsafe {
1269 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1270 }
1271 Ok(())
1272 }
1273 }
1274
1275 impl fidl::encoding::ValueTypeMarker for StreamGetProperties2Response {
1276 type Borrowed<'a> = &'a Self;
1277 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1278 value
1279 }
1280 }
1281
1282 unsafe impl fidl::encoding::TypeMarker for StreamGetProperties2Response {
1283 type Owned = Self;
1284
1285 #[inline(always)]
1286 fn inline_align(_context: fidl::encoding::Context) -> usize {
1287 8
1288 }
1289
1290 #[inline(always)]
1291 fn inline_size(_context: fidl::encoding::Context) -> usize {
1292 16
1293 }
1294 }
1295
1296 unsafe impl<D: fidl::encoding::ResourceDialect>
1297 fidl::encoding::Encode<StreamGetProperties2Response, D> for &StreamGetProperties2Response
1298 {
1299 #[inline]
1300 unsafe fn encode(
1301 self,
1302 encoder: &mut fidl::encoding::Encoder<'_, D>,
1303 offset: usize,
1304 _depth: fidl::encoding::Depth,
1305 ) -> fidl::Result<()> {
1306 encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1307 fidl::encoding::Encode::<StreamGetProperties2Response, D>::encode(
1309 (<StreamProperties2 as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1310 encoder,
1311 offset,
1312 _depth,
1313 )
1314 }
1315 }
1316 unsafe impl<
1317 D: fidl::encoding::ResourceDialect,
1318 T0: fidl::encoding::Encode<StreamProperties2, D>,
1319 > fidl::encoding::Encode<StreamGetProperties2Response, D> for (T0,)
1320 {
1321 #[inline]
1322 unsafe fn encode(
1323 self,
1324 encoder: &mut fidl::encoding::Encoder<'_, D>,
1325 offset: usize,
1326 depth: fidl::encoding::Depth,
1327 ) -> fidl::Result<()> {
1328 encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1329 self.0.encode(encoder, offset + 0, depth)?;
1333 Ok(())
1334 }
1335 }
1336
1337 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1338 for StreamGetProperties2Response
1339 {
1340 #[inline(always)]
1341 fn new_empty() -> Self {
1342 Self { properties: fidl::new_empty!(StreamProperties2, D) }
1343 }
1344
1345 #[inline]
1346 unsafe fn decode(
1347 &mut self,
1348 decoder: &mut fidl::encoding::Decoder<'_, D>,
1349 offset: usize,
1350 _depth: fidl::encoding::Depth,
1351 ) -> fidl::Result<()> {
1352 decoder.debug_check_bounds::<Self>(offset);
1353 fidl::decode!(StreamProperties2, D, &mut self.properties, decoder, offset + 0, _depth)?;
1355 Ok(())
1356 }
1357 }
1358
1359 impl fidl::encoding::ValueTypeMarker for StreamGetPropertiesResponse {
1360 type Borrowed<'a> = &'a Self;
1361 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1362 value
1363 }
1364 }
1365
1366 unsafe impl fidl::encoding::TypeMarker for StreamGetPropertiesResponse {
1367 type Owned = Self;
1368
1369 #[inline(always)]
1370 fn inline_align(_context: fidl::encoding::Context) -> usize {
1371 8
1372 }
1373
1374 #[inline(always)]
1375 fn inline_size(_context: fidl::encoding::Context) -> usize {
1376 72
1377 }
1378 }
1379
1380 unsafe impl<D: fidl::encoding::ResourceDialect>
1381 fidl::encoding::Encode<StreamGetPropertiesResponse, D> for &StreamGetPropertiesResponse
1382 {
1383 #[inline]
1384 unsafe fn encode(
1385 self,
1386 encoder: &mut fidl::encoding::Encoder<'_, D>,
1387 offset: usize,
1388 _depth: fidl::encoding::Depth,
1389 ) -> fidl::Result<()> {
1390 encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1391 fidl::encoding::Encode::<StreamGetPropertiesResponse, D>::encode(
1393 (<StreamProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1394 encoder,
1395 offset,
1396 _depth,
1397 )
1398 }
1399 }
1400 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties, D>>
1401 fidl::encoding::Encode<StreamGetPropertiesResponse, D> for (T0,)
1402 {
1403 #[inline]
1404 unsafe fn encode(
1405 self,
1406 encoder: &mut fidl::encoding::Encoder<'_, D>,
1407 offset: usize,
1408 depth: fidl::encoding::Depth,
1409 ) -> fidl::Result<()> {
1410 encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1411 self.0.encode(encoder, offset + 0, depth)?;
1415 Ok(())
1416 }
1417 }
1418
1419 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1420 for StreamGetPropertiesResponse
1421 {
1422 #[inline(always)]
1423 fn new_empty() -> Self {
1424 Self { properties: fidl::new_empty!(StreamProperties, D) }
1425 }
1426
1427 #[inline]
1428 unsafe fn decode(
1429 &mut self,
1430 decoder: &mut fidl::encoding::Decoder<'_, D>,
1431 offset: usize,
1432 _depth: fidl::encoding::Depth,
1433 ) -> fidl::Result<()> {
1434 decoder.debug_check_bounds::<Self>(offset);
1435 fidl::decode!(StreamProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
1437 Ok(())
1438 }
1439 }
1440
1441 impl fidl::encoding::ValueTypeMarker for StreamProperties {
1442 type Borrowed<'a> = &'a Self;
1443 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1444 value
1445 }
1446 }
1447
1448 unsafe impl fidl::encoding::TypeMarker for StreamProperties {
1449 type Owned = Self;
1450
1451 #[inline(always)]
1452 fn inline_align(_context: fidl::encoding::Context) -> usize {
1453 8
1454 }
1455
1456 #[inline(always)]
1457 fn inline_size(_context: fidl::encoding::Context) -> usize {
1458 72
1459 }
1460 }
1461
1462 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties, D>
1463 for &StreamProperties
1464 {
1465 #[inline]
1466 unsafe fn encode(
1467 self,
1468 encoder: &mut fidl::encoding::Encoder<'_, D>,
1469 offset: usize,
1470 _depth: fidl::encoding::Depth,
1471 ) -> fidl::Result<()> {
1472 encoder.debug_check_bounds::<StreamProperties>(offset);
1473 fidl::encoding::Encode::<StreamProperties, D>::encode(
1475 (
1476 <fidl_fuchsia_sysmem_common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format),
1477 <FrameRate as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rate),
1478 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_crop_region),
1479 ),
1480 encoder, offset, _depth
1481 )
1482 }
1483 }
1484 unsafe impl<
1485 D: fidl::encoding::ResourceDialect,
1486 T0: fidl::encoding::Encode<fidl_fuchsia_sysmem_common::ImageFormat2, D>,
1487 T1: fidl::encoding::Encode<FrameRate, D>,
1488 T2: fidl::encoding::Encode<bool, D>,
1489 > fidl::encoding::Encode<StreamProperties, D> for (T0, T1, T2)
1490 {
1491 #[inline]
1492 unsafe fn encode(
1493 self,
1494 encoder: &mut fidl::encoding::Encoder<'_, D>,
1495 offset: usize,
1496 depth: fidl::encoding::Depth,
1497 ) -> fidl::Result<()> {
1498 encoder.debug_check_bounds::<StreamProperties>(offset);
1499 unsafe {
1502 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
1503 (ptr as *mut u64).write_unaligned(0);
1504 }
1505 self.0.encode(encoder, offset + 0, depth)?;
1507 self.1.encode(encoder, offset + 56, depth)?;
1508 self.2.encode(encoder, offset + 64, depth)?;
1509 Ok(())
1510 }
1511 }
1512
1513 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties {
1514 #[inline(always)]
1515 fn new_empty() -> Self {
1516 Self {
1517 image_format: fidl::new_empty!(fidl_fuchsia_sysmem_common::ImageFormat2, D),
1518 frame_rate: fidl::new_empty!(FrameRate, D),
1519 supports_crop_region: fidl::new_empty!(bool, D),
1520 }
1521 }
1522
1523 #[inline]
1524 unsafe fn decode(
1525 &mut self,
1526 decoder: &mut fidl::encoding::Decoder<'_, D>,
1527 offset: usize,
1528 _depth: fidl::encoding::Depth,
1529 ) -> fidl::Result<()> {
1530 decoder.debug_check_bounds::<Self>(offset);
1531 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
1533 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1534 let mask = 0xffffffffffffff00u64;
1535 let maskedval = padval & mask;
1536 if maskedval != 0 {
1537 return Err(fidl::Error::NonZeroPadding {
1538 padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
1539 });
1540 }
1541 fidl::decode!(
1542 fidl_fuchsia_sysmem_common::ImageFormat2,
1543 D,
1544 &mut self.image_format,
1545 decoder,
1546 offset + 0,
1547 _depth
1548 )?;
1549 fidl::decode!(FrameRate, D, &mut self.frame_rate, decoder, offset + 56, _depth)?;
1550 fidl::decode!(bool, D, &mut self.supports_crop_region, decoder, offset + 64, _depth)?;
1551 Ok(())
1552 }
1553 }
1554
1555 impl fidl::encoding::ValueTypeMarker for StreamSetCropRegionRequest {
1556 type Borrowed<'a> = &'a Self;
1557 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1558 value
1559 }
1560 }
1561
1562 unsafe impl fidl::encoding::TypeMarker for StreamSetCropRegionRequest {
1563 type Owned = Self;
1564
1565 #[inline(always)]
1566 fn inline_align(_context: fidl::encoding::Context) -> usize {
1567 8
1568 }
1569
1570 #[inline(always)]
1571 fn inline_size(_context: fidl::encoding::Context) -> usize {
1572 8
1573 }
1574 }
1575
1576 unsafe impl<D: fidl::encoding::ResourceDialect>
1577 fidl::encoding::Encode<StreamSetCropRegionRequest, D> for &StreamSetCropRegionRequest
1578 {
1579 #[inline]
1580 unsafe fn encode(
1581 self,
1582 encoder: &mut fidl::encoding::Encoder<'_, D>,
1583 offset: usize,
1584 _depth: fidl::encoding::Depth,
1585 ) -> fidl::Result<()> {
1586 encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1587 fidl::encoding::Encode::<StreamSetCropRegionRequest, D>::encode(
1589 (
1590 <fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1591 ),
1592 encoder, offset, _depth
1593 )
1594 }
1595 }
1596 unsafe impl<
1597 D: fidl::encoding::ResourceDialect,
1598 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF>, D>,
1599 > fidl::encoding::Encode<StreamSetCropRegionRequest, D> for (T0,)
1600 {
1601 #[inline]
1602 unsafe fn encode(
1603 self,
1604 encoder: &mut fidl::encoding::Encoder<'_, D>,
1605 offset: usize,
1606 depth: fidl::encoding::Depth,
1607 ) -> fidl::Result<()> {
1608 encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1609 self.0.encode(encoder, offset + 0, depth)?;
1613 Ok(())
1614 }
1615 }
1616
1617 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1618 for StreamSetCropRegionRequest
1619 {
1620 #[inline(always)]
1621 fn new_empty() -> Self {
1622 Self {
1623 region: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF>, D),
1624 }
1625 }
1626
1627 #[inline]
1628 unsafe fn decode(
1629 &mut self,
1630 decoder: &mut fidl::encoding::Decoder<'_, D>,
1631 offset: usize,
1632 _depth: fidl::encoding::Depth,
1633 ) -> fidl::Result<()> {
1634 decoder.debug_check_bounds::<Self>(offset);
1635 fidl::decode!(
1637 fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF>,
1638 D,
1639 &mut self.region,
1640 decoder,
1641 offset + 0,
1642 _depth
1643 )?;
1644 Ok(())
1645 }
1646 }
1647
1648 impl fidl::encoding::ValueTypeMarker for StreamSetResolutionRequest {
1649 type Borrowed<'a> = &'a Self;
1650 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1651 value
1652 }
1653 }
1654
1655 unsafe impl fidl::encoding::TypeMarker for StreamSetResolutionRequest {
1656 type Owned = Self;
1657
1658 #[inline(always)]
1659 fn inline_align(_context: fidl::encoding::Context) -> usize {
1660 4
1661 }
1662
1663 #[inline(always)]
1664 fn inline_size(_context: fidl::encoding::Context) -> usize {
1665 8
1666 }
1667 }
1668
1669 unsafe impl<D: fidl::encoding::ResourceDialect>
1670 fidl::encoding::Encode<StreamSetResolutionRequest, D> for &StreamSetResolutionRequest
1671 {
1672 #[inline]
1673 unsafe fn encode(
1674 self,
1675 encoder: &mut fidl::encoding::Encoder<'_, D>,
1676 offset: usize,
1677 _depth: fidl::encoding::Depth,
1678 ) -> fidl::Result<()> {
1679 encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1680 fidl::encoding::Encode::<StreamSetResolutionRequest, D>::encode(
1682 (<fidl_fuchsia_math_common::Size as fidl::encoding::ValueTypeMarker>::borrow(
1683 &self.coded_size,
1684 ),),
1685 encoder,
1686 offset,
1687 _depth,
1688 )
1689 }
1690 }
1691 unsafe impl<
1692 D: fidl::encoding::ResourceDialect,
1693 T0: fidl::encoding::Encode<fidl_fuchsia_math_common::Size, D>,
1694 > fidl::encoding::Encode<StreamSetResolutionRequest, D> for (T0,)
1695 {
1696 #[inline]
1697 unsafe fn encode(
1698 self,
1699 encoder: &mut fidl::encoding::Encoder<'_, D>,
1700 offset: usize,
1701 depth: fidl::encoding::Depth,
1702 ) -> fidl::Result<()> {
1703 encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1704 self.0.encode(encoder, offset + 0, depth)?;
1708 Ok(())
1709 }
1710 }
1711
1712 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1713 for StreamSetResolutionRequest
1714 {
1715 #[inline(always)]
1716 fn new_empty() -> Self {
1717 Self { coded_size: fidl::new_empty!(fidl_fuchsia_math_common::Size, D) }
1718 }
1719
1720 #[inline]
1721 unsafe fn decode(
1722 &mut self,
1723 decoder: &mut fidl::encoding::Decoder<'_, D>,
1724 offset: usize,
1725 _depth: fidl::encoding::Depth,
1726 ) -> fidl::Result<()> {
1727 decoder.debug_check_bounds::<Self>(offset);
1728 fidl::decode!(
1730 fidl_fuchsia_math_common::Size,
1731 D,
1732 &mut self.coded_size,
1733 decoder,
1734 offset + 0,
1735 _depth
1736 )?;
1737 Ok(())
1738 }
1739 }
1740
1741 impl fidl::encoding::ValueTypeMarker for StreamWatchCropRegionResponse {
1742 type Borrowed<'a> = &'a Self;
1743 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1744 value
1745 }
1746 }
1747
1748 unsafe impl fidl::encoding::TypeMarker for StreamWatchCropRegionResponse {
1749 type Owned = Self;
1750
1751 #[inline(always)]
1752 fn inline_align(_context: fidl::encoding::Context) -> usize {
1753 8
1754 }
1755
1756 #[inline(always)]
1757 fn inline_size(_context: fidl::encoding::Context) -> usize {
1758 8
1759 }
1760 }
1761
1762 unsafe impl<D: fidl::encoding::ResourceDialect>
1763 fidl::encoding::Encode<StreamWatchCropRegionResponse, D>
1764 for &StreamWatchCropRegionResponse
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 fidl::encoding::Encode::<StreamWatchCropRegionResponse, D>::encode(
1776 (
1777 <fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1778 ),
1779 encoder, offset, _depth
1780 )
1781 }
1782 }
1783 unsafe impl<
1784 D: fidl::encoding::ResourceDialect,
1785 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF>, D>,
1786 > fidl::encoding::Encode<StreamWatchCropRegionResponse, D> for (T0,)
1787 {
1788 #[inline]
1789 unsafe fn encode(
1790 self,
1791 encoder: &mut fidl::encoding::Encoder<'_, D>,
1792 offset: usize,
1793 depth: fidl::encoding::Depth,
1794 ) -> fidl::Result<()> {
1795 encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1796 self.0.encode(encoder, offset + 0, depth)?;
1800 Ok(())
1801 }
1802 }
1803
1804 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1805 for StreamWatchCropRegionResponse
1806 {
1807 #[inline(always)]
1808 fn new_empty() -> Self {
1809 Self {
1810 region: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF>, D),
1811 }
1812 }
1813
1814 #[inline]
1815 unsafe fn decode(
1816 &mut self,
1817 decoder: &mut fidl::encoding::Decoder<'_, D>,
1818 offset: usize,
1819 _depth: fidl::encoding::Depth,
1820 ) -> fidl::Result<()> {
1821 decoder.debug_check_bounds::<Self>(offset);
1822 fidl::decode!(
1824 fidl::encoding::Boxed<fidl_fuchsia_math_common::RectF>,
1825 D,
1826 &mut self.region,
1827 decoder,
1828 offset + 0,
1829 _depth
1830 )?;
1831 Ok(())
1832 }
1833 }
1834
1835 impl fidl::encoding::ValueTypeMarker for StreamWatchOrientationResponse {
1836 type Borrowed<'a> = &'a Self;
1837 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1838 value
1839 }
1840 }
1841
1842 unsafe impl fidl::encoding::TypeMarker for StreamWatchOrientationResponse {
1843 type Owned = Self;
1844
1845 #[inline(always)]
1846 fn inline_align(_context: fidl::encoding::Context) -> usize {
1847 4
1848 }
1849
1850 #[inline(always)]
1851 fn inline_size(_context: fidl::encoding::Context) -> usize {
1852 4
1853 }
1854 }
1855
1856 unsafe impl<D: fidl::encoding::ResourceDialect>
1857 fidl::encoding::Encode<StreamWatchOrientationResponse, D>
1858 for &StreamWatchOrientationResponse
1859 {
1860 #[inline]
1861 unsafe fn encode(
1862 self,
1863 encoder: &mut fidl::encoding::Encoder<'_, D>,
1864 offset: usize,
1865 _depth: fidl::encoding::Depth,
1866 ) -> fidl::Result<()> {
1867 encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1868 fidl::encoding::Encode::<StreamWatchOrientationResponse, D>::encode(
1870 (<Orientation as fidl::encoding::ValueTypeMarker>::borrow(&self.orientation),),
1871 encoder,
1872 offset,
1873 _depth,
1874 )
1875 }
1876 }
1877 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Orientation, D>>
1878 fidl::encoding::Encode<StreamWatchOrientationResponse, D> for (T0,)
1879 {
1880 #[inline]
1881 unsafe fn encode(
1882 self,
1883 encoder: &mut fidl::encoding::Encoder<'_, D>,
1884 offset: usize,
1885 depth: fidl::encoding::Depth,
1886 ) -> fidl::Result<()> {
1887 encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1888 self.0.encode(encoder, offset + 0, depth)?;
1892 Ok(())
1893 }
1894 }
1895
1896 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1897 for StreamWatchOrientationResponse
1898 {
1899 #[inline(always)]
1900 fn new_empty() -> Self {
1901 Self { orientation: fidl::new_empty!(Orientation, D) }
1902 }
1903
1904 #[inline]
1905 unsafe fn decode(
1906 &mut self,
1907 decoder: &mut fidl::encoding::Decoder<'_, D>,
1908 offset: usize,
1909 _depth: fidl::encoding::Depth,
1910 ) -> fidl::Result<()> {
1911 decoder.debug_check_bounds::<Self>(offset);
1912 fidl::decode!(Orientation, D, &mut self.orientation, decoder, offset + 0, _depth)?;
1914 Ok(())
1915 }
1916 }
1917
1918 impl fidl::encoding::ValueTypeMarker for StreamWatchResolutionResponse {
1919 type Borrowed<'a> = &'a Self;
1920 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1921 value
1922 }
1923 }
1924
1925 unsafe impl fidl::encoding::TypeMarker for StreamWatchResolutionResponse {
1926 type Owned = Self;
1927
1928 #[inline(always)]
1929 fn inline_align(_context: fidl::encoding::Context) -> usize {
1930 4
1931 }
1932
1933 #[inline(always)]
1934 fn inline_size(_context: fidl::encoding::Context) -> usize {
1935 8
1936 }
1937 }
1938
1939 unsafe impl<D: fidl::encoding::ResourceDialect>
1940 fidl::encoding::Encode<StreamWatchResolutionResponse, D>
1941 for &StreamWatchResolutionResponse
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 fidl::encoding::Encode::<StreamWatchResolutionResponse, D>::encode(
1953 (<fidl_fuchsia_math_common::Size as fidl::encoding::ValueTypeMarker>::borrow(
1954 &self.coded_size,
1955 ),),
1956 encoder,
1957 offset,
1958 _depth,
1959 )
1960 }
1961 }
1962 unsafe impl<
1963 D: fidl::encoding::ResourceDialect,
1964 T0: fidl::encoding::Encode<fidl_fuchsia_math_common::Size, D>,
1965 > fidl::encoding::Encode<StreamWatchResolutionResponse, D> for (T0,)
1966 {
1967 #[inline]
1968 unsafe fn encode(
1969 self,
1970 encoder: &mut fidl::encoding::Encoder<'_, D>,
1971 offset: usize,
1972 depth: fidl::encoding::Depth,
1973 ) -> fidl::Result<()> {
1974 encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1975 self.0.encode(encoder, offset + 0, depth)?;
1979 Ok(())
1980 }
1981 }
1982
1983 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1984 for StreamWatchResolutionResponse
1985 {
1986 #[inline(always)]
1987 fn new_empty() -> Self {
1988 Self { coded_size: fidl::new_empty!(fidl_fuchsia_math_common::Size, D) }
1989 }
1990
1991 #[inline]
1992 unsafe fn decode(
1993 &mut self,
1994 decoder: &mut fidl::encoding::Decoder<'_, D>,
1995 offset: usize,
1996 _depth: fidl::encoding::Depth,
1997 ) -> fidl::Result<()> {
1998 decoder.debug_check_bounds::<Self>(offset);
1999 fidl::decode!(
2001 fidl_fuchsia_math_common::Size,
2002 D,
2003 &mut self.coded_size,
2004 decoder,
2005 offset + 0,
2006 _depth
2007 )?;
2008 Ok(())
2009 }
2010 }
2011
2012 impl Configuration2 {
2013 #[inline(always)]
2014 fn max_ordinal_present(&self) -> u64 {
2015 if let Some(_) = self.streams {
2016 return 1;
2017 }
2018 0
2019 }
2020 }
2021
2022 impl fidl::encoding::ValueTypeMarker for Configuration2 {
2023 type Borrowed<'a> = &'a Self;
2024 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2025 value
2026 }
2027 }
2028
2029 unsafe impl fidl::encoding::TypeMarker for Configuration2 {
2030 type Owned = Self;
2031
2032 #[inline(always)]
2033 fn inline_align(_context: fidl::encoding::Context) -> usize {
2034 8
2035 }
2036
2037 #[inline(always)]
2038 fn inline_size(_context: fidl::encoding::Context) -> usize {
2039 16
2040 }
2041 }
2042
2043 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Configuration2, D>
2044 for &Configuration2
2045 {
2046 unsafe fn encode(
2047 self,
2048 encoder: &mut fidl::encoding::Encoder<'_, D>,
2049 offset: usize,
2050 mut depth: fidl::encoding::Depth,
2051 ) -> fidl::Result<()> {
2052 encoder.debug_check_bounds::<Configuration2>(offset);
2053 let max_ordinal: u64 = self.max_ordinal_present();
2055 encoder.write_num(max_ordinal, offset);
2056 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2057 if max_ordinal == 0 {
2059 return Ok(());
2060 }
2061 depth.increment()?;
2062 let envelope_size = 8;
2063 let bytes_len = max_ordinal as usize * envelope_size;
2064 #[allow(unused_variables)]
2065 let offset = encoder.out_of_line_offset(bytes_len);
2066 let mut _prev_end_offset: usize = 0;
2067 if 1 > max_ordinal {
2068 return Ok(());
2069 }
2070
2071 let cur_offset: usize = (1 - 1) * envelope_size;
2074
2075 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2077
2078 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<StreamProperties2, 256>, D>(
2083 self.streams.as_ref().map(<fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2084 encoder, offset + cur_offset, depth
2085 )?;
2086
2087 _prev_end_offset = cur_offset + envelope_size;
2088
2089 Ok(())
2090 }
2091 }
2092
2093 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration2 {
2094 #[inline(always)]
2095 fn new_empty() -> Self {
2096 Self::default()
2097 }
2098
2099 unsafe fn decode(
2100 &mut self,
2101 decoder: &mut fidl::encoding::Decoder<'_, D>,
2102 offset: usize,
2103 mut depth: fidl::encoding::Depth,
2104 ) -> fidl::Result<()> {
2105 decoder.debug_check_bounds::<Self>(offset);
2106 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2107 None => return Err(fidl::Error::NotNullable),
2108 Some(len) => len,
2109 };
2110 if len == 0 {
2112 return Ok(());
2113 };
2114 depth.increment()?;
2115 let envelope_size = 8;
2116 let bytes_len = len * envelope_size;
2117 let offset = decoder.out_of_line_offset(bytes_len)?;
2118 let mut _next_ordinal_to_read = 0;
2120 let mut next_offset = offset;
2121 let end_offset = offset + bytes_len;
2122 _next_ordinal_to_read += 1;
2123 if next_offset >= end_offset {
2124 return Ok(());
2125 }
2126
2127 while _next_ordinal_to_read < 1 {
2129 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2130 _next_ordinal_to_read += 1;
2131 next_offset += envelope_size;
2132 }
2133
2134 let next_out_of_line = decoder.next_out_of_line();
2135 let handles_before = decoder.remaining_handles();
2136 if let Some((inlined, num_bytes, num_handles)) =
2137 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2138 {
2139 let member_inline_size = <fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2140 if inlined != (member_inline_size <= 4) {
2141 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2142 }
2143 let inner_offset;
2144 let mut inner_depth = depth.clone();
2145 if inlined {
2146 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2147 inner_offset = next_offset;
2148 } else {
2149 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2150 inner_depth.increment()?;
2151 }
2152 let val_ref = self.streams.get_or_insert_with(
2153 || fidl::new_empty!(fidl::encoding::Vector<StreamProperties2, 256>, D),
2154 );
2155 fidl::decode!(fidl::encoding::Vector<StreamProperties2, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2156 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2157 {
2158 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2159 }
2160 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2161 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2162 }
2163 }
2164
2165 next_offset += envelope_size;
2166
2167 while next_offset < end_offset {
2169 _next_ordinal_to_read += 1;
2170 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2171 next_offset += envelope_size;
2172 }
2173
2174 Ok(())
2175 }
2176 }
2177
2178 impl StreamProperties2 {
2179 #[inline(always)]
2180 fn max_ordinal_present(&self) -> u64 {
2181 if let Some(_) = self.supported_resolutions {
2182 return 4;
2183 }
2184 if let Some(_) = self.supports_crop_region {
2185 return 3;
2186 }
2187 if let Some(_) = self.frame_rate {
2188 return 2;
2189 }
2190 if let Some(_) = self.image_format {
2191 return 1;
2192 }
2193 0
2194 }
2195 }
2196
2197 impl fidl::encoding::ValueTypeMarker for StreamProperties2 {
2198 type Borrowed<'a> = &'a Self;
2199 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2200 value
2201 }
2202 }
2203
2204 unsafe impl fidl::encoding::TypeMarker for StreamProperties2 {
2205 type Owned = Self;
2206
2207 #[inline(always)]
2208 fn inline_align(_context: fidl::encoding::Context) -> usize {
2209 8
2210 }
2211
2212 #[inline(always)]
2213 fn inline_size(_context: fidl::encoding::Context) -> usize {
2214 16
2215 }
2216 }
2217
2218 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties2, D>
2219 for &StreamProperties2
2220 {
2221 unsafe fn encode(
2222 self,
2223 encoder: &mut fidl::encoding::Encoder<'_, D>,
2224 offset: usize,
2225 mut depth: fidl::encoding::Depth,
2226 ) -> fidl::Result<()> {
2227 encoder.debug_check_bounds::<StreamProperties2>(offset);
2228 let max_ordinal: u64 = self.max_ordinal_present();
2230 encoder.write_num(max_ordinal, offset);
2231 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2232 if max_ordinal == 0 {
2234 return Ok(());
2235 }
2236 depth.increment()?;
2237 let envelope_size = 8;
2238 let bytes_len = max_ordinal as usize * envelope_size;
2239 #[allow(unused_variables)]
2240 let offset = encoder.out_of_line_offset(bytes_len);
2241 let mut _prev_end_offset: usize = 0;
2242 if 1 > max_ordinal {
2243 return Ok(());
2244 }
2245
2246 let cur_offset: usize = (1 - 1) * envelope_size;
2249
2250 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2252
2253 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_sysmem_common::ImageFormat2, D>(
2258 self.image_format.as_ref().map(<fidl_fuchsia_sysmem_common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow),
2259 encoder, offset + cur_offset, depth
2260 )?;
2261
2262 _prev_end_offset = cur_offset + envelope_size;
2263 if 2 > max_ordinal {
2264 return Ok(());
2265 }
2266
2267 let cur_offset: usize = (2 - 1) * envelope_size;
2270
2271 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2273
2274 fidl::encoding::encode_in_envelope_optional::<FrameRate, D>(
2279 self.frame_rate
2280 .as_ref()
2281 .map(<FrameRate as fidl::encoding::ValueTypeMarker>::borrow),
2282 encoder,
2283 offset + cur_offset,
2284 depth,
2285 )?;
2286
2287 _prev_end_offset = cur_offset + envelope_size;
2288 if 3 > max_ordinal {
2289 return Ok(());
2290 }
2291
2292 let cur_offset: usize = (3 - 1) * envelope_size;
2295
2296 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2298
2299 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2304 self.supports_crop_region
2305 .as_ref()
2306 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2307 encoder,
2308 offset + cur_offset,
2309 depth,
2310 )?;
2311
2312 _prev_end_offset = cur_offset + envelope_size;
2313 if 4 > max_ordinal {
2314 return Ok(());
2315 }
2316
2317 let cur_offset: usize = (4 - 1) * envelope_size;
2320
2321 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2323
2324 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math_common::Size, 256>, D>(
2329 self.supported_resolutions.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math_common::Size, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2330 encoder, offset + cur_offset, depth
2331 )?;
2332
2333 _prev_end_offset = cur_offset + envelope_size;
2334
2335 Ok(())
2336 }
2337 }
2338
2339 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties2 {
2340 #[inline(always)]
2341 fn new_empty() -> Self {
2342 Self::default()
2343 }
2344
2345 unsafe fn decode(
2346 &mut self,
2347 decoder: &mut fidl::encoding::Decoder<'_, D>,
2348 offset: usize,
2349 mut depth: fidl::encoding::Depth,
2350 ) -> fidl::Result<()> {
2351 decoder.debug_check_bounds::<Self>(offset);
2352 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2353 None => return Err(fidl::Error::NotNullable),
2354 Some(len) => len,
2355 };
2356 if len == 0 {
2358 return Ok(());
2359 };
2360 depth.increment()?;
2361 let envelope_size = 8;
2362 let bytes_len = len * envelope_size;
2363 let offset = decoder.out_of_line_offset(bytes_len)?;
2364 let mut _next_ordinal_to_read = 0;
2366 let mut next_offset = offset;
2367 let end_offset = offset + bytes_len;
2368 _next_ordinal_to_read += 1;
2369 if next_offset >= end_offset {
2370 return Ok(());
2371 }
2372
2373 while _next_ordinal_to_read < 1 {
2375 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2376 _next_ordinal_to_read += 1;
2377 next_offset += envelope_size;
2378 }
2379
2380 let next_out_of_line = decoder.next_out_of_line();
2381 let handles_before = decoder.remaining_handles();
2382 if let Some((inlined, num_bytes, num_handles)) =
2383 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2384 {
2385 let member_inline_size = <fidl_fuchsia_sysmem_common::ImageFormat2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2386 if inlined != (member_inline_size <= 4) {
2387 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2388 }
2389 let inner_offset;
2390 let mut inner_depth = depth.clone();
2391 if inlined {
2392 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2393 inner_offset = next_offset;
2394 } else {
2395 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2396 inner_depth.increment()?;
2397 }
2398 let val_ref = self.image_format.get_or_insert_with(|| {
2399 fidl::new_empty!(fidl_fuchsia_sysmem_common::ImageFormat2, D)
2400 });
2401 fidl::decode!(
2402 fidl_fuchsia_sysmem_common::ImageFormat2,
2403 D,
2404 val_ref,
2405 decoder,
2406 inner_offset,
2407 inner_depth
2408 )?;
2409 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2410 {
2411 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2412 }
2413 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2414 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2415 }
2416 }
2417
2418 next_offset += envelope_size;
2419 _next_ordinal_to_read += 1;
2420 if next_offset >= end_offset {
2421 return Ok(());
2422 }
2423
2424 while _next_ordinal_to_read < 2 {
2426 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2427 _next_ordinal_to_read += 1;
2428 next_offset += envelope_size;
2429 }
2430
2431 let next_out_of_line = decoder.next_out_of_line();
2432 let handles_before = decoder.remaining_handles();
2433 if let Some((inlined, num_bytes, num_handles)) =
2434 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2435 {
2436 let member_inline_size =
2437 <FrameRate as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2438 if inlined != (member_inline_size <= 4) {
2439 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2440 }
2441 let inner_offset;
2442 let mut inner_depth = depth.clone();
2443 if inlined {
2444 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2445 inner_offset = next_offset;
2446 } else {
2447 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2448 inner_depth.increment()?;
2449 }
2450 let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(FrameRate, D));
2451 fidl::decode!(FrameRate, D, val_ref, decoder, inner_offset, inner_depth)?;
2452 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2453 {
2454 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2455 }
2456 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2457 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2458 }
2459 }
2460
2461 next_offset += envelope_size;
2462 _next_ordinal_to_read += 1;
2463 if next_offset >= end_offset {
2464 return Ok(());
2465 }
2466
2467 while _next_ordinal_to_read < 3 {
2469 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2470 _next_ordinal_to_read += 1;
2471 next_offset += envelope_size;
2472 }
2473
2474 let next_out_of_line = decoder.next_out_of_line();
2475 let handles_before = decoder.remaining_handles();
2476 if let Some((inlined, num_bytes, num_handles)) =
2477 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2478 {
2479 let member_inline_size =
2480 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2481 if inlined != (member_inline_size <= 4) {
2482 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2483 }
2484 let inner_offset;
2485 let mut inner_depth = depth.clone();
2486 if inlined {
2487 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2488 inner_offset = next_offset;
2489 } else {
2490 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2491 inner_depth.increment()?;
2492 }
2493 let val_ref =
2494 self.supports_crop_region.get_or_insert_with(|| fidl::new_empty!(bool, D));
2495 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2496 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2497 {
2498 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2499 }
2500 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2501 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2502 }
2503 }
2504
2505 next_offset += envelope_size;
2506 _next_ordinal_to_read += 1;
2507 if next_offset >= end_offset {
2508 return Ok(());
2509 }
2510
2511 while _next_ordinal_to_read < 4 {
2513 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2514 _next_ordinal_to_read += 1;
2515 next_offset += envelope_size;
2516 }
2517
2518 let next_out_of_line = decoder.next_out_of_line();
2519 let handles_before = decoder.remaining_handles();
2520 if let Some((inlined, num_bytes, num_handles)) =
2521 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2522 {
2523 let member_inline_size = <fidl::encoding::Vector<
2524 fidl_fuchsia_math_common::Size,
2525 256,
2526 > as fidl::encoding::TypeMarker>::inline_size(
2527 decoder.context
2528 );
2529 if inlined != (member_inline_size <= 4) {
2530 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2531 }
2532 let inner_offset;
2533 let mut inner_depth = depth.clone();
2534 if inlined {
2535 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2536 inner_offset = next_offset;
2537 } else {
2538 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2539 inner_depth.increment()?;
2540 }
2541 let val_ref =
2542 self.supported_resolutions.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math_common::Size, 256>, D));
2543 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math_common::Size, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2544 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2545 {
2546 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2547 }
2548 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2549 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2550 }
2551 }
2552
2553 next_offset += envelope_size;
2554
2555 while next_offset < end_offset {
2557 _next_ordinal_to_read += 1;
2558 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2559 next_offset += envelope_size;
2560 }
2561
2562 Ok(())
2563 }
2564 }
2565
2566 impl fidl::encoding::ValueTypeMarker for WatchDevicesEvent {
2567 type Borrowed<'a> = &'a Self;
2568 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2569 value
2570 }
2571 }
2572
2573 unsafe impl fidl::encoding::TypeMarker for WatchDevicesEvent {
2574 type Owned = Self;
2575
2576 #[inline(always)]
2577 fn inline_align(_context: fidl::encoding::Context) -> usize {
2578 8
2579 }
2580
2581 #[inline(always)]
2582 fn inline_size(_context: fidl::encoding::Context) -> usize {
2583 16
2584 }
2585 }
2586
2587 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchDevicesEvent, D>
2588 for &WatchDevicesEvent
2589 {
2590 #[inline]
2591 unsafe fn encode(
2592 self,
2593 encoder: &mut fidl::encoding::Encoder<'_, D>,
2594 offset: usize,
2595 _depth: fidl::encoding::Depth,
2596 ) -> fidl::Result<()> {
2597 encoder.debug_check_bounds::<WatchDevicesEvent>(offset);
2598 encoder.write_num::<u64>(self.ordinal(), offset);
2599 match self {
2600 WatchDevicesEvent::Existing(ref val) => {
2601 fidl::encoding::encode_in_envelope::<u64, D>(
2602 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2603 encoder,
2604 offset + 8,
2605 _depth,
2606 )
2607 }
2608 WatchDevicesEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
2609 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2610 encoder,
2611 offset + 8,
2612 _depth,
2613 ),
2614 WatchDevicesEvent::Removed(ref val) => {
2615 fidl::encoding::encode_in_envelope::<u64, D>(
2616 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2617 encoder,
2618 offset + 8,
2619 _depth,
2620 )
2621 }
2622 }
2623 }
2624 }
2625
2626 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchDevicesEvent {
2627 #[inline(always)]
2628 fn new_empty() -> Self {
2629 Self::Existing(fidl::new_empty!(u64, D))
2630 }
2631
2632 #[inline]
2633 unsafe fn decode(
2634 &mut self,
2635 decoder: &mut fidl::encoding::Decoder<'_, D>,
2636 offset: usize,
2637 mut depth: fidl::encoding::Depth,
2638 ) -> fidl::Result<()> {
2639 decoder.debug_check_bounds::<Self>(offset);
2640 #[allow(unused_variables)]
2641 let next_out_of_line = decoder.next_out_of_line();
2642 let handles_before = decoder.remaining_handles();
2643 let (ordinal, inlined, num_bytes, num_handles) =
2644 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2645
2646 let member_inline_size = match ordinal {
2647 1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2648 2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2649 3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2650 _ => return Err(fidl::Error::UnknownUnionTag),
2651 };
2652
2653 if inlined != (member_inline_size <= 4) {
2654 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2655 }
2656 let _inner_offset;
2657 if inlined {
2658 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2659 _inner_offset = offset + 8;
2660 } else {
2661 depth.increment()?;
2662 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2663 }
2664 match ordinal {
2665 1 => {
2666 #[allow(irrefutable_let_patterns)]
2667 if let WatchDevicesEvent::Existing(_) = self {
2668 } else {
2670 *self = WatchDevicesEvent::Existing(fidl::new_empty!(u64, D));
2672 }
2673 #[allow(irrefutable_let_patterns)]
2674 if let WatchDevicesEvent::Existing(ref mut val) = self {
2675 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2676 } else {
2677 unreachable!()
2678 }
2679 }
2680 2 => {
2681 #[allow(irrefutable_let_patterns)]
2682 if let WatchDevicesEvent::Added(_) = self {
2683 } else {
2685 *self = WatchDevicesEvent::Added(fidl::new_empty!(u64, D));
2687 }
2688 #[allow(irrefutable_let_patterns)]
2689 if let WatchDevicesEvent::Added(ref mut val) = self {
2690 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2691 } else {
2692 unreachable!()
2693 }
2694 }
2695 3 => {
2696 #[allow(irrefutable_let_patterns)]
2697 if let WatchDevicesEvent::Removed(_) = self {
2698 } else {
2700 *self = WatchDevicesEvent::Removed(fidl::new_empty!(u64, D));
2702 }
2703 #[allow(irrefutable_let_patterns)]
2704 if let WatchDevicesEvent::Removed(ref mut val) = self {
2705 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2706 } else {
2707 unreachable!()
2708 }
2709 }
2710 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2711 }
2712 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2713 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2714 }
2715 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2716 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2717 }
2718 Ok(())
2719 }
2720 }
2721}