fidl_test_structuredconfig_receiver/
fidl_test_structuredconfig_receiver.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ConfigReceiverPuppetGetConfigResponse {
15    pub config: ReceiverConfig,
16}
17
18impl fidl::Persistable for ConfigReceiverPuppetGetConfigResponse {}
19
20#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
21pub struct ReceiverConfig {
22    pub my_flag: bool,
23    pub my_int16: i16,
24    pub my_int32: i32,
25    pub my_int64: i64,
26    pub my_int8: i8,
27    pub my_string: String,
28    pub my_uint16: u16,
29    pub my_uint32: u32,
30    pub my_uint64: u64,
31    pub my_uint8: u8,
32    pub my_vector_of_flag: Vec<bool>,
33    pub my_vector_of_int16: Vec<i16>,
34    pub my_vector_of_int32: Vec<i32>,
35    pub my_vector_of_int64: Vec<i64>,
36    pub my_vector_of_int8: Vec<i8>,
37    pub my_vector_of_string: Vec<String>,
38    pub my_vector_of_uint16: Vec<u16>,
39    pub my_vector_of_uint32: Vec<u32>,
40    pub my_vector_of_uint64: Vec<u64>,
41    pub my_vector_of_uint8: Vec<u8>,
42}
43
44impl fidl::Persistable for ReceiverConfig {}
45
46#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
47pub struct ConfigReceiverPuppetMarker;
48
49impl fidl::endpoints::ProtocolMarker for ConfigReceiverPuppetMarker {
50    type Proxy = ConfigReceiverPuppetProxy;
51    type RequestStream = ConfigReceiverPuppetRequestStream;
52    #[cfg(target_os = "fuchsia")]
53    type SynchronousProxy = ConfigReceiverPuppetSynchronousProxy;
54
55    const DEBUG_NAME: &'static str = "test.structuredconfig.receiver.ConfigReceiverPuppet";
56}
57impl fidl::endpoints::DiscoverableProtocolMarker for ConfigReceiverPuppetMarker {}
58
59pub trait ConfigReceiverPuppetProxyInterface: Send + Sync {
60    type GetConfigResponseFut: std::future::Future<Output = Result<ReceiverConfig, fidl::Error>>
61        + Send;
62    fn r#get_config(&self) -> Self::GetConfigResponseFut;
63}
64#[derive(Debug)]
65#[cfg(target_os = "fuchsia")]
66pub struct ConfigReceiverPuppetSynchronousProxy {
67    client: fidl::client::sync::Client,
68}
69
70#[cfg(target_os = "fuchsia")]
71impl fidl::endpoints::SynchronousProxy for ConfigReceiverPuppetSynchronousProxy {
72    type Proxy = ConfigReceiverPuppetProxy;
73    type Protocol = ConfigReceiverPuppetMarker;
74
75    fn from_channel(inner: fidl::Channel) -> Self {
76        Self::new(inner)
77    }
78
79    fn into_channel(self) -> fidl::Channel {
80        self.client.into_channel()
81    }
82
83    fn as_channel(&self) -> &fidl::Channel {
84        self.client.as_channel()
85    }
86}
87
88#[cfg(target_os = "fuchsia")]
89impl ConfigReceiverPuppetSynchronousProxy {
90    pub fn new(channel: fidl::Channel) -> Self {
91        let protocol_name =
92            <ConfigReceiverPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
93        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
94    }
95
96    pub fn into_channel(self) -> fidl::Channel {
97        self.client.into_channel()
98    }
99
100    /// Waits until an event arrives and returns it. It is safe for other
101    /// threads to make concurrent requests while waiting for an event.
102    pub fn wait_for_event(
103        &self,
104        deadline: zx::MonotonicInstant,
105    ) -> Result<ConfigReceiverPuppetEvent, fidl::Error> {
106        ConfigReceiverPuppetEvent::decode(self.client.wait_for_event(deadline)?)
107    }
108
109    pub fn r#get_config(
110        &self,
111        ___deadline: zx::MonotonicInstant,
112    ) -> Result<ReceiverConfig, fidl::Error> {
113        let _response = self
114            .client
115            .send_query::<fidl::encoding::EmptyPayload, ConfigReceiverPuppetGetConfigResponse>(
116                (),
117                0x243d8db8a2863b24,
118                fidl::encoding::DynamicFlags::empty(),
119                ___deadline,
120            )?;
121        Ok(_response.config)
122    }
123}
124
125#[derive(Debug, Clone)]
126pub struct ConfigReceiverPuppetProxy {
127    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
128}
129
130impl fidl::endpoints::Proxy for ConfigReceiverPuppetProxy {
131    type Protocol = ConfigReceiverPuppetMarker;
132
133    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
134        Self::new(inner)
135    }
136
137    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
138        self.client.into_channel().map_err(|client| Self { client })
139    }
140
141    fn as_channel(&self) -> &::fidl::AsyncChannel {
142        self.client.as_channel()
143    }
144}
145
146impl ConfigReceiverPuppetProxy {
147    /// Create a new Proxy for test.structuredconfig.receiver/ConfigReceiverPuppet.
148    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
149        let protocol_name =
150            <ConfigReceiverPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
151        Self { client: fidl::client::Client::new(channel, protocol_name) }
152    }
153
154    /// Get a Stream of events from the remote end of the protocol.
155    ///
156    /// # Panics
157    ///
158    /// Panics if the event stream was already taken.
159    pub fn take_event_stream(&self) -> ConfigReceiverPuppetEventStream {
160        ConfigReceiverPuppetEventStream { event_receiver: self.client.take_event_receiver() }
161    }
162
163    pub fn r#get_config(
164        &self,
165    ) -> fidl::client::QueryResponseFut<ReceiverConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
166    {
167        ConfigReceiverPuppetProxyInterface::r#get_config(self)
168    }
169}
170
171impl ConfigReceiverPuppetProxyInterface for ConfigReceiverPuppetProxy {
172    type GetConfigResponseFut = fidl::client::QueryResponseFut<
173        ReceiverConfig,
174        fidl::encoding::DefaultFuchsiaResourceDialect,
175    >;
176    fn r#get_config(&self) -> Self::GetConfigResponseFut {
177        fn _decode(
178            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
179        ) -> Result<ReceiverConfig, fidl::Error> {
180            let _response = fidl::client::decode_transaction_body::<
181                ConfigReceiverPuppetGetConfigResponse,
182                fidl::encoding::DefaultFuchsiaResourceDialect,
183                0x243d8db8a2863b24,
184            >(_buf?)?;
185            Ok(_response.config)
186        }
187        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ReceiverConfig>(
188            (),
189            0x243d8db8a2863b24,
190            fidl::encoding::DynamicFlags::empty(),
191            _decode,
192        )
193    }
194}
195
196pub struct ConfigReceiverPuppetEventStream {
197    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
198}
199
200impl std::marker::Unpin for ConfigReceiverPuppetEventStream {}
201
202impl futures::stream::FusedStream for ConfigReceiverPuppetEventStream {
203    fn is_terminated(&self) -> bool {
204        self.event_receiver.is_terminated()
205    }
206}
207
208impl futures::Stream for ConfigReceiverPuppetEventStream {
209    type Item = Result<ConfigReceiverPuppetEvent, fidl::Error>;
210
211    fn poll_next(
212        mut self: std::pin::Pin<&mut Self>,
213        cx: &mut std::task::Context<'_>,
214    ) -> std::task::Poll<Option<Self::Item>> {
215        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
216            &mut self.event_receiver,
217            cx
218        )?) {
219            Some(buf) => std::task::Poll::Ready(Some(ConfigReceiverPuppetEvent::decode(buf))),
220            None => std::task::Poll::Ready(None),
221        }
222    }
223}
224
225#[derive(Debug)]
226pub enum ConfigReceiverPuppetEvent {}
227
228impl ConfigReceiverPuppetEvent {
229    /// Decodes a message buffer as a [`ConfigReceiverPuppetEvent`].
230    fn decode(
231        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
232    ) -> Result<ConfigReceiverPuppetEvent, fidl::Error> {
233        let (bytes, _handles) = buf.split_mut();
234        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
235        debug_assert_eq!(tx_header.tx_id, 0);
236        match tx_header.ordinal {
237            _ => Err(fidl::Error::UnknownOrdinal {
238                ordinal: tx_header.ordinal,
239                protocol_name:
240                    <ConfigReceiverPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
241            }),
242        }
243    }
244}
245
246/// A Stream of incoming requests for test.structuredconfig.receiver/ConfigReceiverPuppet.
247pub struct ConfigReceiverPuppetRequestStream {
248    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
249    is_terminated: bool,
250}
251
252impl std::marker::Unpin for ConfigReceiverPuppetRequestStream {}
253
254impl futures::stream::FusedStream for ConfigReceiverPuppetRequestStream {
255    fn is_terminated(&self) -> bool {
256        self.is_terminated
257    }
258}
259
260impl fidl::endpoints::RequestStream for ConfigReceiverPuppetRequestStream {
261    type Protocol = ConfigReceiverPuppetMarker;
262    type ControlHandle = ConfigReceiverPuppetControlHandle;
263
264    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
265        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
266    }
267
268    fn control_handle(&self) -> Self::ControlHandle {
269        ConfigReceiverPuppetControlHandle { inner: self.inner.clone() }
270    }
271
272    fn into_inner(
273        self,
274    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
275    {
276        (self.inner, self.is_terminated)
277    }
278
279    fn from_inner(
280        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
281        is_terminated: bool,
282    ) -> Self {
283        Self { inner, is_terminated }
284    }
285}
286
287impl futures::Stream for ConfigReceiverPuppetRequestStream {
288    type Item = Result<ConfigReceiverPuppetRequest, fidl::Error>;
289
290    fn poll_next(
291        mut self: std::pin::Pin<&mut Self>,
292        cx: &mut std::task::Context<'_>,
293    ) -> std::task::Poll<Option<Self::Item>> {
294        let this = &mut *self;
295        if this.inner.check_shutdown(cx) {
296            this.is_terminated = true;
297            return std::task::Poll::Ready(None);
298        }
299        if this.is_terminated {
300            panic!("polled ConfigReceiverPuppetRequestStream after completion");
301        }
302        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
303            |bytes, handles| {
304                match this.inner.channel().read_etc(cx, bytes, handles) {
305                    std::task::Poll::Ready(Ok(())) => {}
306                    std::task::Poll::Pending => return std::task::Poll::Pending,
307                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
308                        this.is_terminated = true;
309                        return std::task::Poll::Ready(None);
310                    }
311                    std::task::Poll::Ready(Err(e)) => {
312                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
313                            e.into(),
314                        ))))
315                    }
316                }
317
318                // A message has been received from the channel
319                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
320
321                std::task::Poll::Ready(Some(match header.ordinal {
322                0x243d8db8a2863b24 => {
323                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
324                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
325                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
326                    let control_handle = ConfigReceiverPuppetControlHandle {
327                        inner: this.inner.clone(),
328                    };
329                    Ok(ConfigReceiverPuppetRequest::GetConfig {
330                        responder: ConfigReceiverPuppetGetConfigResponder {
331                            control_handle: std::mem::ManuallyDrop::new(control_handle),
332                            tx_id: header.tx_id,
333                        },
334                    })
335                }
336                _ => Err(fidl::Error::UnknownOrdinal {
337                    ordinal: header.ordinal,
338                    protocol_name: <ConfigReceiverPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
339                }),
340            }))
341            },
342        )
343    }
344}
345
346#[derive(Debug)]
347pub enum ConfigReceiverPuppetRequest {
348    GetConfig { responder: ConfigReceiverPuppetGetConfigResponder },
349}
350
351impl ConfigReceiverPuppetRequest {
352    #[allow(irrefutable_let_patterns)]
353    pub fn into_get_config(self) -> Option<(ConfigReceiverPuppetGetConfigResponder)> {
354        if let ConfigReceiverPuppetRequest::GetConfig { responder } = self {
355            Some((responder))
356        } else {
357            None
358        }
359    }
360
361    /// Name of the method defined in FIDL
362    pub fn method_name(&self) -> &'static str {
363        match *self {
364            ConfigReceiverPuppetRequest::GetConfig { .. } => "get_config",
365        }
366    }
367}
368
369#[derive(Debug, Clone)]
370pub struct ConfigReceiverPuppetControlHandle {
371    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
372}
373
374impl fidl::endpoints::ControlHandle for ConfigReceiverPuppetControlHandle {
375    fn shutdown(&self) {
376        self.inner.shutdown()
377    }
378    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
379        self.inner.shutdown_with_epitaph(status)
380    }
381
382    fn is_closed(&self) -> bool {
383        self.inner.channel().is_closed()
384    }
385    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
386        self.inner.channel().on_closed()
387    }
388
389    #[cfg(target_os = "fuchsia")]
390    fn signal_peer(
391        &self,
392        clear_mask: zx::Signals,
393        set_mask: zx::Signals,
394    ) -> Result<(), zx_status::Status> {
395        use fidl::Peered;
396        self.inner.channel().signal_peer(clear_mask, set_mask)
397    }
398}
399
400impl ConfigReceiverPuppetControlHandle {}
401
402#[must_use = "FIDL methods require a response to be sent"]
403#[derive(Debug)]
404pub struct ConfigReceiverPuppetGetConfigResponder {
405    control_handle: std::mem::ManuallyDrop<ConfigReceiverPuppetControlHandle>,
406    tx_id: u32,
407}
408
409/// Set the the channel to be shutdown (see [`ConfigReceiverPuppetControlHandle::shutdown`])
410/// if the responder is dropped without sending a response, so that the client
411/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
412impl std::ops::Drop for ConfigReceiverPuppetGetConfigResponder {
413    fn drop(&mut self) {
414        self.control_handle.shutdown();
415        // Safety: drops once, never accessed again
416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
417    }
418}
419
420impl fidl::endpoints::Responder for ConfigReceiverPuppetGetConfigResponder {
421    type ControlHandle = ConfigReceiverPuppetControlHandle;
422
423    fn control_handle(&self) -> &ConfigReceiverPuppetControlHandle {
424        &self.control_handle
425    }
426
427    fn drop_without_shutdown(mut self) {
428        // Safety: drops once, never accessed again due to mem::forget
429        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
430        // Prevent Drop from running (which would shut down the channel)
431        std::mem::forget(self);
432    }
433}
434
435impl ConfigReceiverPuppetGetConfigResponder {
436    /// Sends a response to the FIDL transaction.
437    ///
438    /// Sets the channel to shutdown if an error occurs.
439    pub fn send(self, mut config: &ReceiverConfig) -> Result<(), fidl::Error> {
440        let _result = self.send_raw(config);
441        if _result.is_err() {
442            self.control_handle.shutdown();
443        }
444        self.drop_without_shutdown();
445        _result
446    }
447
448    /// Similar to "send" but does not shutdown the channel if an error occurs.
449    pub fn send_no_shutdown_on_err(self, mut config: &ReceiverConfig) -> Result<(), fidl::Error> {
450        let _result = self.send_raw(config);
451        self.drop_without_shutdown();
452        _result
453    }
454
455    fn send_raw(&self, mut config: &ReceiverConfig) -> Result<(), fidl::Error> {
456        self.control_handle.inner.send::<ConfigReceiverPuppetGetConfigResponse>(
457            (config,),
458            self.tx_id,
459            0x243d8db8a2863b24,
460            fidl::encoding::DynamicFlags::empty(),
461        )
462    }
463}
464
465mod internal {
466    use super::*;
467
468    impl fidl::encoding::ValueTypeMarker for ConfigReceiverPuppetGetConfigResponse {
469        type Borrowed<'a> = &'a Self;
470        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
471            value
472        }
473    }
474
475    unsafe impl fidl::encoding::TypeMarker for ConfigReceiverPuppetGetConfigResponse {
476        type Owned = Self;
477
478        #[inline(always)]
479        fn inline_align(_context: fidl::encoding::Context) -> usize {
480            8
481        }
482
483        #[inline(always)]
484        fn inline_size(_context: fidl::encoding::Context) -> usize {
485            224
486        }
487    }
488
489    unsafe impl<D: fidl::encoding::ResourceDialect>
490        fidl::encoding::Encode<ConfigReceiverPuppetGetConfigResponse, D>
491        for &ConfigReceiverPuppetGetConfigResponse
492    {
493        #[inline]
494        unsafe fn encode(
495            self,
496            encoder: &mut fidl::encoding::Encoder<'_, D>,
497            offset: usize,
498            _depth: fidl::encoding::Depth,
499        ) -> fidl::Result<()> {
500            encoder.debug_check_bounds::<ConfigReceiverPuppetGetConfigResponse>(offset);
501            // Delegate to tuple encoding.
502            fidl::encoding::Encode::<ConfigReceiverPuppetGetConfigResponse, D>::encode(
503                (<ReceiverConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
504                encoder,
505                offset,
506                _depth,
507            )
508        }
509    }
510    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReceiverConfig, D>>
511        fidl::encoding::Encode<ConfigReceiverPuppetGetConfigResponse, D> for (T0,)
512    {
513        #[inline]
514        unsafe fn encode(
515            self,
516            encoder: &mut fidl::encoding::Encoder<'_, D>,
517            offset: usize,
518            depth: fidl::encoding::Depth,
519        ) -> fidl::Result<()> {
520            encoder.debug_check_bounds::<ConfigReceiverPuppetGetConfigResponse>(offset);
521            // Zero out padding regions. There's no need to apply masks
522            // because the unmasked parts will be overwritten by fields.
523            // Write the fields.
524            self.0.encode(encoder, offset + 0, depth)?;
525            Ok(())
526        }
527    }
528
529    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
530        for ConfigReceiverPuppetGetConfigResponse
531    {
532        #[inline(always)]
533        fn new_empty() -> Self {
534            Self { config: fidl::new_empty!(ReceiverConfig, D) }
535        }
536
537        #[inline]
538        unsafe fn decode(
539            &mut self,
540            decoder: &mut fidl::encoding::Decoder<'_, D>,
541            offset: usize,
542            _depth: fidl::encoding::Depth,
543        ) -> fidl::Result<()> {
544            decoder.debug_check_bounds::<Self>(offset);
545            // Verify that padding bytes are zero.
546            fidl::decode!(ReceiverConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
547            Ok(())
548        }
549    }
550
551    impl fidl::encoding::ValueTypeMarker for ReceiverConfig {
552        type Borrowed<'a> = &'a Self;
553        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
554            value
555        }
556    }
557
558    unsafe impl fidl::encoding::TypeMarker for ReceiverConfig {
559        type Owned = Self;
560
561        #[inline(always)]
562        fn inline_align(_context: fidl::encoding::Context) -> usize {
563            8
564        }
565
566        #[inline(always)]
567        fn inline_size(_context: fidl::encoding::Context) -> usize {
568            224
569        }
570    }
571
572    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReceiverConfig, D>
573        for &ReceiverConfig
574    {
575        #[inline]
576        unsafe fn encode(
577            self,
578            encoder: &mut fidl::encoding::Encoder<'_, D>,
579            offset: usize,
580            _depth: fidl::encoding::Depth,
581        ) -> fidl::Result<()> {
582            encoder.debug_check_bounds::<ReceiverConfig>(offset);
583            // Delegate to tuple encoding.
584            fidl::encoding::Encode::<ReceiverConfig, D>::encode(
585                (
586                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.my_flag),
587                    <i16 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int16),
588                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int32),
589                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int64),
590                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int8),
591                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_string),
592                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint16),
593                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint32),
594                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint64),
595                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint8),
596                    <fidl::encoding::Vector<bool, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_flag),
597                    <fidl::encoding::Vector<i16, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int16),
598                    <fidl::encoding::Vector<i32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int32),
599                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int64),
600                    <fidl::encoding::Vector<i8, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int8),
601                    <fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_string),
602                    <fidl::encoding::Vector<u16, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint16),
603                    <fidl::encoding::Vector<u32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint32),
604                    <fidl::encoding::Vector<u64, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint64),
605                    <fidl::encoding::Vector<u8, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint8),
606                ),
607                encoder, offset, _depth
608            )
609        }
610    }
611    unsafe impl<
612            D: fidl::encoding::ResourceDialect,
613            T0: fidl::encoding::Encode<bool, D>,
614            T1: fidl::encoding::Encode<i16, D>,
615            T2: fidl::encoding::Encode<i32, D>,
616            T3: fidl::encoding::Encode<i64, D>,
617            T4: fidl::encoding::Encode<i8, D>,
618            T5: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
619            T6: fidl::encoding::Encode<u16, D>,
620            T7: fidl::encoding::Encode<u32, D>,
621            T8: fidl::encoding::Encode<u64, D>,
622            T9: fidl::encoding::Encode<u8, D>,
623            T10: fidl::encoding::Encode<fidl::encoding::Vector<bool, 100>, D>,
624            T11: fidl::encoding::Encode<fidl::encoding::Vector<i16, 100>, D>,
625            T12: fidl::encoding::Encode<fidl::encoding::Vector<i32, 100>, D>,
626            T13: fidl::encoding::Encode<fidl::encoding::Vector<i64, 100>, D>,
627            T14: fidl::encoding::Encode<fidl::encoding::Vector<i8, 100>, D>,
628            T15: fidl::encoding::Encode<
629                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
630                D,
631            >,
632            T16: fidl::encoding::Encode<fidl::encoding::Vector<u16, 100>, D>,
633            T17: fidl::encoding::Encode<fidl::encoding::Vector<u32, 100>, D>,
634            T18: fidl::encoding::Encode<fidl::encoding::Vector<u64, 100>, D>,
635            T19: fidl::encoding::Encode<fidl::encoding::Vector<u8, 100>, D>,
636        > fidl::encoding::Encode<ReceiverConfig, D>
637        for (
638            T0,
639            T1,
640            T2,
641            T3,
642            T4,
643            T5,
644            T6,
645            T7,
646            T8,
647            T9,
648            T10,
649            T11,
650            T12,
651            T13,
652            T14,
653            T15,
654            T16,
655            T17,
656            T18,
657            T19,
658        )
659    {
660        #[inline]
661        unsafe fn encode(
662            self,
663            encoder: &mut fidl::encoding::Encoder<'_, D>,
664            offset: usize,
665            depth: fidl::encoding::Depth,
666        ) -> fidl::Result<()> {
667            encoder.debug_check_bounds::<ReceiverConfig>(offset);
668            // Zero out padding regions. There's no need to apply masks
669            // because the unmasked parts will be overwritten by fields.
670            unsafe {
671                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
672                (ptr as *mut u64).write_unaligned(0);
673            }
674            unsafe {
675                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
676                (ptr as *mut u64).write_unaligned(0);
677            }
678            unsafe {
679                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
680                (ptr as *mut u64).write_unaligned(0);
681            }
682            unsafe {
683                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
684                (ptr as *mut u64).write_unaligned(0);
685            }
686            // Write the fields.
687            self.0.encode(encoder, offset + 0, depth)?;
688            self.1.encode(encoder, offset + 2, depth)?;
689            self.2.encode(encoder, offset + 4, depth)?;
690            self.3.encode(encoder, offset + 8, depth)?;
691            self.4.encode(encoder, offset + 16, depth)?;
692            self.5.encode(encoder, offset + 24, depth)?;
693            self.6.encode(encoder, offset + 40, depth)?;
694            self.7.encode(encoder, offset + 44, depth)?;
695            self.8.encode(encoder, offset + 48, depth)?;
696            self.9.encode(encoder, offset + 56, depth)?;
697            self.10.encode(encoder, offset + 64, depth)?;
698            self.11.encode(encoder, offset + 80, depth)?;
699            self.12.encode(encoder, offset + 96, depth)?;
700            self.13.encode(encoder, offset + 112, depth)?;
701            self.14.encode(encoder, offset + 128, depth)?;
702            self.15.encode(encoder, offset + 144, depth)?;
703            self.16.encode(encoder, offset + 160, depth)?;
704            self.17.encode(encoder, offset + 176, depth)?;
705            self.18.encode(encoder, offset + 192, depth)?;
706            self.19.encode(encoder, offset + 208, depth)?;
707            Ok(())
708        }
709    }
710
711    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReceiverConfig {
712        #[inline(always)]
713        fn new_empty() -> Self {
714            Self {
715                my_flag: fidl::new_empty!(bool, D),
716                my_int16: fidl::new_empty!(i16, D),
717                my_int32: fidl::new_empty!(i32, D),
718                my_int64: fidl::new_empty!(i64, D),
719                my_int8: fidl::new_empty!(i8, D),
720                my_string: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
721                my_uint16: fidl::new_empty!(u16, D),
722                my_uint32: fidl::new_empty!(u32, D),
723                my_uint64: fidl::new_empty!(u64, D),
724                my_uint8: fidl::new_empty!(u8, D),
725                my_vector_of_flag: fidl::new_empty!(fidl::encoding::Vector<bool, 100>, D),
726                my_vector_of_int16: fidl::new_empty!(fidl::encoding::Vector<i16, 100>, D),
727                my_vector_of_int32: fidl::new_empty!(fidl::encoding::Vector<i32, 100>, D),
728                my_vector_of_int64: fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D),
729                my_vector_of_int8: fidl::new_empty!(fidl::encoding::Vector<i8, 100>, D),
730                my_vector_of_string: fidl::new_empty!(
731                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
732                    D
733                ),
734                my_vector_of_uint16: fidl::new_empty!(fidl::encoding::Vector<u16, 100>, D),
735                my_vector_of_uint32: fidl::new_empty!(fidl::encoding::Vector<u32, 100>, D),
736                my_vector_of_uint64: fidl::new_empty!(fidl::encoding::Vector<u64, 100>, D),
737                my_vector_of_uint8: fidl::new_empty!(fidl::encoding::Vector<u8, 100>, D),
738            }
739        }
740
741        #[inline]
742        unsafe fn decode(
743            &mut self,
744            decoder: &mut fidl::encoding::Decoder<'_, D>,
745            offset: usize,
746            _depth: fidl::encoding::Depth,
747        ) -> fidl::Result<()> {
748            decoder.debug_check_bounds::<Self>(offset);
749            // Verify that padding bytes are zero.
750            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
751            let padval = unsafe { (ptr as *const u64).read_unaligned() };
752            let mask = 0xff00u64;
753            let maskedval = padval & mask;
754            if maskedval != 0 {
755                return Err(fidl::Error::NonZeroPadding {
756                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
757                });
758            }
759            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
760            let padval = unsafe { (ptr as *const u64).read_unaligned() };
761            let mask = 0xffffffffffffff00u64;
762            let maskedval = padval & mask;
763            if maskedval != 0 {
764                return Err(fidl::Error::NonZeroPadding {
765                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
766                });
767            }
768            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
769            let padval = unsafe { (ptr as *const u64).read_unaligned() };
770            let mask = 0xffff0000u64;
771            let maskedval = padval & mask;
772            if maskedval != 0 {
773                return Err(fidl::Error::NonZeroPadding {
774                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
775                });
776            }
777            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
778            let padval = unsafe { (ptr as *const u64).read_unaligned() };
779            let mask = 0xffffffffffffff00u64;
780            let maskedval = padval & mask;
781            if maskedval != 0 {
782                return Err(fidl::Error::NonZeroPadding {
783                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
784                });
785            }
786            fidl::decode!(bool, D, &mut self.my_flag, decoder, offset + 0, _depth)?;
787            fidl::decode!(i16, D, &mut self.my_int16, decoder, offset + 2, _depth)?;
788            fidl::decode!(i32, D, &mut self.my_int32, decoder, offset + 4, _depth)?;
789            fidl::decode!(i64, D, &mut self.my_int64, decoder, offset + 8, _depth)?;
790            fidl::decode!(i8, D, &mut self.my_int8, decoder, offset + 16, _depth)?;
791            fidl::decode!(
792                fidl::encoding::BoundedString<100>,
793                D,
794                &mut self.my_string,
795                decoder,
796                offset + 24,
797                _depth
798            )?;
799            fidl::decode!(u16, D, &mut self.my_uint16, decoder, offset + 40, _depth)?;
800            fidl::decode!(u32, D, &mut self.my_uint32, decoder, offset + 44, _depth)?;
801            fidl::decode!(u64, D, &mut self.my_uint64, decoder, offset + 48, _depth)?;
802            fidl::decode!(u8, D, &mut self.my_uint8, decoder, offset + 56, _depth)?;
803            fidl::decode!(fidl::encoding::Vector<bool, 100>, D, &mut self.my_vector_of_flag, decoder, offset + 64, _depth)?;
804            fidl::decode!(fidl::encoding::Vector<i16, 100>, D, &mut self.my_vector_of_int16, decoder, offset + 80, _depth)?;
805            fidl::decode!(fidl::encoding::Vector<i32, 100>, D, &mut self.my_vector_of_int32, decoder, offset + 96, _depth)?;
806            fidl::decode!(fidl::encoding::Vector<i64, 100>, D, &mut self.my_vector_of_int64, decoder, offset + 112, _depth)?;
807            fidl::decode!(fidl::encoding::Vector<i8, 100>, D, &mut self.my_vector_of_int8, decoder, offset + 128, _depth)?;
808            fidl::decode!(
809                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
810                D,
811                &mut self.my_vector_of_string,
812                decoder,
813                offset + 144,
814                _depth
815            )?;
816            fidl::decode!(fidl::encoding::Vector<u16, 100>, D, &mut self.my_vector_of_uint16, decoder, offset + 160, _depth)?;
817            fidl::decode!(fidl::encoding::Vector<u32, 100>, D, &mut self.my_vector_of_uint32, decoder, offset + 176, _depth)?;
818            fidl::decode!(fidl::encoding::Vector<u64, 100>, D, &mut self.my_vector_of_uint64, decoder, offset + 192, _depth)?;
819            fidl::decode!(fidl::encoding::Vector<u8, 100>, D, &mut self.my_vector_of_uint8, decoder, offset + 208, _depth)?;
820            Ok(())
821        }
822    }
823}