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