fidl_fuchsia_netemul_sync__common/
fidl_fuchsia_netemul_sync__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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
11#[derive(Clone, Debug, PartialEq)]
12pub struct BusEnsurePublishRequest {
13    pub data: Event,
14}
15
16impl fidl::Persistable for BusEnsurePublishRequest {}
17
18#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub struct BusGetClientsResponse {
20    pub clients: Vec<String>,
21}
22
23impl fidl::Persistable for BusGetClientsResponse {}
24
25#[derive(Clone, Debug, PartialEq)]
26pub struct BusOnBusDataRequest {
27    pub data: Event,
28}
29
30impl fidl::Persistable for BusOnBusDataRequest {}
31
32#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct BusOnClientAttachedRequest {
34    pub client: String,
35}
36
37impl fidl::Persistable for BusOnClientAttachedRequest {}
38
39#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct BusOnClientDetachedRequest {
41    pub client: String,
42}
43
44impl fidl::Persistable for BusOnClientDetachedRequest {}
45
46#[derive(Clone, Debug, PartialEq)]
47pub struct BusPublishRequest {
48    pub data: Event,
49}
50
51impl fidl::Persistable for BusPublishRequest {}
52
53#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct BusWaitForClientsRequest {
55    pub clients: Vec<String>,
56    pub timeout: i64,
57}
58
59impl fidl::Persistable for BusWaitForClientsRequest {}
60
61#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
62pub struct BusWaitForClientsResponse {
63    pub result: bool,
64    pub absent: Option<Vec<String>>,
65}
66
67impl fidl::Persistable for BusWaitForClientsResponse {}
68
69#[derive(Clone, Debug, PartialEq)]
70pub struct BusWaitForEventRequest {
71    pub data: Event,
72    pub timeout: i64,
73}
74
75impl fidl::Persistable for BusWaitForEventRequest {}
76
77#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct BusWaitForEventResponse {
79    pub result: bool,
80}
81
82impl fidl::Persistable for BusWaitForEventResponse {}
83
84#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct SyncManagerWaitForBarrierThresholdRequest {
86    pub barrier_name: String,
87    pub threshold: u32,
88    pub timeout: i64,
89}
90
91impl fidl::Persistable for SyncManagerWaitForBarrierThresholdRequest {}
92
93#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94pub struct SyncManagerWaitForBarrierThresholdResponse {
95    pub result: bool,
96}
97
98impl fidl::Persistable for SyncManagerWaitForBarrierThresholdResponse {}
99
100/// Simple data structure passed on netemul bus.
101#[derive(Clone, Debug, Default, PartialEq)]
102pub struct Event {
103    /// User-defined event code.
104    pub code: Option<i32>,
105    /// string:MAX message.
106    pub message: Option<String>,
107    /// serialized arguments.
108    pub arguments: Option<Vec<u8>>,
109    #[doc(hidden)]
110    pub __source_breaking: fidl::marker::SourceBreaking,
111}
112
113impl fidl::Persistable for Event {}
114
115pub mod bus_ordinals {
116    pub const PUBLISH: u64 = 0x331ceb644024c14b;
117    pub const ENSURE_PUBLISH: u64 = 0x2969c5f5de5bb64;
118    pub const ON_BUS_DATA: u64 = 0x26e9b9ffb43f638f;
119    pub const GET_CLIENTS: u64 = 0x733c5e2d525a006b;
120    pub const ON_CLIENT_ATTACHED: u64 = 0x41af94df60bf8ba7;
121    pub const ON_CLIENT_DETACHED: u64 = 0x31a36387f8ab00d8;
122    pub const WAIT_FOR_CLIENTS: u64 = 0x21c89fc6be990b23;
123    pub const WAIT_FOR_EVENT_: u64 = 0x600ca084a42ee5bf;
124}
125
126pub mod sync_manager_ordinals {
127    pub const BUS_SUBSCRIBE: u64 = 0x39c25d810b5e7407;
128    pub const WAIT_FOR_BARRIER_THRESHOLD: u64 = 0x592056b5825f4292;
129}
130
131mod internal {
132    use super::*;
133
134    impl fidl::encoding::ValueTypeMarker for BusEnsurePublishRequest {
135        type Borrowed<'a> = &'a Self;
136        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
137            value
138        }
139    }
140
141    unsafe impl fidl::encoding::TypeMarker for BusEnsurePublishRequest {
142        type Owned = Self;
143
144        #[inline(always)]
145        fn inline_align(_context: fidl::encoding::Context) -> usize {
146            8
147        }
148
149        #[inline(always)]
150        fn inline_size(_context: fidl::encoding::Context) -> usize {
151            16
152        }
153    }
154
155    unsafe impl<D: fidl::encoding::ResourceDialect>
156        fidl::encoding::Encode<BusEnsurePublishRequest, D> for &BusEnsurePublishRequest
157    {
158        #[inline]
159        unsafe fn encode(
160            self,
161            encoder: &mut fidl::encoding::Encoder<'_, D>,
162            offset: usize,
163            _depth: fidl::encoding::Depth,
164        ) -> fidl::Result<()> {
165            encoder.debug_check_bounds::<BusEnsurePublishRequest>(offset);
166            // Delegate to tuple encoding.
167            fidl::encoding::Encode::<BusEnsurePublishRequest, D>::encode(
168                (<Event as fidl::encoding::ValueTypeMarker>::borrow(&self.data),),
169                encoder,
170                offset,
171                _depth,
172            )
173        }
174    }
175    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Event, D>>
176        fidl::encoding::Encode<BusEnsurePublishRequest, D> for (T0,)
177    {
178        #[inline]
179        unsafe fn encode(
180            self,
181            encoder: &mut fidl::encoding::Encoder<'_, D>,
182            offset: usize,
183            depth: fidl::encoding::Depth,
184        ) -> fidl::Result<()> {
185            encoder.debug_check_bounds::<BusEnsurePublishRequest>(offset);
186            // Zero out padding regions. There's no need to apply masks
187            // because the unmasked parts will be overwritten by fields.
188            // Write the fields.
189            self.0.encode(encoder, offset + 0, depth)?;
190            Ok(())
191        }
192    }
193
194    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
195        for BusEnsurePublishRequest
196    {
197        #[inline(always)]
198        fn new_empty() -> Self {
199            Self { data: fidl::new_empty!(Event, D) }
200        }
201
202        #[inline]
203        unsafe fn decode(
204            &mut self,
205            decoder: &mut fidl::encoding::Decoder<'_, D>,
206            offset: usize,
207            _depth: fidl::encoding::Depth,
208        ) -> fidl::Result<()> {
209            decoder.debug_check_bounds::<Self>(offset);
210            // Verify that padding bytes are zero.
211            fidl::decode!(Event, D, &mut self.data, decoder, offset + 0, _depth)?;
212            Ok(())
213        }
214    }
215
216    impl fidl::encoding::ValueTypeMarker for BusGetClientsResponse {
217        type Borrowed<'a> = &'a Self;
218        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
219            value
220        }
221    }
222
223    unsafe impl fidl::encoding::TypeMarker for BusGetClientsResponse {
224        type Owned = Self;
225
226        #[inline(always)]
227        fn inline_align(_context: fidl::encoding::Context) -> usize {
228            8
229        }
230
231        #[inline(always)]
232        fn inline_size(_context: fidl::encoding::Context) -> usize {
233            16
234        }
235    }
236
237    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusGetClientsResponse, D>
238        for &BusGetClientsResponse
239    {
240        #[inline]
241        unsafe fn encode(
242            self,
243            encoder: &mut fidl::encoding::Encoder<'_, D>,
244            offset: usize,
245            _depth: fidl::encoding::Depth,
246        ) -> fidl::Result<()> {
247            encoder.debug_check_bounds::<BusGetClientsResponse>(offset);
248            // Delegate to tuple encoding.
249            fidl::encoding::Encode::<BusGetClientsResponse, D>::encode(
250                (
251                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.clients),
252                ),
253                encoder, offset, _depth
254            )
255        }
256    }
257    unsafe impl<
258            D: fidl::encoding::ResourceDialect,
259            T0: fidl::encoding::Encode<
260                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
261                D,
262            >,
263        > fidl::encoding::Encode<BusGetClientsResponse, D> for (T0,)
264    {
265        #[inline]
266        unsafe fn encode(
267            self,
268            encoder: &mut fidl::encoding::Encoder<'_, D>,
269            offset: usize,
270            depth: fidl::encoding::Depth,
271        ) -> fidl::Result<()> {
272            encoder.debug_check_bounds::<BusGetClientsResponse>(offset);
273            // Zero out padding regions. There's no need to apply masks
274            // because the unmasked parts will be overwritten by fields.
275            // Write the fields.
276            self.0.encode(encoder, offset + 0, depth)?;
277            Ok(())
278        }
279    }
280
281    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusGetClientsResponse {
282        #[inline(always)]
283        fn new_empty() -> Self {
284            Self {
285                clients: fidl::new_empty!(
286                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
287                    D
288                ),
289            }
290        }
291
292        #[inline]
293        unsafe fn decode(
294            &mut self,
295            decoder: &mut fidl::encoding::Decoder<'_, D>,
296            offset: usize,
297            _depth: fidl::encoding::Depth,
298        ) -> fidl::Result<()> {
299            decoder.debug_check_bounds::<Self>(offset);
300            // Verify that padding bytes are zero.
301            fidl::decode!(
302                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
303                D,
304                &mut self.clients,
305                decoder,
306                offset + 0,
307                _depth
308            )?;
309            Ok(())
310        }
311    }
312
313    impl fidl::encoding::ValueTypeMarker for BusOnBusDataRequest {
314        type Borrowed<'a> = &'a Self;
315        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
316            value
317        }
318    }
319
320    unsafe impl fidl::encoding::TypeMarker for BusOnBusDataRequest {
321        type Owned = Self;
322
323        #[inline(always)]
324        fn inline_align(_context: fidl::encoding::Context) -> usize {
325            8
326        }
327
328        #[inline(always)]
329        fn inline_size(_context: fidl::encoding::Context) -> usize {
330            16
331        }
332    }
333
334    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusOnBusDataRequest, D>
335        for &BusOnBusDataRequest
336    {
337        #[inline]
338        unsafe fn encode(
339            self,
340            encoder: &mut fidl::encoding::Encoder<'_, D>,
341            offset: usize,
342            _depth: fidl::encoding::Depth,
343        ) -> fidl::Result<()> {
344            encoder.debug_check_bounds::<BusOnBusDataRequest>(offset);
345            // Delegate to tuple encoding.
346            fidl::encoding::Encode::<BusOnBusDataRequest, D>::encode(
347                (<Event as fidl::encoding::ValueTypeMarker>::borrow(&self.data),),
348                encoder,
349                offset,
350                _depth,
351            )
352        }
353    }
354    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Event, D>>
355        fidl::encoding::Encode<BusOnBusDataRequest, D> for (T0,)
356    {
357        #[inline]
358        unsafe fn encode(
359            self,
360            encoder: &mut fidl::encoding::Encoder<'_, D>,
361            offset: usize,
362            depth: fidl::encoding::Depth,
363        ) -> fidl::Result<()> {
364            encoder.debug_check_bounds::<BusOnBusDataRequest>(offset);
365            // Zero out padding regions. There's no need to apply masks
366            // because the unmasked parts will be overwritten by fields.
367            // Write the fields.
368            self.0.encode(encoder, offset + 0, depth)?;
369            Ok(())
370        }
371    }
372
373    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusOnBusDataRequest {
374        #[inline(always)]
375        fn new_empty() -> Self {
376            Self { data: fidl::new_empty!(Event, D) }
377        }
378
379        #[inline]
380        unsafe fn decode(
381            &mut self,
382            decoder: &mut fidl::encoding::Decoder<'_, D>,
383            offset: usize,
384            _depth: fidl::encoding::Depth,
385        ) -> fidl::Result<()> {
386            decoder.debug_check_bounds::<Self>(offset);
387            // Verify that padding bytes are zero.
388            fidl::decode!(Event, D, &mut self.data, decoder, offset + 0, _depth)?;
389            Ok(())
390        }
391    }
392
393    impl fidl::encoding::ValueTypeMarker for BusOnClientAttachedRequest {
394        type Borrowed<'a> = &'a Self;
395        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
396            value
397        }
398    }
399
400    unsafe impl fidl::encoding::TypeMarker for BusOnClientAttachedRequest {
401        type Owned = Self;
402
403        #[inline(always)]
404        fn inline_align(_context: fidl::encoding::Context) -> usize {
405            8
406        }
407
408        #[inline(always)]
409        fn inline_size(_context: fidl::encoding::Context) -> usize {
410            16
411        }
412    }
413
414    unsafe impl<D: fidl::encoding::ResourceDialect>
415        fidl::encoding::Encode<BusOnClientAttachedRequest, D> for &BusOnClientAttachedRequest
416    {
417        #[inline]
418        unsafe fn encode(
419            self,
420            encoder: &mut fidl::encoding::Encoder<'_, D>,
421            offset: usize,
422            _depth: fidl::encoding::Depth,
423        ) -> fidl::Result<()> {
424            encoder.debug_check_bounds::<BusOnClientAttachedRequest>(offset);
425            // Delegate to tuple encoding.
426            fidl::encoding::Encode::<BusOnClientAttachedRequest, D>::encode(
427                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
428                    &self.client,
429                ),),
430                encoder,
431                offset,
432                _depth,
433            )
434        }
435    }
436    unsafe impl<
437            D: fidl::encoding::ResourceDialect,
438            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
439        > fidl::encoding::Encode<BusOnClientAttachedRequest, D> for (T0,)
440    {
441        #[inline]
442        unsafe fn encode(
443            self,
444            encoder: &mut fidl::encoding::Encoder<'_, D>,
445            offset: usize,
446            depth: fidl::encoding::Depth,
447        ) -> fidl::Result<()> {
448            encoder.debug_check_bounds::<BusOnClientAttachedRequest>(offset);
449            // Zero out padding regions. There's no need to apply masks
450            // because the unmasked parts will be overwritten by fields.
451            // Write the fields.
452            self.0.encode(encoder, offset + 0, depth)?;
453            Ok(())
454        }
455    }
456
457    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
458        for BusOnClientAttachedRequest
459    {
460        #[inline(always)]
461        fn new_empty() -> Self {
462            Self { client: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
463        }
464
465        #[inline]
466        unsafe fn decode(
467            &mut self,
468            decoder: &mut fidl::encoding::Decoder<'_, D>,
469            offset: usize,
470            _depth: fidl::encoding::Depth,
471        ) -> fidl::Result<()> {
472            decoder.debug_check_bounds::<Self>(offset);
473            // Verify that padding bytes are zero.
474            fidl::decode!(
475                fidl::encoding::UnboundedString,
476                D,
477                &mut self.client,
478                decoder,
479                offset + 0,
480                _depth
481            )?;
482            Ok(())
483        }
484    }
485
486    impl fidl::encoding::ValueTypeMarker for BusOnClientDetachedRequest {
487        type Borrowed<'a> = &'a Self;
488        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
489            value
490        }
491    }
492
493    unsafe impl fidl::encoding::TypeMarker for BusOnClientDetachedRequest {
494        type Owned = Self;
495
496        #[inline(always)]
497        fn inline_align(_context: fidl::encoding::Context) -> usize {
498            8
499        }
500
501        #[inline(always)]
502        fn inline_size(_context: fidl::encoding::Context) -> usize {
503            16
504        }
505    }
506
507    unsafe impl<D: fidl::encoding::ResourceDialect>
508        fidl::encoding::Encode<BusOnClientDetachedRequest, D> for &BusOnClientDetachedRequest
509    {
510        #[inline]
511        unsafe fn encode(
512            self,
513            encoder: &mut fidl::encoding::Encoder<'_, D>,
514            offset: usize,
515            _depth: fidl::encoding::Depth,
516        ) -> fidl::Result<()> {
517            encoder.debug_check_bounds::<BusOnClientDetachedRequest>(offset);
518            // Delegate to tuple encoding.
519            fidl::encoding::Encode::<BusOnClientDetachedRequest, D>::encode(
520                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
521                    &self.client,
522                ),),
523                encoder,
524                offset,
525                _depth,
526            )
527        }
528    }
529    unsafe impl<
530            D: fidl::encoding::ResourceDialect,
531            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
532        > fidl::encoding::Encode<BusOnClientDetachedRequest, D> for (T0,)
533    {
534        #[inline]
535        unsafe fn encode(
536            self,
537            encoder: &mut fidl::encoding::Encoder<'_, D>,
538            offset: usize,
539            depth: fidl::encoding::Depth,
540        ) -> fidl::Result<()> {
541            encoder.debug_check_bounds::<BusOnClientDetachedRequest>(offset);
542            // Zero out padding regions. There's no need to apply masks
543            // because the unmasked parts will be overwritten by fields.
544            // Write the fields.
545            self.0.encode(encoder, offset + 0, depth)?;
546            Ok(())
547        }
548    }
549
550    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
551        for BusOnClientDetachedRequest
552    {
553        #[inline(always)]
554        fn new_empty() -> Self {
555            Self { client: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
556        }
557
558        #[inline]
559        unsafe fn decode(
560            &mut self,
561            decoder: &mut fidl::encoding::Decoder<'_, D>,
562            offset: usize,
563            _depth: fidl::encoding::Depth,
564        ) -> fidl::Result<()> {
565            decoder.debug_check_bounds::<Self>(offset);
566            // Verify that padding bytes are zero.
567            fidl::decode!(
568                fidl::encoding::UnboundedString,
569                D,
570                &mut self.client,
571                decoder,
572                offset + 0,
573                _depth
574            )?;
575            Ok(())
576        }
577    }
578
579    impl fidl::encoding::ValueTypeMarker for BusPublishRequest {
580        type Borrowed<'a> = &'a Self;
581        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
582            value
583        }
584    }
585
586    unsafe impl fidl::encoding::TypeMarker for BusPublishRequest {
587        type Owned = Self;
588
589        #[inline(always)]
590        fn inline_align(_context: fidl::encoding::Context) -> usize {
591            8
592        }
593
594        #[inline(always)]
595        fn inline_size(_context: fidl::encoding::Context) -> usize {
596            16
597        }
598    }
599
600    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusPublishRequest, D>
601        for &BusPublishRequest
602    {
603        #[inline]
604        unsafe fn encode(
605            self,
606            encoder: &mut fidl::encoding::Encoder<'_, D>,
607            offset: usize,
608            _depth: fidl::encoding::Depth,
609        ) -> fidl::Result<()> {
610            encoder.debug_check_bounds::<BusPublishRequest>(offset);
611            // Delegate to tuple encoding.
612            fidl::encoding::Encode::<BusPublishRequest, D>::encode(
613                (<Event as fidl::encoding::ValueTypeMarker>::borrow(&self.data),),
614                encoder,
615                offset,
616                _depth,
617            )
618        }
619    }
620    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Event, D>>
621        fidl::encoding::Encode<BusPublishRequest, D> for (T0,)
622    {
623        #[inline]
624        unsafe fn encode(
625            self,
626            encoder: &mut fidl::encoding::Encoder<'_, D>,
627            offset: usize,
628            depth: fidl::encoding::Depth,
629        ) -> fidl::Result<()> {
630            encoder.debug_check_bounds::<BusPublishRequest>(offset);
631            // Zero out padding regions. There's no need to apply masks
632            // because the unmasked parts will be overwritten by fields.
633            // Write the fields.
634            self.0.encode(encoder, offset + 0, depth)?;
635            Ok(())
636        }
637    }
638
639    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusPublishRequest {
640        #[inline(always)]
641        fn new_empty() -> Self {
642            Self { data: fidl::new_empty!(Event, D) }
643        }
644
645        #[inline]
646        unsafe fn decode(
647            &mut self,
648            decoder: &mut fidl::encoding::Decoder<'_, D>,
649            offset: usize,
650            _depth: fidl::encoding::Depth,
651        ) -> fidl::Result<()> {
652            decoder.debug_check_bounds::<Self>(offset);
653            // Verify that padding bytes are zero.
654            fidl::decode!(Event, D, &mut self.data, decoder, offset + 0, _depth)?;
655            Ok(())
656        }
657    }
658
659    impl fidl::encoding::ValueTypeMarker for BusWaitForClientsRequest {
660        type Borrowed<'a> = &'a Self;
661        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
662            value
663        }
664    }
665
666    unsafe impl fidl::encoding::TypeMarker for BusWaitForClientsRequest {
667        type Owned = Self;
668
669        #[inline(always)]
670        fn inline_align(_context: fidl::encoding::Context) -> usize {
671            8
672        }
673
674        #[inline(always)]
675        fn inline_size(_context: fidl::encoding::Context) -> usize {
676            24
677        }
678    }
679
680    unsafe impl<D: fidl::encoding::ResourceDialect>
681        fidl::encoding::Encode<BusWaitForClientsRequest, D> for &BusWaitForClientsRequest
682    {
683        #[inline]
684        unsafe fn encode(
685            self,
686            encoder: &mut fidl::encoding::Encoder<'_, D>,
687            offset: usize,
688            _depth: fidl::encoding::Depth,
689        ) -> fidl::Result<()> {
690            encoder.debug_check_bounds::<BusWaitForClientsRequest>(offset);
691            // Delegate to tuple encoding.
692            fidl::encoding::Encode::<BusWaitForClientsRequest, D>::encode(
693                (
694                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.clients),
695                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
696                ),
697                encoder, offset, _depth
698            )
699        }
700    }
701    unsafe impl<
702            D: fidl::encoding::ResourceDialect,
703            T0: fidl::encoding::Encode<
704                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
705                D,
706            >,
707            T1: fidl::encoding::Encode<i64, D>,
708        > fidl::encoding::Encode<BusWaitForClientsRequest, D> for (T0, T1)
709    {
710        #[inline]
711        unsafe fn encode(
712            self,
713            encoder: &mut fidl::encoding::Encoder<'_, D>,
714            offset: usize,
715            depth: fidl::encoding::Depth,
716        ) -> fidl::Result<()> {
717            encoder.debug_check_bounds::<BusWaitForClientsRequest>(offset);
718            // Zero out padding regions. There's no need to apply masks
719            // because the unmasked parts will be overwritten by fields.
720            // Write the fields.
721            self.0.encode(encoder, offset + 0, depth)?;
722            self.1.encode(encoder, offset + 16, depth)?;
723            Ok(())
724        }
725    }
726
727    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
728        for BusWaitForClientsRequest
729    {
730        #[inline(always)]
731        fn new_empty() -> Self {
732            Self {
733                clients: fidl::new_empty!(
734                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
735                    D
736                ),
737                timeout: fidl::new_empty!(i64, D),
738            }
739        }
740
741        #[inline]
742        unsafe fn decode(
743            &mut self,
744            decoder: &mut fidl::encoding::Decoder<'_, D>,
745            offset: usize,
746            _depth: fidl::encoding::Depth,
747        ) -> fidl::Result<()> {
748            decoder.debug_check_bounds::<Self>(offset);
749            // Verify that padding bytes are zero.
750            fidl::decode!(
751                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
752                D,
753                &mut self.clients,
754                decoder,
755                offset + 0,
756                _depth
757            )?;
758            fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 16, _depth)?;
759            Ok(())
760        }
761    }
762
763    impl fidl::encoding::ValueTypeMarker for BusWaitForClientsResponse {
764        type Borrowed<'a> = &'a Self;
765        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
766            value
767        }
768    }
769
770    unsafe impl fidl::encoding::TypeMarker for BusWaitForClientsResponse {
771        type Owned = Self;
772
773        #[inline(always)]
774        fn inline_align(_context: fidl::encoding::Context) -> usize {
775            8
776        }
777
778        #[inline(always)]
779        fn inline_size(_context: fidl::encoding::Context) -> usize {
780            24
781        }
782    }
783
784    unsafe impl<D: fidl::encoding::ResourceDialect>
785        fidl::encoding::Encode<BusWaitForClientsResponse, D> for &BusWaitForClientsResponse
786    {
787        #[inline]
788        unsafe fn encode(
789            self,
790            encoder: &mut fidl::encoding::Encoder<'_, D>,
791            offset: usize,
792            _depth: fidl::encoding::Depth,
793        ) -> fidl::Result<()> {
794            encoder.debug_check_bounds::<BusWaitForClientsResponse>(offset);
795            // Delegate to tuple encoding.
796            fidl::encoding::Encode::<BusWaitForClientsResponse, D>::encode(
797                (
798                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.result),
799                    <fidl::encoding::Optional<
800                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
801                    > as fidl::encoding::ValueTypeMarker>::borrow(&self.absent),
802                ),
803                encoder,
804                offset,
805                _depth,
806            )
807        }
808    }
809    unsafe impl<
810            D: fidl::encoding::ResourceDialect,
811            T0: fidl::encoding::Encode<bool, D>,
812            T1: fidl::encoding::Encode<
813                fidl::encoding::Optional<
814                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
815                >,
816                D,
817            >,
818        > fidl::encoding::Encode<BusWaitForClientsResponse, D> for (T0, T1)
819    {
820        #[inline]
821        unsafe fn encode(
822            self,
823            encoder: &mut fidl::encoding::Encoder<'_, D>,
824            offset: usize,
825            depth: fidl::encoding::Depth,
826        ) -> fidl::Result<()> {
827            encoder.debug_check_bounds::<BusWaitForClientsResponse>(offset);
828            // Zero out padding regions. There's no need to apply masks
829            // because the unmasked parts will be overwritten by fields.
830            unsafe {
831                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
832                (ptr as *mut u64).write_unaligned(0);
833            }
834            // Write the fields.
835            self.0.encode(encoder, offset + 0, depth)?;
836            self.1.encode(encoder, offset + 8, depth)?;
837            Ok(())
838        }
839    }
840
841    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
842        for BusWaitForClientsResponse
843    {
844        #[inline(always)]
845        fn new_empty() -> Self {
846            Self {
847                result: fidl::new_empty!(bool, D),
848                absent: fidl::new_empty!(
849                    fidl::encoding::Optional<
850                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
851                    >,
852                    D
853                ),
854            }
855        }
856
857        #[inline]
858        unsafe fn decode(
859            &mut self,
860            decoder: &mut fidl::encoding::Decoder<'_, D>,
861            offset: usize,
862            _depth: fidl::encoding::Depth,
863        ) -> fidl::Result<()> {
864            decoder.debug_check_bounds::<Self>(offset);
865            // Verify that padding bytes are zero.
866            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
867            let padval = unsafe { (ptr as *const u64).read_unaligned() };
868            let mask = 0xffffffffffffff00u64;
869            let maskedval = padval & mask;
870            if maskedval != 0 {
871                return Err(fidl::Error::NonZeroPadding {
872                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
873                });
874            }
875            fidl::decode!(bool, D, &mut self.result, decoder, offset + 0, _depth)?;
876            fidl::decode!(
877                fidl::encoding::Optional<
878                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
879                >,
880                D,
881                &mut self.absent,
882                decoder,
883                offset + 8,
884                _depth
885            )?;
886            Ok(())
887        }
888    }
889
890    impl fidl::encoding::ValueTypeMarker for BusWaitForEventRequest {
891        type Borrowed<'a> = &'a Self;
892        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
893            value
894        }
895    }
896
897    unsafe impl fidl::encoding::TypeMarker for BusWaitForEventRequest {
898        type Owned = Self;
899
900        #[inline(always)]
901        fn inline_align(_context: fidl::encoding::Context) -> usize {
902            8
903        }
904
905        #[inline(always)]
906        fn inline_size(_context: fidl::encoding::Context) -> usize {
907            24
908        }
909    }
910
911    unsafe impl<D: fidl::encoding::ResourceDialect>
912        fidl::encoding::Encode<BusWaitForEventRequest, D> for &BusWaitForEventRequest
913    {
914        #[inline]
915        unsafe fn encode(
916            self,
917            encoder: &mut fidl::encoding::Encoder<'_, D>,
918            offset: usize,
919            _depth: fidl::encoding::Depth,
920        ) -> fidl::Result<()> {
921            encoder.debug_check_bounds::<BusWaitForEventRequest>(offset);
922            // Delegate to tuple encoding.
923            fidl::encoding::Encode::<BusWaitForEventRequest, D>::encode(
924                (
925                    <Event as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
926                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
927                ),
928                encoder,
929                offset,
930                _depth,
931            )
932        }
933    }
934    unsafe impl<
935            D: fidl::encoding::ResourceDialect,
936            T0: fidl::encoding::Encode<Event, D>,
937            T1: fidl::encoding::Encode<i64, D>,
938        > fidl::encoding::Encode<BusWaitForEventRequest, D> for (T0, T1)
939    {
940        #[inline]
941        unsafe fn encode(
942            self,
943            encoder: &mut fidl::encoding::Encoder<'_, D>,
944            offset: usize,
945            depth: fidl::encoding::Depth,
946        ) -> fidl::Result<()> {
947            encoder.debug_check_bounds::<BusWaitForEventRequest>(offset);
948            // Zero out padding regions. There's no need to apply masks
949            // because the unmasked parts will be overwritten by fields.
950            // Write the fields.
951            self.0.encode(encoder, offset + 0, depth)?;
952            self.1.encode(encoder, offset + 16, depth)?;
953            Ok(())
954        }
955    }
956
957    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
958        for BusWaitForEventRequest
959    {
960        #[inline(always)]
961        fn new_empty() -> Self {
962            Self { data: fidl::new_empty!(Event, D), timeout: fidl::new_empty!(i64, D) }
963        }
964
965        #[inline]
966        unsafe fn decode(
967            &mut self,
968            decoder: &mut fidl::encoding::Decoder<'_, D>,
969            offset: usize,
970            _depth: fidl::encoding::Depth,
971        ) -> fidl::Result<()> {
972            decoder.debug_check_bounds::<Self>(offset);
973            // Verify that padding bytes are zero.
974            fidl::decode!(Event, D, &mut self.data, decoder, offset + 0, _depth)?;
975            fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 16, _depth)?;
976            Ok(())
977        }
978    }
979
980    impl fidl::encoding::ValueTypeMarker for BusWaitForEventResponse {
981        type Borrowed<'a> = &'a Self;
982        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
983            value
984        }
985    }
986
987    unsafe impl fidl::encoding::TypeMarker for BusWaitForEventResponse {
988        type Owned = Self;
989
990        #[inline(always)]
991        fn inline_align(_context: fidl::encoding::Context) -> usize {
992            1
993        }
994
995        #[inline(always)]
996        fn inline_size(_context: fidl::encoding::Context) -> usize {
997            1
998        }
999    }
1000
1001    unsafe impl<D: fidl::encoding::ResourceDialect>
1002        fidl::encoding::Encode<BusWaitForEventResponse, D> for &BusWaitForEventResponse
1003    {
1004        #[inline]
1005        unsafe fn encode(
1006            self,
1007            encoder: &mut fidl::encoding::Encoder<'_, D>,
1008            offset: usize,
1009            _depth: fidl::encoding::Depth,
1010        ) -> fidl::Result<()> {
1011            encoder.debug_check_bounds::<BusWaitForEventResponse>(offset);
1012            // Delegate to tuple encoding.
1013            fidl::encoding::Encode::<BusWaitForEventResponse, D>::encode(
1014                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
1015                encoder,
1016                offset,
1017                _depth,
1018            )
1019        }
1020    }
1021    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1022        fidl::encoding::Encode<BusWaitForEventResponse, D> for (T0,)
1023    {
1024        #[inline]
1025        unsafe fn encode(
1026            self,
1027            encoder: &mut fidl::encoding::Encoder<'_, D>,
1028            offset: usize,
1029            depth: fidl::encoding::Depth,
1030        ) -> fidl::Result<()> {
1031            encoder.debug_check_bounds::<BusWaitForEventResponse>(offset);
1032            // Zero out padding regions. There's no need to apply masks
1033            // because the unmasked parts will be overwritten by fields.
1034            // Write the fields.
1035            self.0.encode(encoder, offset + 0, depth)?;
1036            Ok(())
1037        }
1038    }
1039
1040    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1041        for BusWaitForEventResponse
1042    {
1043        #[inline(always)]
1044        fn new_empty() -> Self {
1045            Self { result: fidl::new_empty!(bool, D) }
1046        }
1047
1048        #[inline]
1049        unsafe fn decode(
1050            &mut self,
1051            decoder: &mut fidl::encoding::Decoder<'_, D>,
1052            offset: usize,
1053            _depth: fidl::encoding::Depth,
1054        ) -> fidl::Result<()> {
1055            decoder.debug_check_bounds::<Self>(offset);
1056            // Verify that padding bytes are zero.
1057            fidl::decode!(bool, D, &mut self.result, decoder, offset + 0, _depth)?;
1058            Ok(())
1059        }
1060    }
1061
1062    impl fidl::encoding::ValueTypeMarker for SyncManagerWaitForBarrierThresholdRequest {
1063        type Borrowed<'a> = &'a Self;
1064        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1065            value
1066        }
1067    }
1068
1069    unsafe impl fidl::encoding::TypeMarker for SyncManagerWaitForBarrierThresholdRequest {
1070        type Owned = Self;
1071
1072        #[inline(always)]
1073        fn inline_align(_context: fidl::encoding::Context) -> usize {
1074            8
1075        }
1076
1077        #[inline(always)]
1078        fn inline_size(_context: fidl::encoding::Context) -> usize {
1079            32
1080        }
1081    }
1082
1083    unsafe impl<D: fidl::encoding::ResourceDialect>
1084        fidl::encoding::Encode<SyncManagerWaitForBarrierThresholdRequest, D>
1085        for &SyncManagerWaitForBarrierThresholdRequest
1086    {
1087        #[inline]
1088        unsafe fn encode(
1089            self,
1090            encoder: &mut fidl::encoding::Encoder<'_, D>,
1091            offset: usize,
1092            _depth: fidl::encoding::Depth,
1093        ) -> fidl::Result<()> {
1094            encoder.debug_check_bounds::<SyncManagerWaitForBarrierThresholdRequest>(offset);
1095            // Delegate to tuple encoding.
1096            fidl::encoding::Encode::<SyncManagerWaitForBarrierThresholdRequest, D>::encode(
1097                (
1098                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1099                        &self.barrier_name,
1100                    ),
1101                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.threshold),
1102                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
1103                ),
1104                encoder,
1105                offset,
1106                _depth,
1107            )
1108        }
1109    }
1110    unsafe impl<
1111            D: fidl::encoding::ResourceDialect,
1112            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1113            T1: fidl::encoding::Encode<u32, D>,
1114            T2: fidl::encoding::Encode<i64, D>,
1115        > fidl::encoding::Encode<SyncManagerWaitForBarrierThresholdRequest, D> for (T0, T1, T2)
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::<SyncManagerWaitForBarrierThresholdRequest>(offset);
1125            // Zero out padding regions. There's no need to apply masks
1126            // because the unmasked parts will be overwritten by fields.
1127            unsafe {
1128                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1129                (ptr as *mut u64).write_unaligned(0);
1130            }
1131            // Write the fields.
1132            self.0.encode(encoder, offset + 0, depth)?;
1133            self.1.encode(encoder, offset + 16, depth)?;
1134            self.2.encode(encoder, offset + 24, depth)?;
1135            Ok(())
1136        }
1137    }
1138
1139    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1140        for SyncManagerWaitForBarrierThresholdRequest
1141    {
1142        #[inline(always)]
1143        fn new_empty() -> Self {
1144            Self {
1145                barrier_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1146                threshold: fidl::new_empty!(u32, D),
1147                timeout: fidl::new_empty!(i64, D),
1148            }
1149        }
1150
1151        #[inline]
1152        unsafe fn decode(
1153            &mut self,
1154            decoder: &mut fidl::encoding::Decoder<'_, D>,
1155            offset: usize,
1156            _depth: fidl::encoding::Depth,
1157        ) -> fidl::Result<()> {
1158            decoder.debug_check_bounds::<Self>(offset);
1159            // Verify that padding bytes are zero.
1160            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1161            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1162            let mask = 0xffffffff00000000u64;
1163            let maskedval = padval & mask;
1164            if maskedval != 0 {
1165                return Err(fidl::Error::NonZeroPadding {
1166                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1167                });
1168            }
1169            fidl::decode!(
1170                fidl::encoding::UnboundedString,
1171                D,
1172                &mut self.barrier_name,
1173                decoder,
1174                offset + 0,
1175                _depth
1176            )?;
1177            fidl::decode!(u32, D, &mut self.threshold, decoder, offset + 16, _depth)?;
1178            fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 24, _depth)?;
1179            Ok(())
1180        }
1181    }
1182
1183    impl fidl::encoding::ValueTypeMarker for SyncManagerWaitForBarrierThresholdResponse {
1184        type Borrowed<'a> = &'a Self;
1185        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1186            value
1187        }
1188    }
1189
1190    unsafe impl fidl::encoding::TypeMarker for SyncManagerWaitForBarrierThresholdResponse {
1191        type Owned = Self;
1192
1193        #[inline(always)]
1194        fn inline_align(_context: fidl::encoding::Context) -> usize {
1195            1
1196        }
1197
1198        #[inline(always)]
1199        fn inline_size(_context: fidl::encoding::Context) -> usize {
1200            1
1201        }
1202    }
1203
1204    unsafe impl<D: fidl::encoding::ResourceDialect>
1205        fidl::encoding::Encode<SyncManagerWaitForBarrierThresholdResponse, D>
1206        for &SyncManagerWaitForBarrierThresholdResponse
1207    {
1208        #[inline]
1209        unsafe fn encode(
1210            self,
1211            encoder: &mut fidl::encoding::Encoder<'_, D>,
1212            offset: usize,
1213            _depth: fidl::encoding::Depth,
1214        ) -> fidl::Result<()> {
1215            encoder.debug_check_bounds::<SyncManagerWaitForBarrierThresholdResponse>(offset);
1216            // Delegate to tuple encoding.
1217            fidl::encoding::Encode::<SyncManagerWaitForBarrierThresholdResponse, D>::encode(
1218                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
1219                encoder,
1220                offset,
1221                _depth,
1222            )
1223        }
1224    }
1225    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1226        fidl::encoding::Encode<SyncManagerWaitForBarrierThresholdResponse, D> for (T0,)
1227    {
1228        #[inline]
1229        unsafe fn encode(
1230            self,
1231            encoder: &mut fidl::encoding::Encoder<'_, D>,
1232            offset: usize,
1233            depth: fidl::encoding::Depth,
1234        ) -> fidl::Result<()> {
1235            encoder.debug_check_bounds::<SyncManagerWaitForBarrierThresholdResponse>(offset);
1236            // Zero out padding regions. There's no need to apply masks
1237            // because the unmasked parts will be overwritten by fields.
1238            // Write the fields.
1239            self.0.encode(encoder, offset + 0, depth)?;
1240            Ok(())
1241        }
1242    }
1243
1244    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1245        for SyncManagerWaitForBarrierThresholdResponse
1246    {
1247        #[inline(always)]
1248        fn new_empty() -> Self {
1249            Self { result: fidl::new_empty!(bool, D) }
1250        }
1251
1252        #[inline]
1253        unsafe fn decode(
1254            &mut self,
1255            decoder: &mut fidl::encoding::Decoder<'_, D>,
1256            offset: usize,
1257            _depth: fidl::encoding::Depth,
1258        ) -> fidl::Result<()> {
1259            decoder.debug_check_bounds::<Self>(offset);
1260            // Verify that padding bytes are zero.
1261            fidl::decode!(bool, D, &mut self.result, decoder, offset + 0, _depth)?;
1262            Ok(())
1263        }
1264    }
1265
1266    impl Event {
1267        #[inline(always)]
1268        fn max_ordinal_present(&self) -> u64 {
1269            if let Some(_) = self.arguments {
1270                return 3;
1271            }
1272            if let Some(_) = self.message {
1273                return 2;
1274            }
1275            if let Some(_) = self.code {
1276                return 1;
1277            }
1278            0
1279        }
1280    }
1281
1282    impl fidl::encoding::ValueTypeMarker for Event {
1283        type Borrowed<'a> = &'a Self;
1284        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1285            value
1286        }
1287    }
1288
1289    unsafe impl fidl::encoding::TypeMarker for Event {
1290        type Owned = Self;
1291
1292        #[inline(always)]
1293        fn inline_align(_context: fidl::encoding::Context) -> usize {
1294            8
1295        }
1296
1297        #[inline(always)]
1298        fn inline_size(_context: fidl::encoding::Context) -> usize {
1299            16
1300        }
1301    }
1302
1303    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Event, D> for &Event {
1304        unsafe fn encode(
1305            self,
1306            encoder: &mut fidl::encoding::Encoder<'_, D>,
1307            offset: usize,
1308            mut depth: fidl::encoding::Depth,
1309        ) -> fidl::Result<()> {
1310            encoder.debug_check_bounds::<Event>(offset);
1311            // Vector header
1312            let max_ordinal: u64 = self.max_ordinal_present();
1313            encoder.write_num(max_ordinal, offset);
1314            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1315            // Calling encoder.out_of_line_offset(0) is not allowed.
1316            if max_ordinal == 0 {
1317                return Ok(());
1318            }
1319            depth.increment()?;
1320            let envelope_size = 8;
1321            let bytes_len = max_ordinal as usize * envelope_size;
1322            #[allow(unused_variables)]
1323            let offset = encoder.out_of_line_offset(bytes_len);
1324            let mut _prev_end_offset: usize = 0;
1325            if 1 > max_ordinal {
1326                return Ok(());
1327            }
1328
1329            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1330            // are envelope_size bytes.
1331            let cur_offset: usize = (1 - 1) * envelope_size;
1332
1333            // Zero reserved fields.
1334            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1335
1336            // Safety:
1337            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1338            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1339            //   envelope_size bytes, there is always sufficient room.
1340            fidl::encoding::encode_in_envelope_optional::<i32, D>(
1341                self.code.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
1342                encoder,
1343                offset + cur_offset,
1344                depth,
1345            )?;
1346
1347            _prev_end_offset = cur_offset + envelope_size;
1348            if 2 > max_ordinal {
1349                return Ok(());
1350            }
1351
1352            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1353            // are envelope_size bytes.
1354            let cur_offset: usize = (2 - 1) * envelope_size;
1355
1356            // Zero reserved fields.
1357            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1358
1359            // Safety:
1360            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1361            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1362            //   envelope_size bytes, there is always sufficient room.
1363            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
1364                self.message.as_ref().map(
1365                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
1366                ),
1367                encoder,
1368                offset + cur_offset,
1369                depth,
1370            )?;
1371
1372            _prev_end_offset = cur_offset + envelope_size;
1373            if 3 > max_ordinal {
1374                return Ok(());
1375            }
1376
1377            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1378            // are envelope_size bytes.
1379            let cur_offset: usize = (3 - 1) * envelope_size;
1380
1381            // Zero reserved fields.
1382            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1383
1384            // Safety:
1385            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1386            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1387            //   envelope_size bytes, there is always sufficient room.
1388            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
1389            self.arguments.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
1390            encoder, offset + cur_offset, depth
1391        )?;
1392
1393            _prev_end_offset = cur_offset + envelope_size;
1394
1395            Ok(())
1396        }
1397    }
1398
1399    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Event {
1400        #[inline(always)]
1401        fn new_empty() -> Self {
1402            Self::default()
1403        }
1404
1405        unsafe fn decode(
1406            &mut self,
1407            decoder: &mut fidl::encoding::Decoder<'_, D>,
1408            offset: usize,
1409            mut depth: fidl::encoding::Depth,
1410        ) -> fidl::Result<()> {
1411            decoder.debug_check_bounds::<Self>(offset);
1412            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1413                None => return Err(fidl::Error::NotNullable),
1414                Some(len) => len,
1415            };
1416            // Calling decoder.out_of_line_offset(0) is not allowed.
1417            if len == 0 {
1418                return Ok(());
1419            };
1420            depth.increment()?;
1421            let envelope_size = 8;
1422            let bytes_len = len * envelope_size;
1423            let offset = decoder.out_of_line_offset(bytes_len)?;
1424            // Decode the envelope for each type.
1425            let mut _next_ordinal_to_read = 0;
1426            let mut next_offset = offset;
1427            let end_offset = offset + bytes_len;
1428            _next_ordinal_to_read += 1;
1429            if next_offset >= end_offset {
1430                return Ok(());
1431            }
1432
1433            // Decode unknown envelopes for gaps in ordinals.
1434            while _next_ordinal_to_read < 1 {
1435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1436                _next_ordinal_to_read += 1;
1437                next_offset += envelope_size;
1438            }
1439
1440            let next_out_of_line = decoder.next_out_of_line();
1441            let handles_before = decoder.remaining_handles();
1442            if let Some((inlined, num_bytes, num_handles)) =
1443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1444            {
1445                let member_inline_size =
1446                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1447                if inlined != (member_inline_size <= 4) {
1448                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1449                }
1450                let inner_offset;
1451                let mut inner_depth = depth.clone();
1452                if inlined {
1453                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1454                    inner_offset = next_offset;
1455                } else {
1456                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1457                    inner_depth.increment()?;
1458                }
1459                let val_ref = self.code.get_or_insert_with(|| fidl::new_empty!(i32, D));
1460                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
1461                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1462                {
1463                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1464                }
1465                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1466                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1467                }
1468            }
1469
1470            next_offset += envelope_size;
1471            _next_ordinal_to_read += 1;
1472            if next_offset >= end_offset {
1473                return Ok(());
1474            }
1475
1476            // Decode unknown envelopes for gaps in ordinals.
1477            while _next_ordinal_to_read < 2 {
1478                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1479                _next_ordinal_to_read += 1;
1480                next_offset += envelope_size;
1481            }
1482
1483            let next_out_of_line = decoder.next_out_of_line();
1484            let handles_before = decoder.remaining_handles();
1485            if let Some((inlined, num_bytes, num_handles)) =
1486                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1487            {
1488                let member_inline_size =
1489                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1490                        decoder.context,
1491                    );
1492                if inlined != (member_inline_size <= 4) {
1493                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1494                }
1495                let inner_offset;
1496                let mut inner_depth = depth.clone();
1497                if inlined {
1498                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1499                    inner_offset = next_offset;
1500                } else {
1501                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1502                    inner_depth.increment()?;
1503                }
1504                let val_ref = self
1505                    .message
1506                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
1507                fidl::decode!(
1508                    fidl::encoding::UnboundedString,
1509                    D,
1510                    val_ref,
1511                    decoder,
1512                    inner_offset,
1513                    inner_depth
1514                )?;
1515                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1516                {
1517                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1518                }
1519                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1520                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1521                }
1522            }
1523
1524            next_offset += envelope_size;
1525            _next_ordinal_to_read += 1;
1526            if next_offset >= end_offset {
1527                return Ok(());
1528            }
1529
1530            // Decode unknown envelopes for gaps in ordinals.
1531            while _next_ordinal_to_read < 3 {
1532                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1533                _next_ordinal_to_read += 1;
1534                next_offset += envelope_size;
1535            }
1536
1537            let next_out_of_line = decoder.next_out_of_line();
1538            let handles_before = decoder.remaining_handles();
1539            if let Some((inlined, num_bytes, num_handles)) =
1540                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1541            {
1542                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1543                if inlined != (member_inline_size <= 4) {
1544                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1545                }
1546                let inner_offset;
1547                let mut inner_depth = depth.clone();
1548                if inlined {
1549                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1550                    inner_offset = next_offset;
1551                } else {
1552                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1553                    inner_depth.increment()?;
1554                }
1555                let val_ref = self.arguments.get_or_insert_with(|| {
1556                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
1557                });
1558                fidl::decode!(
1559                    fidl::encoding::UnboundedVector<u8>,
1560                    D,
1561                    val_ref,
1562                    decoder,
1563                    inner_offset,
1564                    inner_depth
1565                )?;
1566                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1567                {
1568                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1569                }
1570                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1571                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1572                }
1573            }
1574
1575            next_offset += envelope_size;
1576
1577            // Decode the remaining unknown envelopes.
1578            while next_offset < end_offset {
1579                _next_ordinal_to_read += 1;
1580                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1581                next_offset += envelope_size;
1582            }
1583
1584            Ok(())
1585        }
1586    }
1587}