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