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