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