Skip to main content

fidl_test_processbuilder/
fidl_test_processbuilder.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_processbuilder_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct UtilMarker;
16
17impl fidl::endpoints::ProtocolMarker for UtilMarker {
18    type Proxy = UtilProxy;
19    type RequestStream = UtilRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = UtilSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "test.processbuilder.Util";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for UtilMarker {}
26
27pub trait UtilProxyInterface: Send + Sync {
28    type GetArgumentsResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
29        + Send;
30    fn r#get_arguments(&self) -> Self::GetArgumentsResponseFut;
31    type GetArgumentCountResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
32    fn r#get_argument_count(&self) -> Self::GetArgumentCountResponseFut;
33    type GetEnvironmentResponseFut: std::future::Future<Output = Result<Vec<EnvVar>, fidl::Error>>
34        + Send;
35    fn r#get_environment(&self) -> Self::GetEnvironmentResponseFut;
36    type GetEnvironmentCountResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
37        + Send;
38    fn r#get_environment_count(&self) -> Self::GetEnvironmentCountResponseFut;
39    type DumpNamespaceResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
40    fn r#dump_namespace(&self) -> Self::DumpNamespaceResponseFut;
41    type ReadFileResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
42    fn r#read_file(&self, path: &str) -> Self::ReadFileResponseFut;
43    type GetLifecycleKoidResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
44    fn r#get_lifecycle_koid(&self) -> Self::GetLifecycleKoidResponseFut;
45}
46#[derive(Debug)]
47#[cfg(target_os = "fuchsia")]
48pub struct UtilSynchronousProxy {
49    client: fidl::client::sync::Client,
50}
51
52#[cfg(target_os = "fuchsia")]
53impl fidl::endpoints::SynchronousProxy for UtilSynchronousProxy {
54    type Proxy = UtilProxy;
55    type Protocol = UtilMarker;
56
57    fn from_channel(inner: fidl::Channel) -> Self {
58        Self::new(inner)
59    }
60
61    fn into_channel(self) -> fidl::Channel {
62        self.client.into_channel()
63    }
64
65    fn as_channel(&self) -> &fidl::Channel {
66        self.client.as_channel()
67    }
68}
69
70#[cfg(target_os = "fuchsia")]
71impl UtilSynchronousProxy {
72    pub fn new(channel: fidl::Channel) -> Self {
73        Self { client: fidl::client::sync::Client::new(channel) }
74    }
75
76    pub fn into_channel(self) -> fidl::Channel {
77        self.client.into_channel()
78    }
79
80    /// Waits until an event arrives and returns it. It is safe for other
81    /// threads to make concurrent requests while waiting for an event.
82    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<UtilEvent, fidl::Error> {
83        UtilEvent::decode(self.client.wait_for_event::<UtilMarker>(deadline)?)
84    }
85
86    pub fn r#get_arguments(
87        &self,
88        ___deadline: zx::MonotonicInstant,
89    ) -> Result<Vec<String>, fidl::Error> {
90        let _response = self
91            .client
92            .send_query::<fidl::encoding::EmptyPayload, UtilGetArgumentsResponse, UtilMarker>(
93                (),
94                0x50ff7f790c425519,
95                fidl::encoding::DynamicFlags::empty(),
96                ___deadline,
97            )?;
98        Ok(_response.args)
99    }
100
101    pub fn r#get_argument_count(
102        &self,
103        ___deadline: zx::MonotonicInstant,
104    ) -> Result<u64, fidl::Error> {
105        let _response = self
106            .client
107            .send_query::<fidl::encoding::EmptyPayload, UtilGetArgumentCountResponse, UtilMarker>(
108                (),
109                0x41ef27d234ed7098,
110                fidl::encoding::DynamicFlags::empty(),
111                ___deadline,
112            )?;
113        Ok(_response.count)
114    }
115
116    pub fn r#get_environment(
117        &self,
118        ___deadline: zx::MonotonicInstant,
119    ) -> Result<Vec<EnvVar>, fidl::Error> {
120        let _response = self
121            .client
122            .send_query::<fidl::encoding::EmptyPayload, UtilGetEnvironmentResponse, UtilMarker>(
123                (),
124                0x451e633adf04ec23,
125                fidl::encoding::DynamicFlags::empty(),
126                ___deadline,
127            )?;
128        Ok(_response.vars)
129    }
130
131    pub fn r#get_environment_count(
132        &self,
133        ___deadline: zx::MonotonicInstant,
134    ) -> Result<u64, fidl::Error> {
135        let _response = self.client.send_query::<
136            fidl::encoding::EmptyPayload,
137            UtilGetEnvironmentCountResponse,
138            UtilMarker,
139        >(
140            (),
141            0xe01fe768fb1be1a,
142            fidl::encoding::DynamicFlags::empty(),
143            ___deadline,
144        )?;
145        Ok(_response.count)
146    }
147
148    pub fn r#dump_namespace(
149        &self,
150        ___deadline: zx::MonotonicInstant,
151    ) -> Result<String, fidl::Error> {
152        let _response = self
153            .client
154            .send_query::<fidl::encoding::EmptyPayload, UtilDumpNamespaceResponse, UtilMarker>(
155                (),
156                0x73826cecc1a7f3a4,
157                fidl::encoding::DynamicFlags::empty(),
158                ___deadline,
159            )?;
160        Ok(_response.contents)
161    }
162
163    pub fn r#read_file(
164        &self,
165        mut path: &str,
166        ___deadline: zx::MonotonicInstant,
167    ) -> Result<String, fidl::Error> {
168        let _response =
169            self.client.send_query::<UtilReadFileRequest, UtilReadFileResponse, UtilMarker>(
170                (path,),
171                0x2ea8e2e4b427a391,
172                fidl::encoding::DynamicFlags::empty(),
173                ___deadline,
174            )?;
175        Ok(_response.contents)
176    }
177
178    pub fn r#get_lifecycle_koid(
179        &self,
180        ___deadline: zx::MonotonicInstant,
181    ) -> Result<u64, fidl::Error> {
182        let _response = self
183            .client
184            .send_query::<fidl::encoding::EmptyPayload, UtilGetLifecycleKoidResponse, UtilMarker>(
185                (),
186                0xdaecfc0fe4c8f60,
187                fidl::encoding::DynamicFlags::empty(),
188                ___deadline,
189            )?;
190        Ok(_response.koid)
191    }
192}
193
194#[cfg(target_os = "fuchsia")]
195impl From<UtilSynchronousProxy> for zx::NullableHandle {
196    fn from(value: UtilSynchronousProxy) -> Self {
197        value.into_channel().into()
198    }
199}
200
201#[cfg(target_os = "fuchsia")]
202impl From<fidl::Channel> for UtilSynchronousProxy {
203    fn from(value: fidl::Channel) -> Self {
204        Self::new(value)
205    }
206}
207
208#[cfg(target_os = "fuchsia")]
209impl fidl::endpoints::FromClient for UtilSynchronousProxy {
210    type Protocol = UtilMarker;
211
212    fn from_client(value: fidl::endpoints::ClientEnd<UtilMarker>) -> Self {
213        Self::new(value.into_channel())
214    }
215}
216
217#[derive(Debug, Clone)]
218pub struct UtilProxy {
219    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
220}
221
222impl fidl::endpoints::Proxy for UtilProxy {
223    type Protocol = UtilMarker;
224
225    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
226        Self::new(inner)
227    }
228
229    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
230        self.client.into_channel().map_err(|client| Self { client })
231    }
232
233    fn as_channel(&self) -> &::fidl::AsyncChannel {
234        self.client.as_channel()
235    }
236}
237
238impl UtilProxy {
239    /// Create a new Proxy for test.processbuilder/Util.
240    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
241        let protocol_name = <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
242        Self { client: fidl::client::Client::new(channel, protocol_name) }
243    }
244
245    /// Get a Stream of events from the remote end of the protocol.
246    ///
247    /// # Panics
248    ///
249    /// Panics if the event stream was already taken.
250    pub fn take_event_stream(&self) -> UtilEventStream {
251        UtilEventStream { event_receiver: self.client.take_event_receiver() }
252    }
253
254    pub fn r#get_arguments(
255        &self,
256    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
257    {
258        UtilProxyInterface::r#get_arguments(self)
259    }
260
261    pub fn r#get_argument_count(
262        &self,
263    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
264        UtilProxyInterface::r#get_argument_count(self)
265    }
266
267    pub fn r#get_environment(
268        &self,
269    ) -> fidl::client::QueryResponseFut<Vec<EnvVar>, fidl::encoding::DefaultFuchsiaResourceDialect>
270    {
271        UtilProxyInterface::r#get_environment(self)
272    }
273
274    pub fn r#get_environment_count(
275        &self,
276    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
277        UtilProxyInterface::r#get_environment_count(self)
278    }
279
280    pub fn r#dump_namespace(
281        &self,
282    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
283        UtilProxyInterface::r#dump_namespace(self)
284    }
285
286    pub fn r#read_file(
287        &self,
288        mut path: &str,
289    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
290        UtilProxyInterface::r#read_file(self, path)
291    }
292
293    pub fn r#get_lifecycle_koid(
294        &self,
295    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
296        UtilProxyInterface::r#get_lifecycle_koid(self)
297    }
298}
299
300impl UtilProxyInterface for UtilProxy {
301    type GetArgumentsResponseFut =
302        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
303    fn r#get_arguments(&self) -> Self::GetArgumentsResponseFut {
304        fn _decode(
305            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
306        ) -> Result<Vec<String>, fidl::Error> {
307            let _response = fidl::client::decode_transaction_body::<
308                UtilGetArgumentsResponse,
309                fidl::encoding::DefaultFuchsiaResourceDialect,
310                0x50ff7f790c425519,
311            >(_buf?)?;
312            Ok(_response.args)
313        }
314        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
315            (),
316            0x50ff7f790c425519,
317            fidl::encoding::DynamicFlags::empty(),
318            _decode,
319        )
320    }
321
322    type GetArgumentCountResponseFut =
323        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
324    fn r#get_argument_count(&self) -> Self::GetArgumentCountResponseFut {
325        fn _decode(
326            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
327        ) -> Result<u64, fidl::Error> {
328            let _response = fidl::client::decode_transaction_body::<
329                UtilGetArgumentCountResponse,
330                fidl::encoding::DefaultFuchsiaResourceDialect,
331                0x41ef27d234ed7098,
332            >(_buf?)?;
333            Ok(_response.count)
334        }
335        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
336            (),
337            0x41ef27d234ed7098,
338            fidl::encoding::DynamicFlags::empty(),
339            _decode,
340        )
341    }
342
343    type GetEnvironmentResponseFut =
344        fidl::client::QueryResponseFut<Vec<EnvVar>, fidl::encoding::DefaultFuchsiaResourceDialect>;
345    fn r#get_environment(&self) -> Self::GetEnvironmentResponseFut {
346        fn _decode(
347            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
348        ) -> Result<Vec<EnvVar>, fidl::Error> {
349            let _response = fidl::client::decode_transaction_body::<
350                UtilGetEnvironmentResponse,
351                fidl::encoding::DefaultFuchsiaResourceDialect,
352                0x451e633adf04ec23,
353            >(_buf?)?;
354            Ok(_response.vars)
355        }
356        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EnvVar>>(
357            (),
358            0x451e633adf04ec23,
359            fidl::encoding::DynamicFlags::empty(),
360            _decode,
361        )
362    }
363
364    type GetEnvironmentCountResponseFut =
365        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
366    fn r#get_environment_count(&self) -> Self::GetEnvironmentCountResponseFut {
367        fn _decode(
368            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
369        ) -> Result<u64, fidl::Error> {
370            let _response = fidl::client::decode_transaction_body::<
371                UtilGetEnvironmentCountResponse,
372                fidl::encoding::DefaultFuchsiaResourceDialect,
373                0xe01fe768fb1be1a,
374            >(_buf?)?;
375            Ok(_response.count)
376        }
377        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
378            (),
379            0xe01fe768fb1be1a,
380            fidl::encoding::DynamicFlags::empty(),
381            _decode,
382        )
383    }
384
385    type DumpNamespaceResponseFut =
386        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
387    fn r#dump_namespace(&self) -> Self::DumpNamespaceResponseFut {
388        fn _decode(
389            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
390        ) -> Result<String, fidl::Error> {
391            let _response = fidl::client::decode_transaction_body::<
392                UtilDumpNamespaceResponse,
393                fidl::encoding::DefaultFuchsiaResourceDialect,
394                0x73826cecc1a7f3a4,
395            >(_buf?)?;
396            Ok(_response.contents)
397        }
398        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
399            (),
400            0x73826cecc1a7f3a4,
401            fidl::encoding::DynamicFlags::empty(),
402            _decode,
403        )
404    }
405
406    type ReadFileResponseFut =
407        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
408    fn r#read_file(&self, mut path: &str) -> Self::ReadFileResponseFut {
409        fn _decode(
410            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
411        ) -> Result<String, fidl::Error> {
412            let _response = fidl::client::decode_transaction_body::<
413                UtilReadFileResponse,
414                fidl::encoding::DefaultFuchsiaResourceDialect,
415                0x2ea8e2e4b427a391,
416            >(_buf?)?;
417            Ok(_response.contents)
418        }
419        self.client.send_query_and_decode::<UtilReadFileRequest, String>(
420            (path,),
421            0x2ea8e2e4b427a391,
422            fidl::encoding::DynamicFlags::empty(),
423            _decode,
424        )
425    }
426
427    type GetLifecycleKoidResponseFut =
428        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
429    fn r#get_lifecycle_koid(&self) -> Self::GetLifecycleKoidResponseFut {
430        fn _decode(
431            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
432        ) -> Result<u64, fidl::Error> {
433            let _response = fidl::client::decode_transaction_body::<
434                UtilGetLifecycleKoidResponse,
435                fidl::encoding::DefaultFuchsiaResourceDialect,
436                0xdaecfc0fe4c8f60,
437            >(_buf?)?;
438            Ok(_response.koid)
439        }
440        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
441            (),
442            0xdaecfc0fe4c8f60,
443            fidl::encoding::DynamicFlags::empty(),
444            _decode,
445        )
446    }
447}
448
449pub struct UtilEventStream {
450    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
451}
452
453impl std::marker::Unpin for UtilEventStream {}
454
455impl futures::stream::FusedStream for UtilEventStream {
456    fn is_terminated(&self) -> bool {
457        self.event_receiver.is_terminated()
458    }
459}
460
461impl futures::Stream for UtilEventStream {
462    type Item = Result<UtilEvent, fidl::Error>;
463
464    fn poll_next(
465        mut self: std::pin::Pin<&mut Self>,
466        cx: &mut std::task::Context<'_>,
467    ) -> std::task::Poll<Option<Self::Item>> {
468        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
469            &mut self.event_receiver,
470            cx
471        )?) {
472            Some(buf) => std::task::Poll::Ready(Some(UtilEvent::decode(buf))),
473            None => std::task::Poll::Ready(None),
474        }
475    }
476}
477
478#[derive(Debug)]
479pub enum UtilEvent {}
480
481impl UtilEvent {
482    /// Decodes a message buffer as a [`UtilEvent`].
483    fn decode(
484        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
485    ) -> Result<UtilEvent, fidl::Error> {
486        let (bytes, _handles) = buf.split_mut();
487        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
488        debug_assert_eq!(tx_header.tx_id, 0);
489        match tx_header.ordinal {
490            _ => Err(fidl::Error::UnknownOrdinal {
491                ordinal: tx_header.ordinal,
492                protocol_name: <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
493            }),
494        }
495    }
496}
497
498/// A Stream of incoming requests for test.processbuilder/Util.
499pub struct UtilRequestStream {
500    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
501    is_terminated: bool,
502}
503
504impl std::marker::Unpin for UtilRequestStream {}
505
506impl futures::stream::FusedStream for UtilRequestStream {
507    fn is_terminated(&self) -> bool {
508        self.is_terminated
509    }
510}
511
512impl fidl::endpoints::RequestStream for UtilRequestStream {
513    type Protocol = UtilMarker;
514    type ControlHandle = UtilControlHandle;
515
516    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
517        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
518    }
519
520    fn control_handle(&self) -> Self::ControlHandle {
521        UtilControlHandle { inner: self.inner.clone() }
522    }
523
524    fn into_inner(
525        self,
526    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
527    {
528        (self.inner, self.is_terminated)
529    }
530
531    fn from_inner(
532        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
533        is_terminated: bool,
534    ) -> Self {
535        Self { inner, is_terminated }
536    }
537}
538
539impl futures::Stream for UtilRequestStream {
540    type Item = Result<UtilRequest, fidl::Error>;
541
542    fn poll_next(
543        mut self: std::pin::Pin<&mut Self>,
544        cx: &mut std::task::Context<'_>,
545    ) -> std::task::Poll<Option<Self::Item>> {
546        let this = &mut *self;
547        if this.inner.check_shutdown(cx) {
548            this.is_terminated = true;
549            return std::task::Poll::Ready(None);
550        }
551        if this.is_terminated {
552            panic!("polled UtilRequestStream after completion");
553        }
554        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
555            |bytes, handles| {
556                match this.inner.channel().read_etc(cx, bytes, handles) {
557                    std::task::Poll::Ready(Ok(())) => {}
558                    std::task::Poll::Pending => return std::task::Poll::Pending,
559                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
560                        this.is_terminated = true;
561                        return std::task::Poll::Ready(None);
562                    }
563                    std::task::Poll::Ready(Err(e)) => {
564                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
565                            e.into(),
566                        ))));
567                    }
568                }
569
570                // A message has been received from the channel
571                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
572
573                std::task::Poll::Ready(Some(match header.ordinal {
574                    0x50ff7f790c425519 => {
575                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
576                        let mut req = fidl::new_empty!(
577                            fidl::encoding::EmptyPayload,
578                            fidl::encoding::DefaultFuchsiaResourceDialect
579                        );
580                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
581                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
582                        Ok(UtilRequest::GetArguments {
583                            responder: UtilGetArgumentsResponder {
584                                control_handle: std::mem::ManuallyDrop::new(control_handle),
585                                tx_id: header.tx_id,
586                            },
587                        })
588                    }
589                    0x41ef27d234ed7098 => {
590                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
591                        let mut req = fidl::new_empty!(
592                            fidl::encoding::EmptyPayload,
593                            fidl::encoding::DefaultFuchsiaResourceDialect
594                        );
595                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
596                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
597                        Ok(UtilRequest::GetArgumentCount {
598                            responder: UtilGetArgumentCountResponder {
599                                control_handle: std::mem::ManuallyDrop::new(control_handle),
600                                tx_id: header.tx_id,
601                            },
602                        })
603                    }
604                    0x451e633adf04ec23 => {
605                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
606                        let mut req = fidl::new_empty!(
607                            fidl::encoding::EmptyPayload,
608                            fidl::encoding::DefaultFuchsiaResourceDialect
609                        );
610                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
611                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
612                        Ok(UtilRequest::GetEnvironment {
613                            responder: UtilGetEnvironmentResponder {
614                                control_handle: std::mem::ManuallyDrop::new(control_handle),
615                                tx_id: header.tx_id,
616                            },
617                        })
618                    }
619                    0xe01fe768fb1be1a => {
620                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
621                        let mut req = fidl::new_empty!(
622                            fidl::encoding::EmptyPayload,
623                            fidl::encoding::DefaultFuchsiaResourceDialect
624                        );
625                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
626                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
627                        Ok(UtilRequest::GetEnvironmentCount {
628                            responder: UtilGetEnvironmentCountResponder {
629                                control_handle: std::mem::ManuallyDrop::new(control_handle),
630                                tx_id: header.tx_id,
631                            },
632                        })
633                    }
634                    0x73826cecc1a7f3a4 => {
635                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
636                        let mut req = fidl::new_empty!(
637                            fidl::encoding::EmptyPayload,
638                            fidl::encoding::DefaultFuchsiaResourceDialect
639                        );
640                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
641                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
642                        Ok(UtilRequest::DumpNamespace {
643                            responder: UtilDumpNamespaceResponder {
644                                control_handle: std::mem::ManuallyDrop::new(control_handle),
645                                tx_id: header.tx_id,
646                            },
647                        })
648                    }
649                    0x2ea8e2e4b427a391 => {
650                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
651                        let mut req = fidl::new_empty!(
652                            UtilReadFileRequest,
653                            fidl::encoding::DefaultFuchsiaResourceDialect
654                        );
655                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UtilReadFileRequest>(&header, _body_bytes, handles, &mut req)?;
656                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
657                        Ok(UtilRequest::ReadFile {
658                            path: req.path,
659
660                            responder: UtilReadFileResponder {
661                                control_handle: std::mem::ManuallyDrop::new(control_handle),
662                                tx_id: header.tx_id,
663                            },
664                        })
665                    }
666                    0xdaecfc0fe4c8f60 => {
667                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
668                        let mut req = fidl::new_empty!(
669                            fidl::encoding::EmptyPayload,
670                            fidl::encoding::DefaultFuchsiaResourceDialect
671                        );
672                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
673                        let control_handle = UtilControlHandle { inner: this.inner.clone() };
674                        Ok(UtilRequest::GetLifecycleKoid {
675                            responder: UtilGetLifecycleKoidResponder {
676                                control_handle: std::mem::ManuallyDrop::new(control_handle),
677                                tx_id: header.tx_id,
678                            },
679                        })
680                    }
681                    _ => Err(fidl::Error::UnknownOrdinal {
682                        ordinal: header.ordinal,
683                        protocol_name: <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
684                    }),
685                }))
686            },
687        )
688    }
689}
690
691#[derive(Debug)]
692pub enum UtilRequest {
693    GetArguments { responder: UtilGetArgumentsResponder },
694    GetArgumentCount { responder: UtilGetArgumentCountResponder },
695    GetEnvironment { responder: UtilGetEnvironmentResponder },
696    GetEnvironmentCount { responder: UtilGetEnvironmentCountResponder },
697    DumpNamespace { responder: UtilDumpNamespaceResponder },
698    ReadFile { path: String, responder: UtilReadFileResponder },
699    GetLifecycleKoid { responder: UtilGetLifecycleKoidResponder },
700}
701
702impl UtilRequest {
703    #[allow(irrefutable_let_patterns)]
704    pub fn into_get_arguments(self) -> Option<(UtilGetArgumentsResponder)> {
705        if let UtilRequest::GetArguments { responder } = self { Some((responder)) } else { None }
706    }
707
708    #[allow(irrefutable_let_patterns)]
709    pub fn into_get_argument_count(self) -> Option<(UtilGetArgumentCountResponder)> {
710        if let UtilRequest::GetArgumentCount { responder } = self {
711            Some((responder))
712        } else {
713            None
714        }
715    }
716
717    #[allow(irrefutable_let_patterns)]
718    pub fn into_get_environment(self) -> Option<(UtilGetEnvironmentResponder)> {
719        if let UtilRequest::GetEnvironment { responder } = self { Some((responder)) } else { None }
720    }
721
722    #[allow(irrefutable_let_patterns)]
723    pub fn into_get_environment_count(self) -> Option<(UtilGetEnvironmentCountResponder)> {
724        if let UtilRequest::GetEnvironmentCount { responder } = self {
725            Some((responder))
726        } else {
727            None
728        }
729    }
730
731    #[allow(irrefutable_let_patterns)]
732    pub fn into_dump_namespace(self) -> Option<(UtilDumpNamespaceResponder)> {
733        if let UtilRequest::DumpNamespace { responder } = self { Some((responder)) } else { None }
734    }
735
736    #[allow(irrefutable_let_patterns)]
737    pub fn into_read_file(self) -> Option<(String, UtilReadFileResponder)> {
738        if let UtilRequest::ReadFile { path, responder } = self {
739            Some((path, responder))
740        } else {
741            None
742        }
743    }
744
745    #[allow(irrefutable_let_patterns)]
746    pub fn into_get_lifecycle_koid(self) -> Option<(UtilGetLifecycleKoidResponder)> {
747        if let UtilRequest::GetLifecycleKoid { responder } = self {
748            Some((responder))
749        } else {
750            None
751        }
752    }
753
754    /// Name of the method defined in FIDL
755    pub fn method_name(&self) -> &'static str {
756        match *self {
757            UtilRequest::GetArguments { .. } => "get_arguments",
758            UtilRequest::GetArgumentCount { .. } => "get_argument_count",
759            UtilRequest::GetEnvironment { .. } => "get_environment",
760            UtilRequest::GetEnvironmentCount { .. } => "get_environment_count",
761            UtilRequest::DumpNamespace { .. } => "dump_namespace",
762            UtilRequest::ReadFile { .. } => "read_file",
763            UtilRequest::GetLifecycleKoid { .. } => "get_lifecycle_koid",
764        }
765    }
766}
767
768#[derive(Debug, Clone)]
769pub struct UtilControlHandle {
770    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
771}
772
773impl UtilControlHandle {
774    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
775        self.inner.shutdown_with_epitaph(status.into())
776    }
777}
778
779impl fidl::endpoints::ControlHandle for UtilControlHandle {
780    fn shutdown(&self) {
781        self.inner.shutdown()
782    }
783
784    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
785        self.inner.shutdown_with_epitaph(status)
786    }
787
788    fn is_closed(&self) -> bool {
789        self.inner.channel().is_closed()
790    }
791    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
792        self.inner.channel().on_closed()
793    }
794
795    #[cfg(target_os = "fuchsia")]
796    fn signal_peer(
797        &self,
798        clear_mask: zx::Signals,
799        set_mask: zx::Signals,
800    ) -> Result<(), zx_status::Status> {
801        use fidl::Peered;
802        self.inner.channel().signal_peer(clear_mask, set_mask)
803    }
804}
805
806impl UtilControlHandle {}
807
808#[must_use = "FIDL methods require a response to be sent"]
809#[derive(Debug)]
810pub struct UtilGetArgumentsResponder {
811    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
812    tx_id: u32,
813}
814
815/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
816/// if the responder is dropped without sending a response, so that the client
817/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
818impl std::ops::Drop for UtilGetArgumentsResponder {
819    fn drop(&mut self) {
820        self.control_handle.shutdown();
821        // Safety: drops once, never accessed again
822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
823    }
824}
825
826impl fidl::endpoints::Responder for UtilGetArgumentsResponder {
827    type ControlHandle = UtilControlHandle;
828
829    fn control_handle(&self) -> &UtilControlHandle {
830        &self.control_handle
831    }
832
833    fn drop_without_shutdown(mut self) {
834        // Safety: drops once, never accessed again due to mem::forget
835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
836        // Prevent Drop from running (which would shut down the channel)
837        std::mem::forget(self);
838    }
839}
840
841impl UtilGetArgumentsResponder {
842    /// Sends a response to the FIDL transaction.
843    ///
844    /// Sets the channel to shutdown if an error occurs.
845    pub fn send(self, mut args: &[String]) -> Result<(), fidl::Error> {
846        let _result = self.send_raw(args);
847        if _result.is_err() {
848            self.control_handle.shutdown();
849        }
850        self.drop_without_shutdown();
851        _result
852    }
853
854    /// Similar to "send" but does not shutdown the channel if an error occurs.
855    pub fn send_no_shutdown_on_err(self, mut args: &[String]) -> Result<(), fidl::Error> {
856        let _result = self.send_raw(args);
857        self.drop_without_shutdown();
858        _result
859    }
860
861    fn send_raw(&self, mut args: &[String]) -> Result<(), fidl::Error> {
862        self.control_handle.inner.send::<UtilGetArgumentsResponse>(
863            (args,),
864            self.tx_id,
865            0x50ff7f790c425519,
866            fidl::encoding::DynamicFlags::empty(),
867        )
868    }
869}
870
871#[must_use = "FIDL methods require a response to be sent"]
872#[derive(Debug)]
873pub struct UtilGetArgumentCountResponder {
874    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
875    tx_id: u32,
876}
877
878/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
879/// if the responder is dropped without sending a response, so that the client
880/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
881impl std::ops::Drop for UtilGetArgumentCountResponder {
882    fn drop(&mut self) {
883        self.control_handle.shutdown();
884        // Safety: drops once, never accessed again
885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
886    }
887}
888
889impl fidl::endpoints::Responder for UtilGetArgumentCountResponder {
890    type ControlHandle = UtilControlHandle;
891
892    fn control_handle(&self) -> &UtilControlHandle {
893        &self.control_handle
894    }
895
896    fn drop_without_shutdown(mut self) {
897        // Safety: drops once, never accessed again due to mem::forget
898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
899        // Prevent Drop from running (which would shut down the channel)
900        std::mem::forget(self);
901    }
902}
903
904impl UtilGetArgumentCountResponder {
905    /// Sends a response to the FIDL transaction.
906    ///
907    /// Sets the channel to shutdown if an error occurs.
908    pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
909        let _result = self.send_raw(count);
910        if _result.is_err() {
911            self.control_handle.shutdown();
912        }
913        self.drop_without_shutdown();
914        _result
915    }
916
917    /// Similar to "send" but does not shutdown the channel if an error occurs.
918    pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
919        let _result = self.send_raw(count);
920        self.drop_without_shutdown();
921        _result
922    }
923
924    fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
925        self.control_handle.inner.send::<UtilGetArgumentCountResponse>(
926            (count,),
927            self.tx_id,
928            0x41ef27d234ed7098,
929            fidl::encoding::DynamicFlags::empty(),
930        )
931    }
932}
933
934#[must_use = "FIDL methods require a response to be sent"]
935#[derive(Debug)]
936pub struct UtilGetEnvironmentResponder {
937    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
938    tx_id: u32,
939}
940
941/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
942/// if the responder is dropped without sending a response, so that the client
943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
944impl std::ops::Drop for UtilGetEnvironmentResponder {
945    fn drop(&mut self) {
946        self.control_handle.shutdown();
947        // Safety: drops once, never accessed again
948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
949    }
950}
951
952impl fidl::endpoints::Responder for UtilGetEnvironmentResponder {
953    type ControlHandle = UtilControlHandle;
954
955    fn control_handle(&self) -> &UtilControlHandle {
956        &self.control_handle
957    }
958
959    fn drop_without_shutdown(mut self) {
960        // Safety: drops once, never accessed again due to mem::forget
961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
962        // Prevent Drop from running (which would shut down the channel)
963        std::mem::forget(self);
964    }
965}
966
967impl UtilGetEnvironmentResponder {
968    /// Sends a response to the FIDL transaction.
969    ///
970    /// Sets the channel to shutdown if an error occurs.
971    pub fn send(self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
972        let _result = self.send_raw(vars);
973        if _result.is_err() {
974            self.control_handle.shutdown();
975        }
976        self.drop_without_shutdown();
977        _result
978    }
979
980    /// Similar to "send" but does not shutdown the channel if an error occurs.
981    pub fn send_no_shutdown_on_err(self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
982        let _result = self.send_raw(vars);
983        self.drop_without_shutdown();
984        _result
985    }
986
987    fn send_raw(&self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
988        self.control_handle.inner.send::<UtilGetEnvironmentResponse>(
989            (vars,),
990            self.tx_id,
991            0x451e633adf04ec23,
992            fidl::encoding::DynamicFlags::empty(),
993        )
994    }
995}
996
997#[must_use = "FIDL methods require a response to be sent"]
998#[derive(Debug)]
999pub struct UtilGetEnvironmentCountResponder {
1000    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1001    tx_id: u32,
1002}
1003
1004/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
1005/// if the responder is dropped without sending a response, so that the client
1006/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1007impl std::ops::Drop for UtilGetEnvironmentCountResponder {
1008    fn drop(&mut self) {
1009        self.control_handle.shutdown();
1010        // Safety: drops once, never accessed again
1011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012    }
1013}
1014
1015impl fidl::endpoints::Responder for UtilGetEnvironmentCountResponder {
1016    type ControlHandle = UtilControlHandle;
1017
1018    fn control_handle(&self) -> &UtilControlHandle {
1019        &self.control_handle
1020    }
1021
1022    fn drop_without_shutdown(mut self) {
1023        // Safety: drops once, never accessed again due to mem::forget
1024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025        // Prevent Drop from running (which would shut down the channel)
1026        std::mem::forget(self);
1027    }
1028}
1029
1030impl UtilGetEnvironmentCountResponder {
1031    /// Sends a response to the FIDL transaction.
1032    ///
1033    /// Sets the channel to shutdown if an error occurs.
1034    pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
1035        let _result = self.send_raw(count);
1036        if _result.is_err() {
1037            self.control_handle.shutdown();
1038        }
1039        self.drop_without_shutdown();
1040        _result
1041    }
1042
1043    /// Similar to "send" but does not shutdown the channel if an error occurs.
1044    pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
1045        let _result = self.send_raw(count);
1046        self.drop_without_shutdown();
1047        _result
1048    }
1049
1050    fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
1051        self.control_handle.inner.send::<UtilGetEnvironmentCountResponse>(
1052            (count,),
1053            self.tx_id,
1054            0xe01fe768fb1be1a,
1055            fidl::encoding::DynamicFlags::empty(),
1056        )
1057    }
1058}
1059
1060#[must_use = "FIDL methods require a response to be sent"]
1061#[derive(Debug)]
1062pub struct UtilDumpNamespaceResponder {
1063    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1064    tx_id: u32,
1065}
1066
1067/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
1068/// if the responder is dropped without sending a response, so that the client
1069/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1070impl std::ops::Drop for UtilDumpNamespaceResponder {
1071    fn drop(&mut self) {
1072        self.control_handle.shutdown();
1073        // Safety: drops once, never accessed again
1074        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1075    }
1076}
1077
1078impl fidl::endpoints::Responder for UtilDumpNamespaceResponder {
1079    type ControlHandle = UtilControlHandle;
1080
1081    fn control_handle(&self) -> &UtilControlHandle {
1082        &self.control_handle
1083    }
1084
1085    fn drop_without_shutdown(mut self) {
1086        // Safety: drops once, never accessed again due to mem::forget
1087        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1088        // Prevent Drop from running (which would shut down the channel)
1089        std::mem::forget(self);
1090    }
1091}
1092
1093impl UtilDumpNamespaceResponder {
1094    /// Sends a response to the FIDL transaction.
1095    ///
1096    /// Sets the channel to shutdown if an error occurs.
1097    pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
1098        let _result = self.send_raw(contents);
1099        if _result.is_err() {
1100            self.control_handle.shutdown();
1101        }
1102        self.drop_without_shutdown();
1103        _result
1104    }
1105
1106    /// Similar to "send" but does not shutdown the channel if an error occurs.
1107    pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
1108        let _result = self.send_raw(contents);
1109        self.drop_without_shutdown();
1110        _result
1111    }
1112
1113    fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
1114        self.control_handle.inner.send::<UtilDumpNamespaceResponse>(
1115            (contents,),
1116            self.tx_id,
1117            0x73826cecc1a7f3a4,
1118            fidl::encoding::DynamicFlags::empty(),
1119        )
1120    }
1121}
1122
1123#[must_use = "FIDL methods require a response to be sent"]
1124#[derive(Debug)]
1125pub struct UtilReadFileResponder {
1126    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1127    tx_id: u32,
1128}
1129
1130/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
1131/// if the responder is dropped without sending a response, so that the client
1132/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1133impl std::ops::Drop for UtilReadFileResponder {
1134    fn drop(&mut self) {
1135        self.control_handle.shutdown();
1136        // Safety: drops once, never accessed again
1137        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1138    }
1139}
1140
1141impl fidl::endpoints::Responder for UtilReadFileResponder {
1142    type ControlHandle = UtilControlHandle;
1143
1144    fn control_handle(&self) -> &UtilControlHandle {
1145        &self.control_handle
1146    }
1147
1148    fn drop_without_shutdown(mut self) {
1149        // Safety: drops once, never accessed again due to mem::forget
1150        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1151        // Prevent Drop from running (which would shut down the channel)
1152        std::mem::forget(self);
1153    }
1154}
1155
1156impl UtilReadFileResponder {
1157    /// Sends a response to the FIDL transaction.
1158    ///
1159    /// Sets the channel to shutdown if an error occurs.
1160    pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
1161        let _result = self.send_raw(contents);
1162        if _result.is_err() {
1163            self.control_handle.shutdown();
1164        }
1165        self.drop_without_shutdown();
1166        _result
1167    }
1168
1169    /// Similar to "send" but does not shutdown the channel if an error occurs.
1170    pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
1171        let _result = self.send_raw(contents);
1172        self.drop_without_shutdown();
1173        _result
1174    }
1175
1176    fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
1177        self.control_handle.inner.send::<UtilReadFileResponse>(
1178            (contents,),
1179            self.tx_id,
1180            0x2ea8e2e4b427a391,
1181            fidl::encoding::DynamicFlags::empty(),
1182        )
1183    }
1184}
1185
1186#[must_use = "FIDL methods require a response to be sent"]
1187#[derive(Debug)]
1188pub struct UtilGetLifecycleKoidResponder {
1189    control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1190    tx_id: u32,
1191}
1192
1193/// Set the the channel to be shutdown (see [`UtilControlHandle::shutdown`])
1194/// if the responder is dropped without sending a response, so that the client
1195/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1196impl std::ops::Drop for UtilGetLifecycleKoidResponder {
1197    fn drop(&mut self) {
1198        self.control_handle.shutdown();
1199        // Safety: drops once, never accessed again
1200        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1201    }
1202}
1203
1204impl fidl::endpoints::Responder for UtilGetLifecycleKoidResponder {
1205    type ControlHandle = UtilControlHandle;
1206
1207    fn control_handle(&self) -> &UtilControlHandle {
1208        &self.control_handle
1209    }
1210
1211    fn drop_without_shutdown(mut self) {
1212        // Safety: drops once, never accessed again due to mem::forget
1213        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1214        // Prevent Drop from running (which would shut down the channel)
1215        std::mem::forget(self);
1216    }
1217}
1218
1219impl UtilGetLifecycleKoidResponder {
1220    /// Sends a response to the FIDL transaction.
1221    ///
1222    /// Sets the channel to shutdown if an error occurs.
1223    pub fn send(self, mut koid: u64) -> Result<(), fidl::Error> {
1224        let _result = self.send_raw(koid);
1225        if _result.is_err() {
1226            self.control_handle.shutdown();
1227        }
1228        self.drop_without_shutdown();
1229        _result
1230    }
1231
1232    /// Similar to "send" but does not shutdown the channel if an error occurs.
1233    pub fn send_no_shutdown_on_err(self, mut koid: u64) -> Result<(), fidl::Error> {
1234        let _result = self.send_raw(koid);
1235        self.drop_without_shutdown();
1236        _result
1237    }
1238
1239    fn send_raw(&self, mut koid: u64) -> Result<(), fidl::Error> {
1240        self.control_handle.inner.send::<UtilGetLifecycleKoidResponse>(
1241            (koid,),
1242            self.tx_id,
1243            0xdaecfc0fe4c8f60,
1244            fidl::encoding::DynamicFlags::empty(),
1245        )
1246    }
1247}
1248
1249mod internal {
1250    use super::*;
1251}