Skip to main content

fidl_fuchsia_netemul_network_common/
fidl_fuchsia_netemul_network_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
11pub const MAX_NAME_LENGTH: u32 = 256;
12
13/// Configuration used to create an endpoint.
14#[derive(Clone, Debug, PartialEq)]
15pub struct EndpointConfig {
16    /// Fake ethernet mtu.
17    pub mtu: u16,
18    /// Fake ethernet mac address, if not provided will be set to randomized local mac,
19    /// using endpoint name as seed.
20    pub mac: Option<Box<fidl_fuchsia_net_common::MacAddress>>,
21    /// Port class of the endpoint.
22    pub port_class: fidl_fuchsia_hardware_network_common::PortClass,
23    /// Simulate hardware checksum offloading. Transport-layer checksums are
24    /// neither computed nor verified.
25    ///
26    /// Note: this does not simulate the actual hardware offloading logic so
27    /// packets may be sent with invalid checksums. This property should be set
28    /// on both the sender and receiver to avoid dropped packets.
29    pub checksum_offload: bool,
30}
31
32impl fidl::Persistable for EndpointConfig {}
33
34#[derive(Clone, Debug, PartialEq)]
35pub struct EndpointGetConfigResponse {
36    pub config: EndpointConfig,
37}
38
39impl fidl::Persistable for EndpointGetConfigResponse {}
40
41#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
42pub struct EndpointGetNameResponse {
43    pub name: String,
44}
45
46impl fidl::Persistable for EndpointGetNameResponse {}
47
48#[derive(Clone, Debug, PartialEq)]
49pub struct EndpointManagerCreateEndpointRequest {
50    pub name: String,
51    pub config: EndpointConfig,
52}
53
54impl fidl::Persistable for EndpointManagerCreateEndpointRequest {}
55
56#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct EndpointManagerGetEndpointRequest {
58    pub name: String,
59}
60
61impl fidl::Persistable for EndpointManagerGetEndpointRequest {}
62
63#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64pub struct EndpointManagerListEndpointsResponse {
65    pub endp: Vec<String>,
66}
67
68impl fidl::Persistable for EndpointManagerListEndpointsResponse {}
69
70#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71pub struct EndpointSetLinkUpRequest {
72    pub up: bool,
73}
74
75impl fidl::Persistable for EndpointSetLinkUpRequest {}
76
77/// Convenience struct for creating endpoints along with network setup.
78#[derive(Clone, Debug, PartialEq)]
79pub struct EndpointSetup {
80    /// Endpoint name, must be unique in network context.
81    pub name: String,
82    /// Optional endpoint config, if not provided defaults will be used. Default
83    /// values are: mtu = 1500,  mac = randomized, port_class = Virtual.
84    pub config: Option<Box<EndpointConfig>>,
85    /// Start endpoint with link status up.
86    pub link_up: bool,
87}
88
89impl fidl::Persistable for EndpointSetup {}
90
91#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92pub struct FakeEndpointReadResponse {
93    pub data: Vec<u8>,
94    pub dropped_frames: u64,
95}
96
97impl fidl::Persistable for FakeEndpointReadResponse {}
98
99#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100pub struct FakeEndpointWriteRequest {
101    pub data: Vec<u8>,
102}
103
104impl fidl::Persistable for FakeEndpointWriteRequest {}
105
106/// Provides emulated latency configuration.
107#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
108#[repr(C)]
109pub struct LatencyConfig {
110    /// Average latency, in ms.
111    pub average: u64,
112    /// Latency standard deviation, in ms.
113    pub std_dev: u64,
114}
115
116impl fidl::Persistable for LatencyConfig {}
117
118#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct NetworkAttachEndpointRequest {
120    pub name: String,
121}
122
123impl fidl::Persistable for NetworkAttachEndpointRequest {}
124
125#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
126#[repr(C)]
127pub struct NetworkAttachEndpointResponse {
128    pub status: i32,
129}
130
131impl fidl::Persistable for NetworkAttachEndpointResponse {}
132
133#[derive(Clone, Debug, PartialEq)]
134pub struct NetworkContextSetupRequest {
135    pub networks: Vec<NetworkSetup>,
136}
137
138impl fidl::Persistable for NetworkContextSetupRequest {}
139
140#[derive(Clone, Debug, PartialEq)]
141pub struct NetworkGetConfigResponse {
142    pub config: NetworkConfig,
143}
144
145impl fidl::Persistable for NetworkGetConfigResponse {}
146
147#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
148pub struct NetworkGetNameResponse {
149    pub name: String,
150}
151
152impl fidl::Persistable for NetworkGetNameResponse {}
153
154#[derive(Clone, Debug, PartialEq)]
155pub struct NetworkManagerCreateNetworkRequest {
156    pub name: String,
157    pub config: NetworkConfig,
158}
159
160impl fidl::Persistable for NetworkManagerCreateNetworkRequest {}
161
162#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
163pub struct NetworkManagerGetNetworkRequest {
164    pub name: String,
165}
166
167impl fidl::Persistable for NetworkManagerGetNetworkRequest {}
168
169#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
170pub struct NetworkManagerListNetworksResponse {
171    pub nets: Vec<String>,
172}
173
174impl fidl::Persistable for NetworkManagerListNetworksResponse {}
175
176#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
177pub struct NetworkRemoveEndpointRequest {
178    pub name: String,
179}
180
181impl fidl::Persistable for NetworkRemoveEndpointRequest {}
182
183#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
184#[repr(C)]
185pub struct NetworkRemoveEndpointResponse {
186    pub status: i32,
187}
188
189impl fidl::Persistable for NetworkRemoveEndpointResponse {}
190
191#[derive(Clone, Debug, PartialEq)]
192pub struct NetworkSetConfigRequest {
193    pub config: NetworkConfig,
194}
195
196impl fidl::Persistable for NetworkSetConfigRequest {}
197
198#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199#[repr(C)]
200pub struct NetworkSetConfigResponse {
201    pub status: i32,
202}
203
204impl fidl::Persistable for NetworkSetConfigResponse {}
205
206/// Convenience struct for creating entire network setups.
207#[derive(Clone, Debug, PartialEq)]
208pub struct NetworkSetup {
209    /// Network name, must be unique in network context.
210    pub name: String,
211    /// NetworkConfig to use when creating network.
212    pub config: NetworkConfig,
213    /// Collection of endpoints to create and attach to network.
214    pub endpoints: Vec<EndpointSetup>,
215}
216
217impl fidl::Persistable for NetworkSetup {}
218
219#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
220pub struct NetworkStartCaptureRequest {
221    pub name: String,
222}
223
224impl fidl::Persistable for NetworkStartCaptureRequest {}
225
226#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
227#[repr(C)]
228pub struct NetworkStartCaptureResponse {
229    pub status: i32,
230}
231
232impl fidl::Persistable for NetworkStartCaptureResponse {}
233
234/// Provides emulated packet reordering configuration.
235#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
236#[repr(C)]
237pub struct ReorderConfig {
238    /// Size of buffer, in packets, to store and forward with randomized order.
239    pub store_buff: u32,
240    /// Tick/deadline in ms to empty buffer, regardless of full state.
241    /// 0 will cause buffer to flush only when full (dangerous).
242    pub tick: u64,
243}
244
245impl fidl::Persistable for ReorderConfig {}
246
247/// Used to configure a network with emulated adversity conditions.
248#[derive(Clone, Debug, Default, PartialEq)]
249pub struct NetworkConfig {
250    /// Latency configuration.
251    pub latency: Option<LatencyConfig>,
252    /// Packet loss configuration.
253    pub packet_loss: Option<LossConfig>,
254    /// Packet reordering configuration.
255    pub reorder: Option<ReorderConfig>,
256    #[doc(hidden)]
257    pub __source_breaking: fidl::marker::SourceBreaking,
258}
259
260impl fidl::Persistable for NetworkConfig {}
261
262/// Provides emulated packet loss configuration.
263#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
264pub enum LossConfig {
265    /// Rate of packet loss expressed as independent drop probability [0-100].
266    RandomRate(u8),
267}
268
269impl LossConfig {
270    #[inline]
271    pub fn ordinal(&self) -> u64 {
272        match *self {
273            Self::RandomRate(_) => 1,
274        }
275    }
276}
277
278impl fidl::Persistable for LossConfig {}
279
280pub mod device_proxy__ordinals {
281    pub const SERVE_CONTROLLER: u64 = 0x326c17ad2d3879ee;
282    pub const SERVE_DEVICE: u64 = 0x645dae2573613288;
283}
284
285pub mod endpoint_ordinals {
286    pub const GET_CONFIG: u64 = 0x3589f54aa3748539;
287    pub const GET_NAME: u64 = 0x7d69650823557aab;
288    pub const SET_LINK_UP: u64 = 0x4dde77de68d02e11;
289    pub const GET_PORT: u64 = 0x68151e034eccc958;
290    pub const GET_PROXY_: u64 = 0x476e5a57c4288ee9;
291}
292
293pub mod endpoint_manager_ordinals {
294    pub const LIST_ENDPOINTS: u64 = 0x78c83d9454e3d228;
295    pub const CREATE_ENDPOINT: u64 = 0x7defe4cd5e4e7d7c;
296    pub const GET_ENDPOINT: u64 = 0x437e956b7b860751;
297}
298
299pub mod fake_endpoint_ordinals {
300    pub const WRITE: u64 = 0x2c54af94338c523b;
301    pub const READ: u64 = 0x58e2d032a8f36234;
302}
303
304pub mod network_ordinals {
305    pub const ADD_PORT: u64 = 0x7ad6a60c931a3f4e;
306    pub const ON_REMOVED: u64 = 0xfe80656d1e5ec4a;
307    pub const GET_CONFIG: u64 = 0x8dc04557e2ab069;
308    pub const GET_NAME: u64 = 0x57b7701d1ffeedb1;
309    pub const SET_CONFIG: u64 = 0x18a490ee9d4bfa16;
310    pub const ATTACH_ENDPOINT: u64 = 0x6e8ff8e9ea1b9a98;
311    pub const REMOVE_ENDPOINT: u64 = 0x298eaac56bfcdd25;
312    pub const CREATE_FAKE_ENDPOINT: u64 = 0x3eb8f71b45e1e1f3;
313    pub const START_CAPTURE: u64 = 0x3ca44940622932c;
314    pub const STOP_CAPTURE: u64 = 0x1d7827adad109468;
315}
316
317pub mod network_context_ordinals {
318    pub const CLONE: u64 = 0x1f7eb1b78a2ad2b0;
319    pub const GET_NETWORK_MANAGER: u64 = 0x379899a30766afd4;
320    pub const GET_ENDPOINT_MANAGER: u64 = 0x5e64360363b9bd81;
321    pub const SETUP: u64 = 0x1680e0b13823fc8c;
322}
323
324pub mod network_manager_ordinals {
325    pub const LIST_NETWORKS: u64 = 0x2488653e0974cc62;
326    pub const CREATE_NETWORK: u64 = 0x6052eb5ac709af;
327    pub const GET_NETWORK: u64 = 0x59930bf23acc7d9a;
328}
329
330pub mod setup_handle_ordinals {}
331
332mod internal {
333    use super::*;
334
335    impl fidl::encoding::ValueTypeMarker for EndpointConfig {
336        type Borrowed<'a> = &'a Self;
337        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
338            value
339        }
340    }
341
342    unsafe impl fidl::encoding::TypeMarker for EndpointConfig {
343        type Owned = Self;
344
345        #[inline(always)]
346        fn inline_align(_context: fidl::encoding::Context) -> usize {
347            8
348        }
349
350        #[inline(always)]
351        fn inline_size(_context: fidl::encoding::Context) -> usize {
352            24
353        }
354    }
355
356    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EndpointConfig, D>
357        for &EndpointConfig
358    {
359        #[inline]
360        unsafe fn encode(
361            self,
362            encoder: &mut fidl::encoding::Encoder<'_, D>,
363            offset: usize,
364            _depth: fidl::encoding::Depth,
365        ) -> fidl::Result<()> {
366            encoder.debug_check_bounds::<EndpointConfig>(offset);
367            // Delegate to tuple encoding.
368            fidl::encoding::Encode::<EndpointConfig, D>::encode(
369                (
370                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.mtu),
371                    <fidl::encoding::Boxed<fidl_fuchsia_net_common::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
372                    <fidl_fuchsia_hardware_network_common::PortClass as fidl::encoding::ValueTypeMarker>::borrow(&self.port_class),
373                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.checksum_offload),
374                ),
375                encoder, offset, _depth
376            )
377        }
378    }
379    unsafe impl<
380        D: fidl::encoding::ResourceDialect,
381        T0: fidl::encoding::Encode<u16, D>,
382        T1: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net_common::MacAddress>, D>,
383        T2: fidl::encoding::Encode<fidl_fuchsia_hardware_network_common::PortClass, D>,
384        T3: fidl::encoding::Encode<bool, D>,
385    > fidl::encoding::Encode<EndpointConfig, D> for (T0, T1, T2, T3)
386    {
387        #[inline]
388        unsafe fn encode(
389            self,
390            encoder: &mut fidl::encoding::Encoder<'_, D>,
391            offset: usize,
392            depth: fidl::encoding::Depth,
393        ) -> fidl::Result<()> {
394            encoder.debug_check_bounds::<EndpointConfig>(offset);
395            // Zero out padding regions. There's no need to apply masks
396            // because the unmasked parts will be overwritten by fields.
397            unsafe {
398                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
399                (ptr as *mut u64).write_unaligned(0);
400            }
401            unsafe {
402                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
403                (ptr as *mut u64).write_unaligned(0);
404            }
405            // Write the fields.
406            self.0.encode(encoder, offset + 0, depth)?;
407            self.1.encode(encoder, offset + 8, depth)?;
408            self.2.encode(encoder, offset + 16, depth)?;
409            self.3.encode(encoder, offset + 18, depth)?;
410            Ok(())
411        }
412    }
413
414    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EndpointConfig {
415        #[inline(always)]
416        fn new_empty() -> Self {
417            Self {
418                mtu: fidl::new_empty!(u16, D),
419                mac: fidl::new_empty!(
420                    fidl::encoding::Boxed<fidl_fuchsia_net_common::MacAddress>,
421                    D
422                ),
423                port_class: fidl::new_empty!(fidl_fuchsia_hardware_network_common::PortClass, D),
424                checksum_offload: fidl::new_empty!(bool, D),
425            }
426        }
427
428        #[inline]
429        unsafe fn decode(
430            &mut self,
431            decoder: &mut fidl::encoding::Decoder<'_, D>,
432            offset: usize,
433            _depth: fidl::encoding::Depth,
434        ) -> fidl::Result<()> {
435            decoder.debug_check_bounds::<Self>(offset);
436            // Verify that padding bytes are zero.
437            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
438            let padval = unsafe { (ptr as *const u64).read_unaligned() };
439            let mask = 0xffffffffffff0000u64;
440            let maskedval = padval & mask;
441            if maskedval != 0 {
442                return Err(fidl::Error::NonZeroPadding {
443                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
444                });
445            }
446            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
447            let padval = unsafe { (ptr as *const u64).read_unaligned() };
448            let mask = 0xffffffffff000000u64;
449            let maskedval = padval & mask;
450            if maskedval != 0 {
451                return Err(fidl::Error::NonZeroPadding {
452                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
453                });
454            }
455            fidl::decode!(u16, D, &mut self.mtu, decoder, offset + 0, _depth)?;
456            fidl::decode!(
457                fidl::encoding::Boxed<fidl_fuchsia_net_common::MacAddress>,
458                D,
459                &mut self.mac,
460                decoder,
461                offset + 8,
462                _depth
463            )?;
464            fidl::decode!(
465                fidl_fuchsia_hardware_network_common::PortClass,
466                D,
467                &mut self.port_class,
468                decoder,
469                offset + 16,
470                _depth
471            )?;
472            fidl::decode!(bool, D, &mut self.checksum_offload, decoder, offset + 18, _depth)?;
473            Ok(())
474        }
475    }
476
477    impl fidl::encoding::ValueTypeMarker for EndpointGetConfigResponse {
478        type Borrowed<'a> = &'a Self;
479        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
480            value
481        }
482    }
483
484    unsafe impl fidl::encoding::TypeMarker for EndpointGetConfigResponse {
485        type Owned = Self;
486
487        #[inline(always)]
488        fn inline_align(_context: fidl::encoding::Context) -> usize {
489            8
490        }
491
492        #[inline(always)]
493        fn inline_size(_context: fidl::encoding::Context) -> usize {
494            24
495        }
496    }
497
498    unsafe impl<D: fidl::encoding::ResourceDialect>
499        fidl::encoding::Encode<EndpointGetConfigResponse, D> for &EndpointGetConfigResponse
500    {
501        #[inline]
502        unsafe fn encode(
503            self,
504            encoder: &mut fidl::encoding::Encoder<'_, D>,
505            offset: usize,
506            _depth: fidl::encoding::Depth,
507        ) -> fidl::Result<()> {
508            encoder.debug_check_bounds::<EndpointGetConfigResponse>(offset);
509            // Delegate to tuple encoding.
510            fidl::encoding::Encode::<EndpointGetConfigResponse, D>::encode(
511                (<EndpointConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
512                encoder,
513                offset,
514                _depth,
515            )
516        }
517    }
518    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<EndpointConfig, D>>
519        fidl::encoding::Encode<EndpointGetConfigResponse, D> for (T0,)
520    {
521        #[inline]
522        unsafe fn encode(
523            self,
524            encoder: &mut fidl::encoding::Encoder<'_, D>,
525            offset: usize,
526            depth: fidl::encoding::Depth,
527        ) -> fidl::Result<()> {
528            encoder.debug_check_bounds::<EndpointGetConfigResponse>(offset);
529            // Zero out padding regions. There's no need to apply masks
530            // because the unmasked parts will be overwritten by fields.
531            // Write the fields.
532            self.0.encode(encoder, offset + 0, depth)?;
533            Ok(())
534        }
535    }
536
537    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
538        for EndpointGetConfigResponse
539    {
540        #[inline(always)]
541        fn new_empty() -> Self {
542            Self { config: fidl::new_empty!(EndpointConfig, D) }
543        }
544
545        #[inline]
546        unsafe fn decode(
547            &mut self,
548            decoder: &mut fidl::encoding::Decoder<'_, D>,
549            offset: usize,
550            _depth: fidl::encoding::Depth,
551        ) -> fidl::Result<()> {
552            decoder.debug_check_bounds::<Self>(offset);
553            // Verify that padding bytes are zero.
554            fidl::decode!(EndpointConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
555            Ok(())
556        }
557    }
558
559    impl fidl::encoding::ValueTypeMarker for EndpointGetNameResponse {
560        type Borrowed<'a> = &'a Self;
561        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
562            value
563        }
564    }
565
566    unsafe impl fidl::encoding::TypeMarker for EndpointGetNameResponse {
567        type Owned = Self;
568
569        #[inline(always)]
570        fn inline_align(_context: fidl::encoding::Context) -> usize {
571            8
572        }
573
574        #[inline(always)]
575        fn inline_size(_context: fidl::encoding::Context) -> usize {
576            16
577        }
578    }
579
580    unsafe impl<D: fidl::encoding::ResourceDialect>
581        fidl::encoding::Encode<EndpointGetNameResponse, D> for &EndpointGetNameResponse
582    {
583        #[inline]
584        unsafe fn encode(
585            self,
586            encoder: &mut fidl::encoding::Encoder<'_, D>,
587            offset: usize,
588            _depth: fidl::encoding::Depth,
589        ) -> fidl::Result<()> {
590            encoder.debug_check_bounds::<EndpointGetNameResponse>(offset);
591            // Delegate to tuple encoding.
592            fidl::encoding::Encode::<EndpointGetNameResponse, D>::encode(
593                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
594                    &self.name,
595                ),),
596                encoder,
597                offset,
598                _depth,
599            )
600        }
601    }
602    unsafe impl<
603        D: fidl::encoding::ResourceDialect,
604        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
605    > fidl::encoding::Encode<EndpointGetNameResponse, D> for (T0,)
606    {
607        #[inline]
608        unsafe fn encode(
609            self,
610            encoder: &mut fidl::encoding::Encoder<'_, D>,
611            offset: usize,
612            depth: fidl::encoding::Depth,
613        ) -> fidl::Result<()> {
614            encoder.debug_check_bounds::<EndpointGetNameResponse>(offset);
615            // Zero out padding regions. There's no need to apply masks
616            // because the unmasked parts will be overwritten by fields.
617            // Write the fields.
618            self.0.encode(encoder, offset + 0, depth)?;
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
624        for EndpointGetNameResponse
625    {
626        #[inline(always)]
627        fn new_empty() -> Self {
628            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
629        }
630
631        #[inline]
632        unsafe fn decode(
633            &mut self,
634            decoder: &mut fidl::encoding::Decoder<'_, D>,
635            offset: usize,
636            _depth: fidl::encoding::Depth,
637        ) -> fidl::Result<()> {
638            decoder.debug_check_bounds::<Self>(offset);
639            // Verify that padding bytes are zero.
640            fidl::decode!(
641                fidl::encoding::BoundedString<256>,
642                D,
643                &mut self.name,
644                decoder,
645                offset + 0,
646                _depth
647            )?;
648            Ok(())
649        }
650    }
651
652    impl fidl::encoding::ValueTypeMarker for EndpointManagerCreateEndpointRequest {
653        type Borrowed<'a> = &'a Self;
654        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
655            value
656        }
657    }
658
659    unsafe impl fidl::encoding::TypeMarker for EndpointManagerCreateEndpointRequest {
660        type Owned = Self;
661
662        #[inline(always)]
663        fn inline_align(_context: fidl::encoding::Context) -> usize {
664            8
665        }
666
667        #[inline(always)]
668        fn inline_size(_context: fidl::encoding::Context) -> usize {
669            40
670        }
671    }
672
673    unsafe impl<D: fidl::encoding::ResourceDialect>
674        fidl::encoding::Encode<EndpointManagerCreateEndpointRequest, D>
675        for &EndpointManagerCreateEndpointRequest
676    {
677        #[inline]
678        unsafe fn encode(
679            self,
680            encoder: &mut fidl::encoding::Encoder<'_, D>,
681            offset: usize,
682            _depth: fidl::encoding::Depth,
683        ) -> fidl::Result<()> {
684            encoder.debug_check_bounds::<EndpointManagerCreateEndpointRequest>(offset);
685            // Delegate to tuple encoding.
686            fidl::encoding::Encode::<EndpointManagerCreateEndpointRequest, D>::encode(
687                (
688                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
689                        &self.name,
690                    ),
691                    <EndpointConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
692                ),
693                encoder,
694                offset,
695                _depth,
696            )
697        }
698    }
699    unsafe impl<
700        D: fidl::encoding::ResourceDialect,
701        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
702        T1: fidl::encoding::Encode<EndpointConfig, D>,
703    > fidl::encoding::Encode<EndpointManagerCreateEndpointRequest, D> for (T0, T1)
704    {
705        #[inline]
706        unsafe fn encode(
707            self,
708            encoder: &mut fidl::encoding::Encoder<'_, D>,
709            offset: usize,
710            depth: fidl::encoding::Depth,
711        ) -> fidl::Result<()> {
712            encoder.debug_check_bounds::<EndpointManagerCreateEndpointRequest>(offset);
713            // Zero out padding regions. There's no need to apply masks
714            // because the unmasked parts will be overwritten by fields.
715            // Write the fields.
716            self.0.encode(encoder, offset + 0, depth)?;
717            self.1.encode(encoder, offset + 16, depth)?;
718            Ok(())
719        }
720    }
721
722    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
723        for EndpointManagerCreateEndpointRequest
724    {
725        #[inline(always)]
726        fn new_empty() -> Self {
727            Self {
728                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
729                config: fidl::new_empty!(EndpointConfig, D),
730            }
731        }
732
733        #[inline]
734        unsafe fn decode(
735            &mut self,
736            decoder: &mut fidl::encoding::Decoder<'_, D>,
737            offset: usize,
738            _depth: fidl::encoding::Depth,
739        ) -> fidl::Result<()> {
740            decoder.debug_check_bounds::<Self>(offset);
741            // Verify that padding bytes are zero.
742            fidl::decode!(
743                fidl::encoding::BoundedString<256>,
744                D,
745                &mut self.name,
746                decoder,
747                offset + 0,
748                _depth
749            )?;
750            fidl::decode!(EndpointConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
751            Ok(())
752        }
753    }
754
755    impl fidl::encoding::ValueTypeMarker for EndpointManagerGetEndpointRequest {
756        type Borrowed<'a> = &'a Self;
757        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
758            value
759        }
760    }
761
762    unsafe impl fidl::encoding::TypeMarker for EndpointManagerGetEndpointRequest {
763        type Owned = Self;
764
765        #[inline(always)]
766        fn inline_align(_context: fidl::encoding::Context) -> usize {
767            8
768        }
769
770        #[inline(always)]
771        fn inline_size(_context: fidl::encoding::Context) -> usize {
772            16
773        }
774    }
775
776    unsafe impl<D: fidl::encoding::ResourceDialect>
777        fidl::encoding::Encode<EndpointManagerGetEndpointRequest, D>
778        for &EndpointManagerGetEndpointRequest
779    {
780        #[inline]
781        unsafe fn encode(
782            self,
783            encoder: &mut fidl::encoding::Encoder<'_, D>,
784            offset: usize,
785            _depth: fidl::encoding::Depth,
786        ) -> fidl::Result<()> {
787            encoder.debug_check_bounds::<EndpointManagerGetEndpointRequest>(offset);
788            // Delegate to tuple encoding.
789            fidl::encoding::Encode::<EndpointManagerGetEndpointRequest, D>::encode(
790                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
791                    &self.name,
792                ),),
793                encoder,
794                offset,
795                _depth,
796            )
797        }
798    }
799    unsafe impl<
800        D: fidl::encoding::ResourceDialect,
801        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
802    > fidl::encoding::Encode<EndpointManagerGetEndpointRequest, D> for (T0,)
803    {
804        #[inline]
805        unsafe fn encode(
806            self,
807            encoder: &mut fidl::encoding::Encoder<'_, D>,
808            offset: usize,
809            depth: fidl::encoding::Depth,
810        ) -> fidl::Result<()> {
811            encoder.debug_check_bounds::<EndpointManagerGetEndpointRequest>(offset);
812            // Zero out padding regions. There's no need to apply masks
813            // because the unmasked parts will be overwritten by fields.
814            // Write the fields.
815            self.0.encode(encoder, offset + 0, depth)?;
816            Ok(())
817        }
818    }
819
820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
821        for EndpointManagerGetEndpointRequest
822    {
823        #[inline(always)]
824        fn new_empty() -> Self {
825            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
826        }
827
828        #[inline]
829        unsafe fn decode(
830            &mut self,
831            decoder: &mut fidl::encoding::Decoder<'_, D>,
832            offset: usize,
833            _depth: fidl::encoding::Depth,
834        ) -> fidl::Result<()> {
835            decoder.debug_check_bounds::<Self>(offset);
836            // Verify that padding bytes are zero.
837            fidl::decode!(
838                fidl::encoding::BoundedString<256>,
839                D,
840                &mut self.name,
841                decoder,
842                offset + 0,
843                _depth
844            )?;
845            Ok(())
846        }
847    }
848
849    impl fidl::encoding::ValueTypeMarker for EndpointManagerListEndpointsResponse {
850        type Borrowed<'a> = &'a Self;
851        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
852            value
853        }
854    }
855
856    unsafe impl fidl::encoding::TypeMarker for EndpointManagerListEndpointsResponse {
857        type Owned = Self;
858
859        #[inline(always)]
860        fn inline_align(_context: fidl::encoding::Context) -> usize {
861            8
862        }
863
864        #[inline(always)]
865        fn inline_size(_context: fidl::encoding::Context) -> usize {
866            16
867        }
868    }
869
870    unsafe impl<D: fidl::encoding::ResourceDialect>
871        fidl::encoding::Encode<EndpointManagerListEndpointsResponse, D>
872        for &EndpointManagerListEndpointsResponse
873    {
874        #[inline]
875        unsafe fn encode(
876            self,
877            encoder: &mut fidl::encoding::Encoder<'_, D>,
878            offset: usize,
879            _depth: fidl::encoding::Depth,
880        ) -> fidl::Result<()> {
881            encoder.debug_check_bounds::<EndpointManagerListEndpointsResponse>(offset);
882            // Delegate to tuple encoding.
883            fidl::encoding::Encode::<EndpointManagerListEndpointsResponse, D>::encode(
884                (
885                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.endp),
886                ),
887                encoder, offset, _depth
888            )
889        }
890    }
891    unsafe impl<
892        D: fidl::encoding::ResourceDialect,
893        T0: fidl::encoding::Encode<
894                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
895                D,
896            >,
897    > fidl::encoding::Encode<EndpointManagerListEndpointsResponse, D> for (T0,)
898    {
899        #[inline]
900        unsafe fn encode(
901            self,
902            encoder: &mut fidl::encoding::Encoder<'_, D>,
903            offset: usize,
904            depth: fidl::encoding::Depth,
905        ) -> fidl::Result<()> {
906            encoder.debug_check_bounds::<EndpointManagerListEndpointsResponse>(offset);
907            // Zero out padding regions. There's no need to apply masks
908            // because the unmasked parts will be overwritten by fields.
909            // Write the fields.
910            self.0.encode(encoder, offset + 0, depth)?;
911            Ok(())
912        }
913    }
914
915    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
916        for EndpointManagerListEndpointsResponse
917    {
918        #[inline(always)]
919        fn new_empty() -> Self {
920            Self {
921                endp: fidl::new_empty!(
922                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
923                    D
924                ),
925            }
926        }
927
928        #[inline]
929        unsafe fn decode(
930            &mut self,
931            decoder: &mut fidl::encoding::Decoder<'_, D>,
932            offset: usize,
933            _depth: fidl::encoding::Depth,
934        ) -> fidl::Result<()> {
935            decoder.debug_check_bounds::<Self>(offset);
936            // Verify that padding bytes are zero.
937            fidl::decode!(
938                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
939                D,
940                &mut self.endp,
941                decoder,
942                offset + 0,
943                _depth
944            )?;
945            Ok(())
946        }
947    }
948
949    impl fidl::encoding::ValueTypeMarker for EndpointSetLinkUpRequest {
950        type Borrowed<'a> = &'a Self;
951        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
952            value
953        }
954    }
955
956    unsafe impl fidl::encoding::TypeMarker for EndpointSetLinkUpRequest {
957        type Owned = Self;
958
959        #[inline(always)]
960        fn inline_align(_context: fidl::encoding::Context) -> usize {
961            1
962        }
963
964        #[inline(always)]
965        fn inline_size(_context: fidl::encoding::Context) -> usize {
966            1
967        }
968    }
969
970    unsafe impl<D: fidl::encoding::ResourceDialect>
971        fidl::encoding::Encode<EndpointSetLinkUpRequest, D> for &EndpointSetLinkUpRequest
972    {
973        #[inline]
974        unsafe fn encode(
975            self,
976            encoder: &mut fidl::encoding::Encoder<'_, D>,
977            offset: usize,
978            _depth: fidl::encoding::Depth,
979        ) -> fidl::Result<()> {
980            encoder.debug_check_bounds::<EndpointSetLinkUpRequest>(offset);
981            // Delegate to tuple encoding.
982            fidl::encoding::Encode::<EndpointSetLinkUpRequest, D>::encode(
983                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.up),),
984                encoder,
985                offset,
986                _depth,
987            )
988        }
989    }
990    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
991        fidl::encoding::Encode<EndpointSetLinkUpRequest, D> for (T0,)
992    {
993        #[inline]
994        unsafe fn encode(
995            self,
996            encoder: &mut fidl::encoding::Encoder<'_, D>,
997            offset: usize,
998            depth: fidl::encoding::Depth,
999        ) -> fidl::Result<()> {
1000            encoder.debug_check_bounds::<EndpointSetLinkUpRequest>(offset);
1001            // Zero out padding regions. There's no need to apply masks
1002            // because the unmasked parts will be overwritten by fields.
1003            // Write the fields.
1004            self.0.encode(encoder, offset + 0, depth)?;
1005            Ok(())
1006        }
1007    }
1008
1009    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1010        for EndpointSetLinkUpRequest
1011    {
1012        #[inline(always)]
1013        fn new_empty() -> Self {
1014            Self { up: fidl::new_empty!(bool, D) }
1015        }
1016
1017        #[inline]
1018        unsafe fn decode(
1019            &mut self,
1020            decoder: &mut fidl::encoding::Decoder<'_, D>,
1021            offset: usize,
1022            _depth: fidl::encoding::Depth,
1023        ) -> fidl::Result<()> {
1024            decoder.debug_check_bounds::<Self>(offset);
1025            // Verify that padding bytes are zero.
1026            fidl::decode!(bool, D, &mut self.up, decoder, offset + 0, _depth)?;
1027            Ok(())
1028        }
1029    }
1030
1031    impl fidl::encoding::ValueTypeMarker for EndpointSetup {
1032        type Borrowed<'a> = &'a Self;
1033        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1034            value
1035        }
1036    }
1037
1038    unsafe impl fidl::encoding::TypeMarker for EndpointSetup {
1039        type Owned = Self;
1040
1041        #[inline(always)]
1042        fn inline_align(_context: fidl::encoding::Context) -> usize {
1043            8
1044        }
1045
1046        #[inline(always)]
1047        fn inline_size(_context: fidl::encoding::Context) -> usize {
1048            32
1049        }
1050    }
1051
1052    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EndpointSetup, D>
1053        for &EndpointSetup
1054    {
1055        #[inline]
1056        unsafe fn encode(
1057            self,
1058            encoder: &mut fidl::encoding::Encoder<'_, D>,
1059            offset: usize,
1060            _depth: fidl::encoding::Depth,
1061        ) -> fidl::Result<()> {
1062            encoder.debug_check_bounds::<EndpointSetup>(offset);
1063            // Delegate to tuple encoding.
1064            fidl::encoding::Encode::<EndpointSetup, D>::encode(
1065                (
1066                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1067                    <fidl::encoding::Boxed<EndpointConfig> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1068                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.link_up),
1069                ),
1070                encoder, offset, _depth
1071            )
1072        }
1073    }
1074    unsafe impl<
1075        D: fidl::encoding::ResourceDialect,
1076        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
1077        T1: fidl::encoding::Encode<fidl::encoding::Boxed<EndpointConfig>, D>,
1078        T2: fidl::encoding::Encode<bool, D>,
1079    > fidl::encoding::Encode<EndpointSetup, D> for (T0, T1, T2)
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::<EndpointSetup>(offset);
1089            // Zero out padding regions. There's no need to apply masks
1090            // because the unmasked parts will be overwritten by fields.
1091            unsafe {
1092                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1093                (ptr as *mut u64).write_unaligned(0);
1094            }
1095            // Write the fields.
1096            self.0.encode(encoder, offset + 0, depth)?;
1097            self.1.encode(encoder, offset + 16, depth)?;
1098            self.2.encode(encoder, offset + 24, depth)?;
1099            Ok(())
1100        }
1101    }
1102
1103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EndpointSetup {
1104        #[inline(always)]
1105        fn new_empty() -> Self {
1106            Self {
1107                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
1108                config: fidl::new_empty!(fidl::encoding::Boxed<EndpointConfig>, D),
1109                link_up: fidl::new_empty!(bool, D),
1110            }
1111        }
1112
1113        #[inline]
1114        unsafe fn decode(
1115            &mut self,
1116            decoder: &mut fidl::encoding::Decoder<'_, D>,
1117            offset: usize,
1118            _depth: fidl::encoding::Depth,
1119        ) -> fidl::Result<()> {
1120            decoder.debug_check_bounds::<Self>(offset);
1121            // Verify that padding bytes are zero.
1122            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1123            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1124            let mask = 0xffffffffffffff00u64;
1125            let maskedval = padval & mask;
1126            if maskedval != 0 {
1127                return Err(fidl::Error::NonZeroPadding {
1128                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1129                });
1130            }
1131            fidl::decode!(
1132                fidl::encoding::BoundedString<256>,
1133                D,
1134                &mut self.name,
1135                decoder,
1136                offset + 0,
1137                _depth
1138            )?;
1139            fidl::decode!(
1140                fidl::encoding::Boxed<EndpointConfig>,
1141                D,
1142                &mut self.config,
1143                decoder,
1144                offset + 16,
1145                _depth
1146            )?;
1147            fidl::decode!(bool, D, &mut self.link_up, decoder, offset + 24, _depth)?;
1148            Ok(())
1149        }
1150    }
1151
1152    impl fidl::encoding::ValueTypeMarker for FakeEndpointReadResponse {
1153        type Borrowed<'a> = &'a Self;
1154        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1155            value
1156        }
1157    }
1158
1159    unsafe impl fidl::encoding::TypeMarker for FakeEndpointReadResponse {
1160        type Owned = Self;
1161
1162        #[inline(always)]
1163        fn inline_align(_context: fidl::encoding::Context) -> usize {
1164            8
1165        }
1166
1167        #[inline(always)]
1168        fn inline_size(_context: fidl::encoding::Context) -> usize {
1169            24
1170        }
1171    }
1172
1173    unsafe impl<D: fidl::encoding::ResourceDialect>
1174        fidl::encoding::Encode<FakeEndpointReadResponse, D> for &FakeEndpointReadResponse
1175    {
1176        #[inline]
1177        unsafe fn encode(
1178            self,
1179            encoder: &mut fidl::encoding::Encoder<'_, D>,
1180            offset: usize,
1181            _depth: fidl::encoding::Depth,
1182        ) -> fidl::Result<()> {
1183            encoder.debug_check_bounds::<FakeEndpointReadResponse>(offset);
1184            // Delegate to tuple encoding.
1185            fidl::encoding::Encode::<FakeEndpointReadResponse, D>::encode(
1186                (
1187                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
1188                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_frames),
1189                ),
1190                encoder, offset, _depth
1191            )
1192        }
1193    }
1194    unsafe impl<
1195        D: fidl::encoding::ResourceDialect,
1196        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1197        T1: fidl::encoding::Encode<u64, D>,
1198    > fidl::encoding::Encode<FakeEndpointReadResponse, D> for (T0, T1)
1199    {
1200        #[inline]
1201        unsafe fn encode(
1202            self,
1203            encoder: &mut fidl::encoding::Encoder<'_, D>,
1204            offset: usize,
1205            depth: fidl::encoding::Depth,
1206        ) -> fidl::Result<()> {
1207            encoder.debug_check_bounds::<FakeEndpointReadResponse>(offset);
1208            // Zero out padding regions. There's no need to apply masks
1209            // because the unmasked parts will be overwritten by fields.
1210            // Write the fields.
1211            self.0.encode(encoder, offset + 0, depth)?;
1212            self.1.encode(encoder, offset + 16, depth)?;
1213            Ok(())
1214        }
1215    }
1216
1217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1218        for FakeEndpointReadResponse
1219    {
1220        #[inline(always)]
1221        fn new_empty() -> Self {
1222            Self {
1223                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1224                dropped_frames: fidl::new_empty!(u64, D),
1225            }
1226        }
1227
1228        #[inline]
1229        unsafe fn decode(
1230            &mut self,
1231            decoder: &mut fidl::encoding::Decoder<'_, D>,
1232            offset: usize,
1233            _depth: fidl::encoding::Depth,
1234        ) -> fidl::Result<()> {
1235            decoder.debug_check_bounds::<Self>(offset);
1236            // Verify that padding bytes are zero.
1237            fidl::decode!(
1238                fidl::encoding::UnboundedVector<u8>,
1239                D,
1240                &mut self.data,
1241                decoder,
1242                offset + 0,
1243                _depth
1244            )?;
1245            fidl::decode!(u64, D, &mut self.dropped_frames, decoder, offset + 16, _depth)?;
1246            Ok(())
1247        }
1248    }
1249
1250    impl fidl::encoding::ValueTypeMarker for FakeEndpointWriteRequest {
1251        type Borrowed<'a> = &'a Self;
1252        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1253            value
1254        }
1255    }
1256
1257    unsafe impl fidl::encoding::TypeMarker for FakeEndpointWriteRequest {
1258        type Owned = Self;
1259
1260        #[inline(always)]
1261        fn inline_align(_context: fidl::encoding::Context) -> usize {
1262            8
1263        }
1264
1265        #[inline(always)]
1266        fn inline_size(_context: fidl::encoding::Context) -> usize {
1267            16
1268        }
1269    }
1270
1271    unsafe impl<D: fidl::encoding::ResourceDialect>
1272        fidl::encoding::Encode<FakeEndpointWriteRequest, D> for &FakeEndpointWriteRequest
1273    {
1274        #[inline]
1275        unsafe fn encode(
1276            self,
1277            encoder: &mut fidl::encoding::Encoder<'_, D>,
1278            offset: usize,
1279            _depth: fidl::encoding::Depth,
1280        ) -> fidl::Result<()> {
1281            encoder.debug_check_bounds::<FakeEndpointWriteRequest>(offset);
1282            // Delegate to tuple encoding.
1283            fidl::encoding::Encode::<FakeEndpointWriteRequest, D>::encode(
1284                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
1285                    &self.data,
1286                ),),
1287                encoder,
1288                offset,
1289                _depth,
1290            )
1291        }
1292    }
1293    unsafe impl<
1294        D: fidl::encoding::ResourceDialect,
1295        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1296    > fidl::encoding::Encode<FakeEndpointWriteRequest, D> for (T0,)
1297    {
1298        #[inline]
1299        unsafe fn encode(
1300            self,
1301            encoder: &mut fidl::encoding::Encoder<'_, D>,
1302            offset: usize,
1303            depth: fidl::encoding::Depth,
1304        ) -> fidl::Result<()> {
1305            encoder.debug_check_bounds::<FakeEndpointWriteRequest>(offset);
1306            // Zero out padding regions. There's no need to apply masks
1307            // because the unmasked parts will be overwritten by fields.
1308            // Write the fields.
1309            self.0.encode(encoder, offset + 0, depth)?;
1310            Ok(())
1311        }
1312    }
1313
1314    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1315        for FakeEndpointWriteRequest
1316    {
1317        #[inline(always)]
1318        fn new_empty() -> Self {
1319            Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
1320        }
1321
1322        #[inline]
1323        unsafe fn decode(
1324            &mut self,
1325            decoder: &mut fidl::encoding::Decoder<'_, D>,
1326            offset: usize,
1327            _depth: fidl::encoding::Depth,
1328        ) -> fidl::Result<()> {
1329            decoder.debug_check_bounds::<Self>(offset);
1330            // Verify that padding bytes are zero.
1331            fidl::decode!(
1332                fidl::encoding::UnboundedVector<u8>,
1333                D,
1334                &mut self.data,
1335                decoder,
1336                offset + 0,
1337                _depth
1338            )?;
1339            Ok(())
1340        }
1341    }
1342
1343    impl fidl::encoding::ValueTypeMarker for LatencyConfig {
1344        type Borrowed<'a> = &'a Self;
1345        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1346            value
1347        }
1348    }
1349
1350    unsafe impl fidl::encoding::TypeMarker for LatencyConfig {
1351        type Owned = Self;
1352
1353        #[inline(always)]
1354        fn inline_align(_context: fidl::encoding::Context) -> usize {
1355            8
1356        }
1357
1358        #[inline(always)]
1359        fn inline_size(_context: fidl::encoding::Context) -> usize {
1360            16
1361        }
1362        #[inline(always)]
1363        fn encode_is_copy() -> bool {
1364            true
1365        }
1366
1367        #[inline(always)]
1368        fn decode_is_copy() -> bool {
1369            true
1370        }
1371    }
1372
1373    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LatencyConfig, D>
1374        for &LatencyConfig
1375    {
1376        #[inline]
1377        unsafe fn encode(
1378            self,
1379            encoder: &mut fidl::encoding::Encoder<'_, D>,
1380            offset: usize,
1381            _depth: fidl::encoding::Depth,
1382        ) -> fidl::Result<()> {
1383            encoder.debug_check_bounds::<LatencyConfig>(offset);
1384            unsafe {
1385                // Copy the object into the buffer.
1386                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1387                (buf_ptr as *mut LatencyConfig)
1388                    .write_unaligned((self as *const LatencyConfig).read());
1389                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1390                // done second because the memcpy will write garbage to these bytes.
1391            }
1392            Ok(())
1393        }
1394    }
1395    unsafe impl<
1396        D: fidl::encoding::ResourceDialect,
1397        T0: fidl::encoding::Encode<u64, D>,
1398        T1: fidl::encoding::Encode<u64, D>,
1399    > fidl::encoding::Encode<LatencyConfig, D> for (T0, T1)
1400    {
1401        #[inline]
1402        unsafe fn encode(
1403            self,
1404            encoder: &mut fidl::encoding::Encoder<'_, D>,
1405            offset: usize,
1406            depth: fidl::encoding::Depth,
1407        ) -> fidl::Result<()> {
1408            encoder.debug_check_bounds::<LatencyConfig>(offset);
1409            // Zero out padding regions. There's no need to apply masks
1410            // because the unmasked parts will be overwritten by fields.
1411            // Write the fields.
1412            self.0.encode(encoder, offset + 0, depth)?;
1413            self.1.encode(encoder, offset + 8, depth)?;
1414            Ok(())
1415        }
1416    }
1417
1418    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LatencyConfig {
1419        #[inline(always)]
1420        fn new_empty() -> Self {
1421            Self { average: fidl::new_empty!(u64, D), std_dev: fidl::new_empty!(u64, D) }
1422        }
1423
1424        #[inline]
1425        unsafe fn decode(
1426            &mut self,
1427            decoder: &mut fidl::encoding::Decoder<'_, D>,
1428            offset: usize,
1429            _depth: fidl::encoding::Depth,
1430        ) -> fidl::Result<()> {
1431            decoder.debug_check_bounds::<Self>(offset);
1432            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1433            // Verify that padding bytes are zero.
1434            // Copy from the buffer into the object.
1435            unsafe {
1436                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1437            }
1438            Ok(())
1439        }
1440    }
1441
1442    impl fidl::encoding::ValueTypeMarker for NetworkAttachEndpointRequest {
1443        type Borrowed<'a> = &'a Self;
1444        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1445            value
1446        }
1447    }
1448
1449    unsafe impl fidl::encoding::TypeMarker for NetworkAttachEndpointRequest {
1450        type Owned = Self;
1451
1452        #[inline(always)]
1453        fn inline_align(_context: fidl::encoding::Context) -> usize {
1454            8
1455        }
1456
1457        #[inline(always)]
1458        fn inline_size(_context: fidl::encoding::Context) -> usize {
1459            16
1460        }
1461    }
1462
1463    unsafe impl<D: fidl::encoding::ResourceDialect>
1464        fidl::encoding::Encode<NetworkAttachEndpointRequest, D> for &NetworkAttachEndpointRequest
1465    {
1466        #[inline]
1467        unsafe fn encode(
1468            self,
1469            encoder: &mut fidl::encoding::Encoder<'_, D>,
1470            offset: usize,
1471            _depth: fidl::encoding::Depth,
1472        ) -> fidl::Result<()> {
1473            encoder.debug_check_bounds::<NetworkAttachEndpointRequest>(offset);
1474            // Delegate to tuple encoding.
1475            fidl::encoding::Encode::<NetworkAttachEndpointRequest, D>::encode(
1476                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
1477                    &self.name,
1478                ),),
1479                encoder,
1480                offset,
1481                _depth,
1482            )
1483        }
1484    }
1485    unsafe impl<
1486        D: fidl::encoding::ResourceDialect,
1487        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
1488    > fidl::encoding::Encode<NetworkAttachEndpointRequest, D> for (T0,)
1489    {
1490        #[inline]
1491        unsafe fn encode(
1492            self,
1493            encoder: &mut fidl::encoding::Encoder<'_, D>,
1494            offset: usize,
1495            depth: fidl::encoding::Depth,
1496        ) -> fidl::Result<()> {
1497            encoder.debug_check_bounds::<NetworkAttachEndpointRequest>(offset);
1498            // Zero out padding regions. There's no need to apply masks
1499            // because the unmasked parts will be overwritten by fields.
1500            // Write the fields.
1501            self.0.encode(encoder, offset + 0, depth)?;
1502            Ok(())
1503        }
1504    }
1505
1506    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1507        for NetworkAttachEndpointRequest
1508    {
1509        #[inline(always)]
1510        fn new_empty() -> Self {
1511            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
1512        }
1513
1514        #[inline]
1515        unsafe fn decode(
1516            &mut self,
1517            decoder: &mut fidl::encoding::Decoder<'_, D>,
1518            offset: usize,
1519            _depth: fidl::encoding::Depth,
1520        ) -> fidl::Result<()> {
1521            decoder.debug_check_bounds::<Self>(offset);
1522            // Verify that padding bytes are zero.
1523            fidl::decode!(
1524                fidl::encoding::BoundedString<256>,
1525                D,
1526                &mut self.name,
1527                decoder,
1528                offset + 0,
1529                _depth
1530            )?;
1531            Ok(())
1532        }
1533    }
1534
1535    impl fidl::encoding::ValueTypeMarker for NetworkAttachEndpointResponse {
1536        type Borrowed<'a> = &'a Self;
1537        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1538            value
1539        }
1540    }
1541
1542    unsafe impl fidl::encoding::TypeMarker for NetworkAttachEndpointResponse {
1543        type Owned = Self;
1544
1545        #[inline(always)]
1546        fn inline_align(_context: fidl::encoding::Context) -> usize {
1547            4
1548        }
1549
1550        #[inline(always)]
1551        fn inline_size(_context: fidl::encoding::Context) -> usize {
1552            4
1553        }
1554        #[inline(always)]
1555        fn encode_is_copy() -> bool {
1556            true
1557        }
1558
1559        #[inline(always)]
1560        fn decode_is_copy() -> bool {
1561            true
1562        }
1563    }
1564
1565    unsafe impl<D: fidl::encoding::ResourceDialect>
1566        fidl::encoding::Encode<NetworkAttachEndpointResponse, D>
1567        for &NetworkAttachEndpointResponse
1568    {
1569        #[inline]
1570        unsafe fn encode(
1571            self,
1572            encoder: &mut fidl::encoding::Encoder<'_, D>,
1573            offset: usize,
1574            _depth: fidl::encoding::Depth,
1575        ) -> fidl::Result<()> {
1576            encoder.debug_check_bounds::<NetworkAttachEndpointResponse>(offset);
1577            unsafe {
1578                // Copy the object into the buffer.
1579                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1580                (buf_ptr as *mut NetworkAttachEndpointResponse)
1581                    .write_unaligned((self as *const NetworkAttachEndpointResponse).read());
1582                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1583                // done second because the memcpy will write garbage to these bytes.
1584            }
1585            Ok(())
1586        }
1587    }
1588    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1589        fidl::encoding::Encode<NetworkAttachEndpointResponse, D> for (T0,)
1590    {
1591        #[inline]
1592        unsafe fn encode(
1593            self,
1594            encoder: &mut fidl::encoding::Encoder<'_, D>,
1595            offset: usize,
1596            depth: fidl::encoding::Depth,
1597        ) -> fidl::Result<()> {
1598            encoder.debug_check_bounds::<NetworkAttachEndpointResponse>(offset);
1599            // Zero out padding regions. There's no need to apply masks
1600            // because the unmasked parts will be overwritten by fields.
1601            // Write the fields.
1602            self.0.encode(encoder, offset + 0, depth)?;
1603            Ok(())
1604        }
1605    }
1606
1607    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1608        for NetworkAttachEndpointResponse
1609    {
1610        #[inline(always)]
1611        fn new_empty() -> Self {
1612            Self { status: fidl::new_empty!(i32, D) }
1613        }
1614
1615        #[inline]
1616        unsafe fn decode(
1617            &mut self,
1618            decoder: &mut fidl::encoding::Decoder<'_, D>,
1619            offset: usize,
1620            _depth: fidl::encoding::Depth,
1621        ) -> fidl::Result<()> {
1622            decoder.debug_check_bounds::<Self>(offset);
1623            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1624            // Verify that padding bytes are zero.
1625            // Copy from the buffer into the object.
1626            unsafe {
1627                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1628            }
1629            Ok(())
1630        }
1631    }
1632
1633    impl fidl::encoding::ValueTypeMarker for NetworkContextSetupRequest {
1634        type Borrowed<'a> = &'a Self;
1635        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1636            value
1637        }
1638    }
1639
1640    unsafe impl fidl::encoding::TypeMarker for NetworkContextSetupRequest {
1641        type Owned = Self;
1642
1643        #[inline(always)]
1644        fn inline_align(_context: fidl::encoding::Context) -> usize {
1645            8
1646        }
1647
1648        #[inline(always)]
1649        fn inline_size(_context: fidl::encoding::Context) -> usize {
1650            16
1651        }
1652    }
1653
1654    unsafe impl<D: fidl::encoding::ResourceDialect>
1655        fidl::encoding::Encode<NetworkContextSetupRequest, D> for &NetworkContextSetupRequest
1656    {
1657        #[inline]
1658        unsafe fn encode(
1659            self,
1660            encoder: &mut fidl::encoding::Encoder<'_, D>,
1661            offset: usize,
1662            _depth: fidl::encoding::Depth,
1663        ) -> fidl::Result<()> {
1664            encoder.debug_check_bounds::<NetworkContextSetupRequest>(offset);
1665            // Delegate to tuple encoding.
1666            fidl::encoding::Encode::<NetworkContextSetupRequest, D>::encode(
1667                (
1668                    <fidl::encoding::UnboundedVector<NetworkSetup> as fidl::encoding::ValueTypeMarker>::borrow(&self.networks),
1669                ),
1670                encoder, offset, _depth
1671            )
1672        }
1673    }
1674    unsafe impl<
1675        D: fidl::encoding::ResourceDialect,
1676        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<NetworkSetup>, D>,
1677    > fidl::encoding::Encode<NetworkContextSetupRequest, D> for (T0,)
1678    {
1679        #[inline]
1680        unsafe fn encode(
1681            self,
1682            encoder: &mut fidl::encoding::Encoder<'_, D>,
1683            offset: usize,
1684            depth: fidl::encoding::Depth,
1685        ) -> fidl::Result<()> {
1686            encoder.debug_check_bounds::<NetworkContextSetupRequest>(offset);
1687            // Zero out padding regions. There's no need to apply masks
1688            // because the unmasked parts will be overwritten by fields.
1689            // Write the fields.
1690            self.0.encode(encoder, offset + 0, depth)?;
1691            Ok(())
1692        }
1693    }
1694
1695    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1696        for NetworkContextSetupRequest
1697    {
1698        #[inline(always)]
1699        fn new_empty() -> Self {
1700            Self { networks: fidl::new_empty!(fidl::encoding::UnboundedVector<NetworkSetup>, D) }
1701        }
1702
1703        #[inline]
1704        unsafe fn decode(
1705            &mut self,
1706            decoder: &mut fidl::encoding::Decoder<'_, D>,
1707            offset: usize,
1708            _depth: fidl::encoding::Depth,
1709        ) -> fidl::Result<()> {
1710            decoder.debug_check_bounds::<Self>(offset);
1711            // Verify that padding bytes are zero.
1712            fidl::decode!(
1713                fidl::encoding::UnboundedVector<NetworkSetup>,
1714                D,
1715                &mut self.networks,
1716                decoder,
1717                offset + 0,
1718                _depth
1719            )?;
1720            Ok(())
1721        }
1722    }
1723
1724    impl fidl::encoding::ValueTypeMarker for NetworkGetConfigResponse {
1725        type Borrowed<'a> = &'a Self;
1726        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1727            value
1728        }
1729    }
1730
1731    unsafe impl fidl::encoding::TypeMarker for NetworkGetConfigResponse {
1732        type Owned = Self;
1733
1734        #[inline(always)]
1735        fn inline_align(_context: fidl::encoding::Context) -> usize {
1736            8
1737        }
1738
1739        #[inline(always)]
1740        fn inline_size(_context: fidl::encoding::Context) -> usize {
1741            16
1742        }
1743    }
1744
1745    unsafe impl<D: fidl::encoding::ResourceDialect>
1746        fidl::encoding::Encode<NetworkGetConfigResponse, D> for &NetworkGetConfigResponse
1747    {
1748        #[inline]
1749        unsafe fn encode(
1750            self,
1751            encoder: &mut fidl::encoding::Encoder<'_, D>,
1752            offset: usize,
1753            _depth: fidl::encoding::Depth,
1754        ) -> fidl::Result<()> {
1755            encoder.debug_check_bounds::<NetworkGetConfigResponse>(offset);
1756            // Delegate to tuple encoding.
1757            fidl::encoding::Encode::<NetworkGetConfigResponse, D>::encode(
1758                (<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
1759                encoder,
1760                offset,
1761                _depth,
1762            )
1763        }
1764    }
1765    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkConfig, D>>
1766        fidl::encoding::Encode<NetworkGetConfigResponse, D> for (T0,)
1767    {
1768        #[inline]
1769        unsafe fn encode(
1770            self,
1771            encoder: &mut fidl::encoding::Encoder<'_, D>,
1772            offset: usize,
1773            depth: fidl::encoding::Depth,
1774        ) -> fidl::Result<()> {
1775            encoder.debug_check_bounds::<NetworkGetConfigResponse>(offset);
1776            // Zero out padding regions. There's no need to apply masks
1777            // because the unmasked parts will be overwritten by fields.
1778            // Write the fields.
1779            self.0.encode(encoder, offset + 0, depth)?;
1780            Ok(())
1781        }
1782    }
1783
1784    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1785        for NetworkGetConfigResponse
1786    {
1787        #[inline(always)]
1788        fn new_empty() -> Self {
1789            Self { config: fidl::new_empty!(NetworkConfig, D) }
1790        }
1791
1792        #[inline]
1793        unsafe fn decode(
1794            &mut self,
1795            decoder: &mut fidl::encoding::Decoder<'_, D>,
1796            offset: usize,
1797            _depth: fidl::encoding::Depth,
1798        ) -> fidl::Result<()> {
1799            decoder.debug_check_bounds::<Self>(offset);
1800            // Verify that padding bytes are zero.
1801            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
1802            Ok(())
1803        }
1804    }
1805
1806    impl fidl::encoding::ValueTypeMarker for NetworkGetNameResponse {
1807        type Borrowed<'a> = &'a Self;
1808        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1809            value
1810        }
1811    }
1812
1813    unsafe impl fidl::encoding::TypeMarker for NetworkGetNameResponse {
1814        type Owned = Self;
1815
1816        #[inline(always)]
1817        fn inline_align(_context: fidl::encoding::Context) -> usize {
1818            8
1819        }
1820
1821        #[inline(always)]
1822        fn inline_size(_context: fidl::encoding::Context) -> usize {
1823            16
1824        }
1825    }
1826
1827    unsafe impl<D: fidl::encoding::ResourceDialect>
1828        fidl::encoding::Encode<NetworkGetNameResponse, D> for &NetworkGetNameResponse
1829    {
1830        #[inline]
1831        unsafe fn encode(
1832            self,
1833            encoder: &mut fidl::encoding::Encoder<'_, D>,
1834            offset: usize,
1835            _depth: fidl::encoding::Depth,
1836        ) -> fidl::Result<()> {
1837            encoder.debug_check_bounds::<NetworkGetNameResponse>(offset);
1838            // Delegate to tuple encoding.
1839            fidl::encoding::Encode::<NetworkGetNameResponse, D>::encode(
1840                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
1841                    &self.name,
1842                ),),
1843                encoder,
1844                offset,
1845                _depth,
1846            )
1847        }
1848    }
1849    unsafe impl<
1850        D: fidl::encoding::ResourceDialect,
1851        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
1852    > fidl::encoding::Encode<NetworkGetNameResponse, D> for (T0,)
1853    {
1854        #[inline]
1855        unsafe fn encode(
1856            self,
1857            encoder: &mut fidl::encoding::Encoder<'_, D>,
1858            offset: usize,
1859            depth: fidl::encoding::Depth,
1860        ) -> fidl::Result<()> {
1861            encoder.debug_check_bounds::<NetworkGetNameResponse>(offset);
1862            // Zero out padding regions. There's no need to apply masks
1863            // because the unmasked parts will be overwritten by fields.
1864            // Write the fields.
1865            self.0.encode(encoder, offset + 0, depth)?;
1866            Ok(())
1867        }
1868    }
1869
1870    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1871        for NetworkGetNameResponse
1872    {
1873        #[inline(always)]
1874        fn new_empty() -> Self {
1875            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
1876        }
1877
1878        #[inline]
1879        unsafe fn decode(
1880            &mut self,
1881            decoder: &mut fidl::encoding::Decoder<'_, D>,
1882            offset: usize,
1883            _depth: fidl::encoding::Depth,
1884        ) -> fidl::Result<()> {
1885            decoder.debug_check_bounds::<Self>(offset);
1886            // Verify that padding bytes are zero.
1887            fidl::decode!(
1888                fidl::encoding::BoundedString<256>,
1889                D,
1890                &mut self.name,
1891                decoder,
1892                offset + 0,
1893                _depth
1894            )?;
1895            Ok(())
1896        }
1897    }
1898
1899    impl fidl::encoding::ValueTypeMarker for NetworkManagerCreateNetworkRequest {
1900        type Borrowed<'a> = &'a Self;
1901        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1902            value
1903        }
1904    }
1905
1906    unsafe impl fidl::encoding::TypeMarker for NetworkManagerCreateNetworkRequest {
1907        type Owned = Self;
1908
1909        #[inline(always)]
1910        fn inline_align(_context: fidl::encoding::Context) -> usize {
1911            8
1912        }
1913
1914        #[inline(always)]
1915        fn inline_size(_context: fidl::encoding::Context) -> usize {
1916            32
1917        }
1918    }
1919
1920    unsafe impl<D: fidl::encoding::ResourceDialect>
1921        fidl::encoding::Encode<NetworkManagerCreateNetworkRequest, D>
1922        for &NetworkManagerCreateNetworkRequest
1923    {
1924        #[inline]
1925        unsafe fn encode(
1926            self,
1927            encoder: &mut fidl::encoding::Encoder<'_, D>,
1928            offset: usize,
1929            _depth: fidl::encoding::Depth,
1930        ) -> fidl::Result<()> {
1931            encoder.debug_check_bounds::<NetworkManagerCreateNetworkRequest>(offset);
1932            // Delegate to tuple encoding.
1933            fidl::encoding::Encode::<NetworkManagerCreateNetworkRequest, D>::encode(
1934                (
1935                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
1936                        &self.name,
1937                    ),
1938                    <NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1939                ),
1940                encoder,
1941                offset,
1942                _depth,
1943            )
1944        }
1945    }
1946    unsafe impl<
1947        D: fidl::encoding::ResourceDialect,
1948        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
1949        T1: fidl::encoding::Encode<NetworkConfig, D>,
1950    > fidl::encoding::Encode<NetworkManagerCreateNetworkRequest, D> for (T0, T1)
1951    {
1952        #[inline]
1953        unsafe fn encode(
1954            self,
1955            encoder: &mut fidl::encoding::Encoder<'_, D>,
1956            offset: usize,
1957            depth: fidl::encoding::Depth,
1958        ) -> fidl::Result<()> {
1959            encoder.debug_check_bounds::<NetworkManagerCreateNetworkRequest>(offset);
1960            // Zero out padding regions. There's no need to apply masks
1961            // because the unmasked parts will be overwritten by fields.
1962            // Write the fields.
1963            self.0.encode(encoder, offset + 0, depth)?;
1964            self.1.encode(encoder, offset + 16, depth)?;
1965            Ok(())
1966        }
1967    }
1968
1969    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1970        for NetworkManagerCreateNetworkRequest
1971    {
1972        #[inline(always)]
1973        fn new_empty() -> Self {
1974            Self {
1975                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
1976                config: fidl::new_empty!(NetworkConfig, D),
1977            }
1978        }
1979
1980        #[inline]
1981        unsafe fn decode(
1982            &mut self,
1983            decoder: &mut fidl::encoding::Decoder<'_, D>,
1984            offset: usize,
1985            _depth: fidl::encoding::Depth,
1986        ) -> fidl::Result<()> {
1987            decoder.debug_check_bounds::<Self>(offset);
1988            // Verify that padding bytes are zero.
1989            fidl::decode!(
1990                fidl::encoding::BoundedString<256>,
1991                D,
1992                &mut self.name,
1993                decoder,
1994                offset + 0,
1995                _depth
1996            )?;
1997            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
1998            Ok(())
1999        }
2000    }
2001
2002    impl fidl::encoding::ValueTypeMarker for NetworkManagerGetNetworkRequest {
2003        type Borrowed<'a> = &'a Self;
2004        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2005            value
2006        }
2007    }
2008
2009    unsafe impl fidl::encoding::TypeMarker for NetworkManagerGetNetworkRequest {
2010        type Owned = Self;
2011
2012        #[inline(always)]
2013        fn inline_align(_context: fidl::encoding::Context) -> usize {
2014            8
2015        }
2016
2017        #[inline(always)]
2018        fn inline_size(_context: fidl::encoding::Context) -> usize {
2019            16
2020        }
2021    }
2022
2023    unsafe impl<D: fidl::encoding::ResourceDialect>
2024        fidl::encoding::Encode<NetworkManagerGetNetworkRequest, D>
2025        for &NetworkManagerGetNetworkRequest
2026    {
2027        #[inline]
2028        unsafe fn encode(
2029            self,
2030            encoder: &mut fidl::encoding::Encoder<'_, D>,
2031            offset: usize,
2032            _depth: fidl::encoding::Depth,
2033        ) -> fidl::Result<()> {
2034            encoder.debug_check_bounds::<NetworkManagerGetNetworkRequest>(offset);
2035            // Delegate to tuple encoding.
2036            fidl::encoding::Encode::<NetworkManagerGetNetworkRequest, D>::encode(
2037                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2038                    &self.name,
2039                ),),
2040                encoder,
2041                offset,
2042                _depth,
2043            )
2044        }
2045    }
2046    unsafe impl<
2047        D: fidl::encoding::ResourceDialect,
2048        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
2049    > fidl::encoding::Encode<NetworkManagerGetNetworkRequest, D> for (T0,)
2050    {
2051        #[inline]
2052        unsafe fn encode(
2053            self,
2054            encoder: &mut fidl::encoding::Encoder<'_, D>,
2055            offset: usize,
2056            depth: fidl::encoding::Depth,
2057        ) -> fidl::Result<()> {
2058            encoder.debug_check_bounds::<NetworkManagerGetNetworkRequest>(offset);
2059            // Zero out padding regions. There's no need to apply masks
2060            // because the unmasked parts will be overwritten by fields.
2061            // Write the fields.
2062            self.0.encode(encoder, offset + 0, depth)?;
2063            Ok(())
2064        }
2065    }
2066
2067    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2068        for NetworkManagerGetNetworkRequest
2069    {
2070        #[inline(always)]
2071        fn new_empty() -> Self {
2072            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
2073        }
2074
2075        #[inline]
2076        unsafe fn decode(
2077            &mut self,
2078            decoder: &mut fidl::encoding::Decoder<'_, D>,
2079            offset: usize,
2080            _depth: fidl::encoding::Depth,
2081        ) -> fidl::Result<()> {
2082            decoder.debug_check_bounds::<Self>(offset);
2083            // Verify that padding bytes are zero.
2084            fidl::decode!(
2085                fidl::encoding::BoundedString<256>,
2086                D,
2087                &mut self.name,
2088                decoder,
2089                offset + 0,
2090                _depth
2091            )?;
2092            Ok(())
2093        }
2094    }
2095
2096    impl fidl::encoding::ValueTypeMarker for NetworkManagerListNetworksResponse {
2097        type Borrowed<'a> = &'a Self;
2098        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2099            value
2100        }
2101    }
2102
2103    unsafe impl fidl::encoding::TypeMarker for NetworkManagerListNetworksResponse {
2104        type Owned = Self;
2105
2106        #[inline(always)]
2107        fn inline_align(_context: fidl::encoding::Context) -> usize {
2108            8
2109        }
2110
2111        #[inline(always)]
2112        fn inline_size(_context: fidl::encoding::Context) -> usize {
2113            16
2114        }
2115    }
2116
2117    unsafe impl<D: fidl::encoding::ResourceDialect>
2118        fidl::encoding::Encode<NetworkManagerListNetworksResponse, D>
2119        for &NetworkManagerListNetworksResponse
2120    {
2121        #[inline]
2122        unsafe fn encode(
2123            self,
2124            encoder: &mut fidl::encoding::Encoder<'_, D>,
2125            offset: usize,
2126            _depth: fidl::encoding::Depth,
2127        ) -> fidl::Result<()> {
2128            encoder.debug_check_bounds::<NetworkManagerListNetworksResponse>(offset);
2129            // Delegate to tuple encoding.
2130            fidl::encoding::Encode::<NetworkManagerListNetworksResponse, D>::encode(
2131                (
2132                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.nets),
2133                ),
2134                encoder, offset, _depth
2135            )
2136        }
2137    }
2138    unsafe impl<
2139        D: fidl::encoding::ResourceDialect,
2140        T0: fidl::encoding::Encode<
2141                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
2142                D,
2143            >,
2144    > fidl::encoding::Encode<NetworkManagerListNetworksResponse, D> for (T0,)
2145    {
2146        #[inline]
2147        unsafe fn encode(
2148            self,
2149            encoder: &mut fidl::encoding::Encoder<'_, D>,
2150            offset: usize,
2151            depth: fidl::encoding::Depth,
2152        ) -> fidl::Result<()> {
2153            encoder.debug_check_bounds::<NetworkManagerListNetworksResponse>(offset);
2154            // Zero out padding regions. There's no need to apply masks
2155            // because the unmasked parts will be overwritten by fields.
2156            // Write the fields.
2157            self.0.encode(encoder, offset + 0, depth)?;
2158            Ok(())
2159        }
2160    }
2161
2162    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2163        for NetworkManagerListNetworksResponse
2164    {
2165        #[inline(always)]
2166        fn new_empty() -> Self {
2167            Self {
2168                nets: fidl::new_empty!(
2169                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
2170                    D
2171                ),
2172            }
2173        }
2174
2175        #[inline]
2176        unsafe fn decode(
2177            &mut self,
2178            decoder: &mut fidl::encoding::Decoder<'_, D>,
2179            offset: usize,
2180            _depth: fidl::encoding::Depth,
2181        ) -> fidl::Result<()> {
2182            decoder.debug_check_bounds::<Self>(offset);
2183            // Verify that padding bytes are zero.
2184            fidl::decode!(
2185                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<256>>,
2186                D,
2187                &mut self.nets,
2188                decoder,
2189                offset + 0,
2190                _depth
2191            )?;
2192            Ok(())
2193        }
2194    }
2195
2196    impl fidl::encoding::ValueTypeMarker for NetworkRemoveEndpointRequest {
2197        type Borrowed<'a> = &'a Self;
2198        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2199            value
2200        }
2201    }
2202
2203    unsafe impl fidl::encoding::TypeMarker for NetworkRemoveEndpointRequest {
2204        type Owned = Self;
2205
2206        #[inline(always)]
2207        fn inline_align(_context: fidl::encoding::Context) -> usize {
2208            8
2209        }
2210
2211        #[inline(always)]
2212        fn inline_size(_context: fidl::encoding::Context) -> usize {
2213            16
2214        }
2215    }
2216
2217    unsafe impl<D: fidl::encoding::ResourceDialect>
2218        fidl::encoding::Encode<NetworkRemoveEndpointRequest, D> for &NetworkRemoveEndpointRequest
2219    {
2220        #[inline]
2221        unsafe fn encode(
2222            self,
2223            encoder: &mut fidl::encoding::Encoder<'_, D>,
2224            offset: usize,
2225            _depth: fidl::encoding::Depth,
2226        ) -> fidl::Result<()> {
2227            encoder.debug_check_bounds::<NetworkRemoveEndpointRequest>(offset);
2228            // Delegate to tuple encoding.
2229            fidl::encoding::Encode::<NetworkRemoveEndpointRequest, D>::encode(
2230                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2231                    &self.name,
2232                ),),
2233                encoder,
2234                offset,
2235                _depth,
2236            )
2237        }
2238    }
2239    unsafe impl<
2240        D: fidl::encoding::ResourceDialect,
2241        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
2242    > fidl::encoding::Encode<NetworkRemoveEndpointRequest, D> for (T0,)
2243    {
2244        #[inline]
2245        unsafe fn encode(
2246            self,
2247            encoder: &mut fidl::encoding::Encoder<'_, D>,
2248            offset: usize,
2249            depth: fidl::encoding::Depth,
2250        ) -> fidl::Result<()> {
2251            encoder.debug_check_bounds::<NetworkRemoveEndpointRequest>(offset);
2252            // Zero out padding regions. There's no need to apply masks
2253            // because the unmasked parts will be overwritten by fields.
2254            // Write the fields.
2255            self.0.encode(encoder, offset + 0, depth)?;
2256            Ok(())
2257        }
2258    }
2259
2260    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2261        for NetworkRemoveEndpointRequest
2262    {
2263        #[inline(always)]
2264        fn new_empty() -> Self {
2265            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
2266        }
2267
2268        #[inline]
2269        unsafe fn decode(
2270            &mut self,
2271            decoder: &mut fidl::encoding::Decoder<'_, D>,
2272            offset: usize,
2273            _depth: fidl::encoding::Depth,
2274        ) -> fidl::Result<()> {
2275            decoder.debug_check_bounds::<Self>(offset);
2276            // Verify that padding bytes are zero.
2277            fidl::decode!(
2278                fidl::encoding::BoundedString<256>,
2279                D,
2280                &mut self.name,
2281                decoder,
2282                offset + 0,
2283                _depth
2284            )?;
2285            Ok(())
2286        }
2287    }
2288
2289    impl fidl::encoding::ValueTypeMarker for NetworkRemoveEndpointResponse {
2290        type Borrowed<'a> = &'a Self;
2291        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2292            value
2293        }
2294    }
2295
2296    unsafe impl fidl::encoding::TypeMarker for NetworkRemoveEndpointResponse {
2297        type Owned = Self;
2298
2299        #[inline(always)]
2300        fn inline_align(_context: fidl::encoding::Context) -> usize {
2301            4
2302        }
2303
2304        #[inline(always)]
2305        fn inline_size(_context: fidl::encoding::Context) -> usize {
2306            4
2307        }
2308        #[inline(always)]
2309        fn encode_is_copy() -> bool {
2310            true
2311        }
2312
2313        #[inline(always)]
2314        fn decode_is_copy() -> bool {
2315            true
2316        }
2317    }
2318
2319    unsafe impl<D: fidl::encoding::ResourceDialect>
2320        fidl::encoding::Encode<NetworkRemoveEndpointResponse, D>
2321        for &NetworkRemoveEndpointResponse
2322    {
2323        #[inline]
2324        unsafe fn encode(
2325            self,
2326            encoder: &mut fidl::encoding::Encoder<'_, D>,
2327            offset: usize,
2328            _depth: fidl::encoding::Depth,
2329        ) -> fidl::Result<()> {
2330            encoder.debug_check_bounds::<NetworkRemoveEndpointResponse>(offset);
2331            unsafe {
2332                // Copy the object into the buffer.
2333                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2334                (buf_ptr as *mut NetworkRemoveEndpointResponse)
2335                    .write_unaligned((self as *const NetworkRemoveEndpointResponse).read());
2336                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2337                // done second because the memcpy will write garbage to these bytes.
2338            }
2339            Ok(())
2340        }
2341    }
2342    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2343        fidl::encoding::Encode<NetworkRemoveEndpointResponse, D> for (T0,)
2344    {
2345        #[inline]
2346        unsafe fn encode(
2347            self,
2348            encoder: &mut fidl::encoding::Encoder<'_, D>,
2349            offset: usize,
2350            depth: fidl::encoding::Depth,
2351        ) -> fidl::Result<()> {
2352            encoder.debug_check_bounds::<NetworkRemoveEndpointResponse>(offset);
2353            // Zero out padding regions. There's no need to apply masks
2354            // because the unmasked parts will be overwritten by fields.
2355            // Write the fields.
2356            self.0.encode(encoder, offset + 0, depth)?;
2357            Ok(())
2358        }
2359    }
2360
2361    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2362        for NetworkRemoveEndpointResponse
2363    {
2364        #[inline(always)]
2365        fn new_empty() -> Self {
2366            Self { status: fidl::new_empty!(i32, D) }
2367        }
2368
2369        #[inline]
2370        unsafe fn decode(
2371            &mut self,
2372            decoder: &mut fidl::encoding::Decoder<'_, D>,
2373            offset: usize,
2374            _depth: fidl::encoding::Depth,
2375        ) -> fidl::Result<()> {
2376            decoder.debug_check_bounds::<Self>(offset);
2377            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2378            // Verify that padding bytes are zero.
2379            // Copy from the buffer into the object.
2380            unsafe {
2381                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2382            }
2383            Ok(())
2384        }
2385    }
2386
2387    impl fidl::encoding::ValueTypeMarker for NetworkSetConfigRequest {
2388        type Borrowed<'a> = &'a Self;
2389        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2390            value
2391        }
2392    }
2393
2394    unsafe impl fidl::encoding::TypeMarker for NetworkSetConfigRequest {
2395        type Owned = Self;
2396
2397        #[inline(always)]
2398        fn inline_align(_context: fidl::encoding::Context) -> usize {
2399            8
2400        }
2401
2402        #[inline(always)]
2403        fn inline_size(_context: fidl::encoding::Context) -> usize {
2404            16
2405        }
2406    }
2407
2408    unsafe impl<D: fidl::encoding::ResourceDialect>
2409        fidl::encoding::Encode<NetworkSetConfigRequest, D> for &NetworkSetConfigRequest
2410    {
2411        #[inline]
2412        unsafe fn encode(
2413            self,
2414            encoder: &mut fidl::encoding::Encoder<'_, D>,
2415            offset: usize,
2416            _depth: fidl::encoding::Depth,
2417        ) -> fidl::Result<()> {
2418            encoder.debug_check_bounds::<NetworkSetConfigRequest>(offset);
2419            // Delegate to tuple encoding.
2420            fidl::encoding::Encode::<NetworkSetConfigRequest, D>::encode(
2421                (<NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
2422                encoder,
2423                offset,
2424                _depth,
2425            )
2426        }
2427    }
2428    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkConfig, D>>
2429        fidl::encoding::Encode<NetworkSetConfigRequest, D> for (T0,)
2430    {
2431        #[inline]
2432        unsafe fn encode(
2433            self,
2434            encoder: &mut fidl::encoding::Encoder<'_, D>,
2435            offset: usize,
2436            depth: fidl::encoding::Depth,
2437        ) -> fidl::Result<()> {
2438            encoder.debug_check_bounds::<NetworkSetConfigRequest>(offset);
2439            // Zero out padding regions. There's no need to apply masks
2440            // because the unmasked parts will be overwritten by fields.
2441            // Write the fields.
2442            self.0.encode(encoder, offset + 0, depth)?;
2443            Ok(())
2444        }
2445    }
2446
2447    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2448        for NetworkSetConfigRequest
2449    {
2450        #[inline(always)]
2451        fn new_empty() -> Self {
2452            Self { config: fidl::new_empty!(NetworkConfig, D) }
2453        }
2454
2455        #[inline]
2456        unsafe fn decode(
2457            &mut self,
2458            decoder: &mut fidl::encoding::Decoder<'_, D>,
2459            offset: usize,
2460            _depth: fidl::encoding::Depth,
2461        ) -> fidl::Result<()> {
2462            decoder.debug_check_bounds::<Self>(offset);
2463            // Verify that padding bytes are zero.
2464            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
2465            Ok(())
2466        }
2467    }
2468
2469    impl fidl::encoding::ValueTypeMarker for NetworkSetConfigResponse {
2470        type Borrowed<'a> = &'a Self;
2471        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2472            value
2473        }
2474    }
2475
2476    unsafe impl fidl::encoding::TypeMarker for NetworkSetConfigResponse {
2477        type Owned = Self;
2478
2479        #[inline(always)]
2480        fn inline_align(_context: fidl::encoding::Context) -> usize {
2481            4
2482        }
2483
2484        #[inline(always)]
2485        fn inline_size(_context: fidl::encoding::Context) -> usize {
2486            4
2487        }
2488        #[inline(always)]
2489        fn encode_is_copy() -> bool {
2490            true
2491        }
2492
2493        #[inline(always)]
2494        fn decode_is_copy() -> bool {
2495            true
2496        }
2497    }
2498
2499    unsafe impl<D: fidl::encoding::ResourceDialect>
2500        fidl::encoding::Encode<NetworkSetConfigResponse, D> for &NetworkSetConfigResponse
2501    {
2502        #[inline]
2503        unsafe fn encode(
2504            self,
2505            encoder: &mut fidl::encoding::Encoder<'_, D>,
2506            offset: usize,
2507            _depth: fidl::encoding::Depth,
2508        ) -> fidl::Result<()> {
2509            encoder.debug_check_bounds::<NetworkSetConfigResponse>(offset);
2510            unsafe {
2511                // Copy the object into the buffer.
2512                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2513                (buf_ptr as *mut NetworkSetConfigResponse)
2514                    .write_unaligned((self as *const NetworkSetConfigResponse).read());
2515                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2516                // done second because the memcpy will write garbage to these bytes.
2517            }
2518            Ok(())
2519        }
2520    }
2521    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2522        fidl::encoding::Encode<NetworkSetConfigResponse, D> for (T0,)
2523    {
2524        #[inline]
2525        unsafe fn encode(
2526            self,
2527            encoder: &mut fidl::encoding::Encoder<'_, D>,
2528            offset: usize,
2529            depth: fidl::encoding::Depth,
2530        ) -> fidl::Result<()> {
2531            encoder.debug_check_bounds::<NetworkSetConfigResponse>(offset);
2532            // Zero out padding regions. There's no need to apply masks
2533            // because the unmasked parts will be overwritten by fields.
2534            // Write the fields.
2535            self.0.encode(encoder, offset + 0, depth)?;
2536            Ok(())
2537        }
2538    }
2539
2540    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2541        for NetworkSetConfigResponse
2542    {
2543        #[inline(always)]
2544        fn new_empty() -> Self {
2545            Self { status: fidl::new_empty!(i32, D) }
2546        }
2547
2548        #[inline]
2549        unsafe fn decode(
2550            &mut self,
2551            decoder: &mut fidl::encoding::Decoder<'_, D>,
2552            offset: usize,
2553            _depth: fidl::encoding::Depth,
2554        ) -> fidl::Result<()> {
2555            decoder.debug_check_bounds::<Self>(offset);
2556            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2557            // Verify that padding bytes are zero.
2558            // Copy from the buffer into the object.
2559            unsafe {
2560                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2561            }
2562            Ok(())
2563        }
2564    }
2565
2566    impl fidl::encoding::ValueTypeMarker for NetworkSetup {
2567        type Borrowed<'a> = &'a Self;
2568        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2569            value
2570        }
2571    }
2572
2573    unsafe impl fidl::encoding::TypeMarker for NetworkSetup {
2574        type Owned = Self;
2575
2576        #[inline(always)]
2577        fn inline_align(_context: fidl::encoding::Context) -> usize {
2578            8
2579        }
2580
2581        #[inline(always)]
2582        fn inline_size(_context: fidl::encoding::Context) -> usize {
2583            48
2584        }
2585    }
2586
2587    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkSetup, D>
2588        for &NetworkSetup
2589    {
2590        #[inline]
2591        unsafe fn encode(
2592            self,
2593            encoder: &mut fidl::encoding::Encoder<'_, D>,
2594            offset: usize,
2595            _depth: fidl::encoding::Depth,
2596        ) -> fidl::Result<()> {
2597            encoder.debug_check_bounds::<NetworkSetup>(offset);
2598            // Delegate to tuple encoding.
2599            fidl::encoding::Encode::<NetworkSetup, D>::encode(
2600                (
2601                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2602                    <NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2603                    <fidl::encoding::UnboundedVector<EndpointSetup> as fidl::encoding::ValueTypeMarker>::borrow(&self.endpoints),
2604                ),
2605                encoder, offset, _depth
2606            )
2607        }
2608    }
2609    unsafe impl<
2610        D: fidl::encoding::ResourceDialect,
2611        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
2612        T1: fidl::encoding::Encode<NetworkConfig, D>,
2613        T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<EndpointSetup>, D>,
2614    > fidl::encoding::Encode<NetworkSetup, D> for (T0, T1, T2)
2615    {
2616        #[inline]
2617        unsafe fn encode(
2618            self,
2619            encoder: &mut fidl::encoding::Encoder<'_, D>,
2620            offset: usize,
2621            depth: fidl::encoding::Depth,
2622        ) -> fidl::Result<()> {
2623            encoder.debug_check_bounds::<NetworkSetup>(offset);
2624            // Zero out padding regions. There's no need to apply masks
2625            // because the unmasked parts will be overwritten by fields.
2626            // Write the fields.
2627            self.0.encode(encoder, offset + 0, depth)?;
2628            self.1.encode(encoder, offset + 16, depth)?;
2629            self.2.encode(encoder, offset + 32, depth)?;
2630            Ok(())
2631        }
2632    }
2633
2634    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkSetup {
2635        #[inline(always)]
2636        fn new_empty() -> Self {
2637            Self {
2638                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
2639                config: fidl::new_empty!(NetworkConfig, D),
2640                endpoints: fidl::new_empty!(fidl::encoding::UnboundedVector<EndpointSetup>, D),
2641            }
2642        }
2643
2644        #[inline]
2645        unsafe fn decode(
2646            &mut self,
2647            decoder: &mut fidl::encoding::Decoder<'_, D>,
2648            offset: usize,
2649            _depth: fidl::encoding::Depth,
2650        ) -> fidl::Result<()> {
2651            decoder.debug_check_bounds::<Self>(offset);
2652            // Verify that padding bytes are zero.
2653            fidl::decode!(
2654                fidl::encoding::BoundedString<256>,
2655                D,
2656                &mut self.name,
2657                decoder,
2658                offset + 0,
2659                _depth
2660            )?;
2661            fidl::decode!(NetworkConfig, D, &mut self.config, decoder, offset + 16, _depth)?;
2662            fidl::decode!(
2663                fidl::encoding::UnboundedVector<EndpointSetup>,
2664                D,
2665                &mut self.endpoints,
2666                decoder,
2667                offset + 32,
2668                _depth
2669            )?;
2670            Ok(())
2671        }
2672    }
2673
2674    impl fidl::encoding::ValueTypeMarker for NetworkStartCaptureRequest {
2675        type Borrowed<'a> = &'a Self;
2676        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2677            value
2678        }
2679    }
2680
2681    unsafe impl fidl::encoding::TypeMarker for NetworkStartCaptureRequest {
2682        type Owned = Self;
2683
2684        #[inline(always)]
2685        fn inline_align(_context: fidl::encoding::Context) -> usize {
2686            8
2687        }
2688
2689        #[inline(always)]
2690        fn inline_size(_context: fidl::encoding::Context) -> usize {
2691            16
2692        }
2693    }
2694
2695    unsafe impl<D: fidl::encoding::ResourceDialect>
2696        fidl::encoding::Encode<NetworkStartCaptureRequest, D> for &NetworkStartCaptureRequest
2697    {
2698        #[inline]
2699        unsafe fn encode(
2700            self,
2701            encoder: &mut fidl::encoding::Encoder<'_, D>,
2702            offset: usize,
2703            _depth: fidl::encoding::Depth,
2704        ) -> fidl::Result<()> {
2705            encoder.debug_check_bounds::<NetworkStartCaptureRequest>(offset);
2706            // Delegate to tuple encoding.
2707            fidl::encoding::Encode::<NetworkStartCaptureRequest, D>::encode(
2708                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2709                    &self.name,
2710                ),),
2711                encoder,
2712                offset,
2713                _depth,
2714            )
2715        }
2716    }
2717    unsafe impl<
2718        D: fidl::encoding::ResourceDialect,
2719        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
2720    > fidl::encoding::Encode<NetworkStartCaptureRequest, D> for (T0,)
2721    {
2722        #[inline]
2723        unsafe fn encode(
2724            self,
2725            encoder: &mut fidl::encoding::Encoder<'_, D>,
2726            offset: usize,
2727            depth: fidl::encoding::Depth,
2728        ) -> fidl::Result<()> {
2729            encoder.debug_check_bounds::<NetworkStartCaptureRequest>(offset);
2730            // Zero out padding regions. There's no need to apply masks
2731            // because the unmasked parts will be overwritten by fields.
2732            // Write the fields.
2733            self.0.encode(encoder, offset + 0, depth)?;
2734            Ok(())
2735        }
2736    }
2737
2738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2739        for NetworkStartCaptureRequest
2740    {
2741        #[inline(always)]
2742        fn new_empty() -> Self {
2743            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
2744        }
2745
2746        #[inline]
2747        unsafe fn decode(
2748            &mut self,
2749            decoder: &mut fidl::encoding::Decoder<'_, D>,
2750            offset: usize,
2751            _depth: fidl::encoding::Depth,
2752        ) -> fidl::Result<()> {
2753            decoder.debug_check_bounds::<Self>(offset);
2754            // Verify that padding bytes are zero.
2755            fidl::decode!(
2756                fidl::encoding::BoundedString<256>,
2757                D,
2758                &mut self.name,
2759                decoder,
2760                offset + 0,
2761                _depth
2762            )?;
2763            Ok(())
2764        }
2765    }
2766
2767    impl fidl::encoding::ValueTypeMarker for NetworkStartCaptureResponse {
2768        type Borrowed<'a> = &'a Self;
2769        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2770            value
2771        }
2772    }
2773
2774    unsafe impl fidl::encoding::TypeMarker for NetworkStartCaptureResponse {
2775        type Owned = Self;
2776
2777        #[inline(always)]
2778        fn inline_align(_context: fidl::encoding::Context) -> usize {
2779            4
2780        }
2781
2782        #[inline(always)]
2783        fn inline_size(_context: fidl::encoding::Context) -> usize {
2784            4
2785        }
2786        #[inline(always)]
2787        fn encode_is_copy() -> bool {
2788            true
2789        }
2790
2791        #[inline(always)]
2792        fn decode_is_copy() -> bool {
2793            true
2794        }
2795    }
2796
2797    unsafe impl<D: fidl::encoding::ResourceDialect>
2798        fidl::encoding::Encode<NetworkStartCaptureResponse, D> for &NetworkStartCaptureResponse
2799    {
2800        #[inline]
2801        unsafe fn encode(
2802            self,
2803            encoder: &mut fidl::encoding::Encoder<'_, D>,
2804            offset: usize,
2805            _depth: fidl::encoding::Depth,
2806        ) -> fidl::Result<()> {
2807            encoder.debug_check_bounds::<NetworkStartCaptureResponse>(offset);
2808            unsafe {
2809                // Copy the object into the buffer.
2810                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2811                (buf_ptr as *mut NetworkStartCaptureResponse)
2812                    .write_unaligned((self as *const NetworkStartCaptureResponse).read());
2813                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2814                // done second because the memcpy will write garbage to these bytes.
2815            }
2816            Ok(())
2817        }
2818    }
2819    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2820        fidl::encoding::Encode<NetworkStartCaptureResponse, D> for (T0,)
2821    {
2822        #[inline]
2823        unsafe fn encode(
2824            self,
2825            encoder: &mut fidl::encoding::Encoder<'_, D>,
2826            offset: usize,
2827            depth: fidl::encoding::Depth,
2828        ) -> fidl::Result<()> {
2829            encoder.debug_check_bounds::<NetworkStartCaptureResponse>(offset);
2830            // Zero out padding regions. There's no need to apply masks
2831            // because the unmasked parts will be overwritten by fields.
2832            // Write the fields.
2833            self.0.encode(encoder, offset + 0, depth)?;
2834            Ok(())
2835        }
2836    }
2837
2838    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2839        for NetworkStartCaptureResponse
2840    {
2841        #[inline(always)]
2842        fn new_empty() -> Self {
2843            Self { status: fidl::new_empty!(i32, D) }
2844        }
2845
2846        #[inline]
2847        unsafe fn decode(
2848            &mut self,
2849            decoder: &mut fidl::encoding::Decoder<'_, D>,
2850            offset: usize,
2851            _depth: fidl::encoding::Depth,
2852        ) -> fidl::Result<()> {
2853            decoder.debug_check_bounds::<Self>(offset);
2854            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2855            // Verify that padding bytes are zero.
2856            // Copy from the buffer into the object.
2857            unsafe {
2858                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2859            }
2860            Ok(())
2861        }
2862    }
2863
2864    impl fidl::encoding::ValueTypeMarker for ReorderConfig {
2865        type Borrowed<'a> = &'a Self;
2866        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2867            value
2868        }
2869    }
2870
2871    unsafe impl fidl::encoding::TypeMarker for ReorderConfig {
2872        type Owned = Self;
2873
2874        #[inline(always)]
2875        fn inline_align(_context: fidl::encoding::Context) -> usize {
2876            8
2877        }
2878
2879        #[inline(always)]
2880        fn inline_size(_context: fidl::encoding::Context) -> usize {
2881            16
2882        }
2883    }
2884
2885    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReorderConfig, D>
2886        for &ReorderConfig
2887    {
2888        #[inline]
2889        unsafe fn encode(
2890            self,
2891            encoder: &mut fidl::encoding::Encoder<'_, D>,
2892            offset: usize,
2893            _depth: fidl::encoding::Depth,
2894        ) -> fidl::Result<()> {
2895            encoder.debug_check_bounds::<ReorderConfig>(offset);
2896            unsafe {
2897                // Copy the object into the buffer.
2898                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2899                (buf_ptr as *mut ReorderConfig)
2900                    .write_unaligned((self as *const ReorderConfig).read());
2901                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2902                // done second because the memcpy will write garbage to these bytes.
2903                let padding_ptr = buf_ptr.offset(0) as *mut u64;
2904                let padding_mask = 0xffffffff00000000u64;
2905                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2906            }
2907            Ok(())
2908        }
2909    }
2910    unsafe impl<
2911        D: fidl::encoding::ResourceDialect,
2912        T0: fidl::encoding::Encode<u32, D>,
2913        T1: fidl::encoding::Encode<u64, D>,
2914    > fidl::encoding::Encode<ReorderConfig, D> for (T0, T1)
2915    {
2916        #[inline]
2917        unsafe fn encode(
2918            self,
2919            encoder: &mut fidl::encoding::Encoder<'_, D>,
2920            offset: usize,
2921            depth: fidl::encoding::Depth,
2922        ) -> fidl::Result<()> {
2923            encoder.debug_check_bounds::<ReorderConfig>(offset);
2924            // Zero out padding regions. There's no need to apply masks
2925            // because the unmasked parts will be overwritten by fields.
2926            unsafe {
2927                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2928                (ptr as *mut u64).write_unaligned(0);
2929            }
2930            // Write the fields.
2931            self.0.encode(encoder, offset + 0, depth)?;
2932            self.1.encode(encoder, offset + 8, depth)?;
2933            Ok(())
2934        }
2935    }
2936
2937    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReorderConfig {
2938        #[inline(always)]
2939        fn new_empty() -> Self {
2940            Self { store_buff: fidl::new_empty!(u32, D), tick: fidl::new_empty!(u64, D) }
2941        }
2942
2943        #[inline]
2944        unsafe fn decode(
2945            &mut self,
2946            decoder: &mut fidl::encoding::Decoder<'_, D>,
2947            offset: usize,
2948            _depth: fidl::encoding::Depth,
2949        ) -> fidl::Result<()> {
2950            decoder.debug_check_bounds::<Self>(offset);
2951            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2952            // Verify that padding bytes are zero.
2953            let ptr = unsafe { buf_ptr.offset(0) };
2954            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2955            let mask = 0xffffffff00000000u64;
2956            let maskedval = padval & mask;
2957            if maskedval != 0 {
2958                return Err(fidl::Error::NonZeroPadding {
2959                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2960                });
2961            }
2962            // Copy from the buffer into the object.
2963            unsafe {
2964                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2965            }
2966            Ok(())
2967        }
2968    }
2969
2970    impl NetworkConfig {
2971        #[inline(always)]
2972        fn max_ordinal_present(&self) -> u64 {
2973            if let Some(_) = self.reorder {
2974                return 3;
2975            }
2976            if let Some(_) = self.packet_loss {
2977                return 2;
2978            }
2979            if let Some(_) = self.latency {
2980                return 1;
2981            }
2982            0
2983        }
2984    }
2985
2986    impl fidl::encoding::ValueTypeMarker for NetworkConfig {
2987        type Borrowed<'a> = &'a Self;
2988        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2989            value
2990        }
2991    }
2992
2993    unsafe impl fidl::encoding::TypeMarker for NetworkConfig {
2994        type Owned = Self;
2995
2996        #[inline(always)]
2997        fn inline_align(_context: fidl::encoding::Context) -> usize {
2998            8
2999        }
3000
3001        #[inline(always)]
3002        fn inline_size(_context: fidl::encoding::Context) -> usize {
3003            16
3004        }
3005    }
3006
3007    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkConfig, D>
3008        for &NetworkConfig
3009    {
3010        unsafe fn encode(
3011            self,
3012            encoder: &mut fidl::encoding::Encoder<'_, D>,
3013            offset: usize,
3014            mut depth: fidl::encoding::Depth,
3015        ) -> fidl::Result<()> {
3016            encoder.debug_check_bounds::<NetworkConfig>(offset);
3017            // Vector header
3018            let max_ordinal: u64 = self.max_ordinal_present();
3019            encoder.write_num(max_ordinal, offset);
3020            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3021            // Calling encoder.out_of_line_offset(0) is not allowed.
3022            if max_ordinal == 0 {
3023                return Ok(());
3024            }
3025            depth.increment()?;
3026            let envelope_size = 8;
3027            let bytes_len = max_ordinal as usize * envelope_size;
3028            #[allow(unused_variables)]
3029            let offset = encoder.out_of_line_offset(bytes_len);
3030            let mut _prev_end_offset: usize = 0;
3031            if 1 > max_ordinal {
3032                return Ok(());
3033            }
3034
3035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3036            // are envelope_size bytes.
3037            let cur_offset: usize = (1 - 1) * envelope_size;
3038
3039            // Zero reserved fields.
3040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3041
3042            // Safety:
3043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3045            //   envelope_size bytes, there is always sufficient room.
3046            fidl::encoding::encode_in_envelope_optional::<LatencyConfig, D>(
3047                self.latency
3048                    .as_ref()
3049                    .map(<LatencyConfig as fidl::encoding::ValueTypeMarker>::borrow),
3050                encoder,
3051                offset + cur_offset,
3052                depth,
3053            )?;
3054
3055            _prev_end_offset = cur_offset + envelope_size;
3056            if 2 > max_ordinal {
3057                return Ok(());
3058            }
3059
3060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3061            // are envelope_size bytes.
3062            let cur_offset: usize = (2 - 1) * envelope_size;
3063
3064            // Zero reserved fields.
3065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3066
3067            // Safety:
3068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3070            //   envelope_size bytes, there is always sufficient room.
3071            fidl::encoding::encode_in_envelope_optional::<LossConfig, D>(
3072                self.packet_loss
3073                    .as_ref()
3074                    .map(<LossConfig as fidl::encoding::ValueTypeMarker>::borrow),
3075                encoder,
3076                offset + cur_offset,
3077                depth,
3078            )?;
3079
3080            _prev_end_offset = cur_offset + envelope_size;
3081            if 3 > max_ordinal {
3082                return Ok(());
3083            }
3084
3085            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3086            // are envelope_size bytes.
3087            let cur_offset: usize = (3 - 1) * envelope_size;
3088
3089            // Zero reserved fields.
3090            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3091
3092            // Safety:
3093            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3094            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3095            //   envelope_size bytes, there is always sufficient room.
3096            fidl::encoding::encode_in_envelope_optional::<ReorderConfig, D>(
3097                self.reorder
3098                    .as_ref()
3099                    .map(<ReorderConfig as fidl::encoding::ValueTypeMarker>::borrow),
3100                encoder,
3101                offset + cur_offset,
3102                depth,
3103            )?;
3104
3105            _prev_end_offset = cur_offset + envelope_size;
3106
3107            Ok(())
3108        }
3109    }
3110
3111    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkConfig {
3112        #[inline(always)]
3113        fn new_empty() -> Self {
3114            Self::default()
3115        }
3116
3117        unsafe fn decode(
3118            &mut self,
3119            decoder: &mut fidl::encoding::Decoder<'_, D>,
3120            offset: usize,
3121            mut depth: fidl::encoding::Depth,
3122        ) -> fidl::Result<()> {
3123            decoder.debug_check_bounds::<Self>(offset);
3124            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3125                None => return Err(fidl::Error::NotNullable),
3126                Some(len) => len,
3127            };
3128            // Calling decoder.out_of_line_offset(0) is not allowed.
3129            if len == 0 {
3130                return Ok(());
3131            };
3132            depth.increment()?;
3133            let envelope_size = 8;
3134            let bytes_len = len * envelope_size;
3135            let offset = decoder.out_of_line_offset(bytes_len)?;
3136            // Decode the envelope for each type.
3137            let mut _next_ordinal_to_read = 0;
3138            let mut next_offset = offset;
3139            let end_offset = offset + bytes_len;
3140            _next_ordinal_to_read += 1;
3141            if next_offset >= end_offset {
3142                return Ok(());
3143            }
3144
3145            // Decode unknown envelopes for gaps in ordinals.
3146            while _next_ordinal_to_read < 1 {
3147                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3148                _next_ordinal_to_read += 1;
3149                next_offset += envelope_size;
3150            }
3151
3152            let next_out_of_line = decoder.next_out_of_line();
3153            let handles_before = decoder.remaining_handles();
3154            if let Some((inlined, num_bytes, num_handles)) =
3155                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3156            {
3157                let member_inline_size =
3158                    <LatencyConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3159                if inlined != (member_inline_size <= 4) {
3160                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3161                }
3162                let inner_offset;
3163                let mut inner_depth = depth.clone();
3164                if inlined {
3165                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3166                    inner_offset = next_offset;
3167                } else {
3168                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3169                    inner_depth.increment()?;
3170                }
3171                let val_ref =
3172                    self.latency.get_or_insert_with(|| fidl::new_empty!(LatencyConfig, D));
3173                fidl::decode!(LatencyConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
3174                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3175                {
3176                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3177                }
3178                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3179                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3180                }
3181            }
3182
3183            next_offset += envelope_size;
3184            _next_ordinal_to_read += 1;
3185            if next_offset >= end_offset {
3186                return Ok(());
3187            }
3188
3189            // Decode unknown envelopes for gaps in ordinals.
3190            while _next_ordinal_to_read < 2 {
3191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3192                _next_ordinal_to_read += 1;
3193                next_offset += envelope_size;
3194            }
3195
3196            let next_out_of_line = decoder.next_out_of_line();
3197            let handles_before = decoder.remaining_handles();
3198            if let Some((inlined, num_bytes, num_handles)) =
3199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3200            {
3201                let member_inline_size =
3202                    <LossConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3203                if inlined != (member_inline_size <= 4) {
3204                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3205                }
3206                let inner_offset;
3207                let mut inner_depth = depth.clone();
3208                if inlined {
3209                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3210                    inner_offset = next_offset;
3211                } else {
3212                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3213                    inner_depth.increment()?;
3214                }
3215                let val_ref =
3216                    self.packet_loss.get_or_insert_with(|| fidl::new_empty!(LossConfig, D));
3217                fidl::decode!(LossConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
3218                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3219                {
3220                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3221                }
3222                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3223                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3224                }
3225            }
3226
3227            next_offset += envelope_size;
3228            _next_ordinal_to_read += 1;
3229            if next_offset >= end_offset {
3230                return Ok(());
3231            }
3232
3233            // Decode unknown envelopes for gaps in ordinals.
3234            while _next_ordinal_to_read < 3 {
3235                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3236                _next_ordinal_to_read += 1;
3237                next_offset += envelope_size;
3238            }
3239
3240            let next_out_of_line = decoder.next_out_of_line();
3241            let handles_before = decoder.remaining_handles();
3242            if let Some((inlined, num_bytes, num_handles)) =
3243                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3244            {
3245                let member_inline_size =
3246                    <ReorderConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3247                if inlined != (member_inline_size <= 4) {
3248                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3249                }
3250                let inner_offset;
3251                let mut inner_depth = depth.clone();
3252                if inlined {
3253                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3254                    inner_offset = next_offset;
3255                } else {
3256                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3257                    inner_depth.increment()?;
3258                }
3259                let val_ref =
3260                    self.reorder.get_or_insert_with(|| fidl::new_empty!(ReorderConfig, D));
3261                fidl::decode!(ReorderConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
3262                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3263                {
3264                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3265                }
3266                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3267                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3268                }
3269            }
3270
3271            next_offset += envelope_size;
3272
3273            // Decode the remaining unknown envelopes.
3274            while next_offset < end_offset {
3275                _next_ordinal_to_read += 1;
3276                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3277                next_offset += envelope_size;
3278            }
3279
3280            Ok(())
3281        }
3282    }
3283
3284    impl fidl::encoding::ValueTypeMarker for LossConfig {
3285        type Borrowed<'a> = &'a Self;
3286        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3287            value
3288        }
3289    }
3290
3291    unsafe impl fidl::encoding::TypeMarker for LossConfig {
3292        type Owned = Self;
3293
3294        #[inline(always)]
3295        fn inline_align(_context: fidl::encoding::Context) -> usize {
3296            8
3297        }
3298
3299        #[inline(always)]
3300        fn inline_size(_context: fidl::encoding::Context) -> usize {
3301            16
3302        }
3303    }
3304
3305    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LossConfig, D>
3306        for &LossConfig
3307    {
3308        #[inline]
3309        unsafe fn encode(
3310            self,
3311            encoder: &mut fidl::encoding::Encoder<'_, D>,
3312            offset: usize,
3313            _depth: fidl::encoding::Depth,
3314        ) -> fidl::Result<()> {
3315            encoder.debug_check_bounds::<LossConfig>(offset);
3316            encoder.write_num::<u64>(self.ordinal(), offset);
3317            match self {
3318                LossConfig::RandomRate(ref val) => fidl::encoding::encode_in_envelope::<u8, D>(
3319                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
3320                    encoder,
3321                    offset + 8,
3322                    _depth,
3323                ),
3324            }
3325        }
3326    }
3327
3328    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LossConfig {
3329        #[inline(always)]
3330        fn new_empty() -> Self {
3331            Self::RandomRate(fidl::new_empty!(u8, D))
3332        }
3333
3334        #[inline]
3335        unsafe fn decode(
3336            &mut self,
3337            decoder: &mut fidl::encoding::Decoder<'_, D>,
3338            offset: usize,
3339            mut depth: fidl::encoding::Depth,
3340        ) -> fidl::Result<()> {
3341            decoder.debug_check_bounds::<Self>(offset);
3342            #[allow(unused_variables)]
3343            let next_out_of_line = decoder.next_out_of_line();
3344            let handles_before = decoder.remaining_handles();
3345            let (ordinal, inlined, num_bytes, num_handles) =
3346                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3347
3348            let member_inline_size = match ordinal {
3349                1 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3350                _ => return Err(fidl::Error::UnknownUnionTag),
3351            };
3352
3353            if inlined != (member_inline_size <= 4) {
3354                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3355            }
3356            let _inner_offset;
3357            if inlined {
3358                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3359                _inner_offset = offset + 8;
3360            } else {
3361                depth.increment()?;
3362                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3363            }
3364            match ordinal {
3365                1 => {
3366                    #[allow(irrefutable_let_patterns)]
3367                    if let LossConfig::RandomRate(_) = self {
3368                        // Do nothing, read the value into the object
3369                    } else {
3370                        // Initialize `self` to the right variant
3371                        *self = LossConfig::RandomRate(fidl::new_empty!(u8, D));
3372                    }
3373                    #[allow(irrefutable_let_patterns)]
3374                    if let LossConfig::RandomRate(ref mut val) = self {
3375                        fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
3376                    } else {
3377                        unreachable!()
3378                    }
3379                }
3380                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3381            }
3382            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3383                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3384            }
3385            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3386                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3387            }
3388            Ok(())
3389        }
3390    }
3391}