Skip to main content

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