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