Skip to main content

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