fidl_fuchsia_sys2/
fidl_fuchsia_sys2.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_fuchsia_sys2__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15#[repr(C)]
16pub struct CrashIntrospectFindComponentByThreadKoidRequest {
17    pub thread_koid: u64,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for CrashIntrospectFindComponentByThreadKoidRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct LifecycleControllerCreateInstanceRequest {
27    pub parent_moniker: String,
28    pub collection: fidl_fuchsia_component_decl::CollectionRef,
29    pub decl: fidl_fuchsia_component_decl::Child,
30    pub args: fidl_fuchsia_component::CreateChildArgs,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34    for LifecycleControllerCreateInstanceRequest
35{
36}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct LifecycleControllerStartInstanceRequest {
40    pub moniker: String,
41    pub binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for LifecycleControllerStartInstanceRequest
46{
47}
48
49#[derive(Debug, PartialEq)]
50pub struct LifecycleControllerStartInstanceWithArgsRequest {
51    pub moniker: String,
52    pub binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
53    pub args: fidl_fuchsia_component::StartChildArgs,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
57    for LifecycleControllerStartInstanceWithArgsRequest
58{
59}
60
61#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
62pub struct RealmQueryConnectToStorageAdminRequest {
63    pub moniker: String,
64    pub storage_name: String,
65    pub server_end: fidl::endpoints::ServerEnd<StorageAdminMarker>,
66}
67
68impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
69    for RealmQueryConnectToStorageAdminRequest
70{
71}
72
73#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
74pub struct RealmQueryOpenDirectoryRequest {
75    pub moniker: String,
76    pub dir_type: OpenDirType,
77    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
81    for RealmQueryOpenDirectoryRequest
82{
83}
84
85#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct RealmQueryOpenStorageAdminRequest {
87    pub moniker: String,
88    pub storage_name: String,
89    pub server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for RealmQueryOpenStorageAdminRequest
94{
95}
96
97#[derive(Debug, PartialEq)]
98pub struct RealmQueryConstructNamespaceResponse {
99    /// The directory handles + paths that constitute the component's namespace.
100    pub namespace: Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>,
101}
102
103impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
104    for RealmQueryConstructNamespaceResponse
105{
106}
107
108#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
109pub struct RealmQueryGetAllInstancesResponse {
110    pub iterator: fidl::endpoints::ClientEnd<InstanceIteratorMarker>,
111}
112
113impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
114    for RealmQueryGetAllInstancesResponse
115{
116}
117
118#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct RealmQueryGetResolvedDeclarationResponse {
120    pub iterator: fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
121}
122
123impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
124    for RealmQueryGetResolvedDeclarationResponse
125{
126}
127
128#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
129pub struct RealmQueryResolveDeclarationResponse {
130    pub iterator: fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
131}
132
133impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
134    for RealmQueryResolveDeclarationResponse
135{
136}
137
138#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
139pub struct StorageAdminListStorageInRealmRequest {
140    pub relative_moniker: String,
141    pub iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
142}
143
144impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
145    for StorageAdminListStorageInRealmRequest
146{
147}
148
149#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
150pub struct StorageAdminOpenComponentStorageByIdRequest {
151    pub id: String,
152    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
153}
154
155impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
156    for StorageAdminOpenComponentStorageByIdRequest
157{
158}
159
160#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
161pub struct StorageAdminOpenStorageRequest {
162    pub relative_moniker: String,
163    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
164}
165
166impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
167    for StorageAdminOpenStorageRequest
168{
169}
170
171#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
172pub struct BootControllerMarker;
173
174impl fidl::endpoints::ProtocolMarker for BootControllerMarker {
175    type Proxy = BootControllerProxy;
176    type RequestStream = BootControllerRequestStream;
177    #[cfg(target_os = "fuchsia")]
178    type SynchronousProxy = BootControllerSynchronousProxy;
179
180    const DEBUG_NAME: &'static str = "fuchsia.sys2.BootController";
181}
182impl fidl::endpoints::DiscoverableProtocolMarker for BootControllerMarker {}
183
184pub trait BootControllerProxyInterface: Send + Sync {
185    type NotifyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
186    fn r#notify(&self) -> Self::NotifyResponseFut;
187}
188#[derive(Debug)]
189#[cfg(target_os = "fuchsia")]
190pub struct BootControllerSynchronousProxy {
191    client: fidl::client::sync::Client,
192}
193
194#[cfg(target_os = "fuchsia")]
195impl fidl::endpoints::SynchronousProxy for BootControllerSynchronousProxy {
196    type Proxy = BootControllerProxy;
197    type Protocol = BootControllerMarker;
198
199    fn from_channel(inner: fidl::Channel) -> Self {
200        Self::new(inner)
201    }
202
203    fn into_channel(self) -> fidl::Channel {
204        self.client.into_channel()
205    }
206
207    fn as_channel(&self) -> &fidl::Channel {
208        self.client.as_channel()
209    }
210}
211
212#[cfg(target_os = "fuchsia")]
213impl BootControllerSynchronousProxy {
214    pub fn new(channel: fidl::Channel) -> Self {
215        let protocol_name = <BootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
216        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
217    }
218
219    pub fn into_channel(self) -> fidl::Channel {
220        self.client.into_channel()
221    }
222
223    /// Waits until an event arrives and returns it. It is safe for other
224    /// threads to make concurrent requests while waiting for an event.
225    pub fn wait_for_event(
226        &self,
227        deadline: zx::MonotonicInstant,
228    ) -> Result<BootControllerEvent, fidl::Error> {
229        BootControllerEvent::decode(self.client.wait_for_event(deadline)?)
230    }
231
232    pub fn r#notify(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
233        let _response = self.client.send_query::<
234            fidl::encoding::EmptyPayload,
235            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
236        >(
237            (),
238            0x55173ddd1d9ed8de,
239            fidl::encoding::DynamicFlags::FLEXIBLE,
240            ___deadline,
241        )?
242        .into_result::<BootControllerMarker>("notify")?;
243        Ok(_response)
244    }
245}
246
247#[cfg(target_os = "fuchsia")]
248impl From<BootControllerSynchronousProxy> for zx::NullableHandle {
249    fn from(value: BootControllerSynchronousProxy) -> Self {
250        value.into_channel().into()
251    }
252}
253
254#[cfg(target_os = "fuchsia")]
255impl From<fidl::Channel> for BootControllerSynchronousProxy {
256    fn from(value: fidl::Channel) -> Self {
257        Self::new(value)
258    }
259}
260
261#[cfg(target_os = "fuchsia")]
262impl fidl::endpoints::FromClient for BootControllerSynchronousProxy {
263    type Protocol = BootControllerMarker;
264
265    fn from_client(value: fidl::endpoints::ClientEnd<BootControllerMarker>) -> Self {
266        Self::new(value.into_channel())
267    }
268}
269
270#[derive(Debug, Clone)]
271pub struct BootControllerProxy {
272    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
273}
274
275impl fidl::endpoints::Proxy for BootControllerProxy {
276    type Protocol = BootControllerMarker;
277
278    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
279        Self::new(inner)
280    }
281
282    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
283        self.client.into_channel().map_err(|client| Self { client })
284    }
285
286    fn as_channel(&self) -> &::fidl::AsyncChannel {
287        self.client.as_channel()
288    }
289}
290
291impl BootControllerProxy {
292    /// Create a new Proxy for fuchsia.sys2/BootController.
293    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
294        let protocol_name = <BootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
295        Self { client: fidl::client::Client::new(channel, protocol_name) }
296    }
297
298    /// Get a Stream of events from the remote end of the protocol.
299    ///
300    /// # Panics
301    ///
302    /// Panics if the event stream was already taken.
303    pub fn take_event_stream(&self) -> BootControllerEventStream {
304        BootControllerEventStream { event_receiver: self.client.take_event_receiver() }
305    }
306
307    pub fn r#notify(
308        &self,
309    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
310        BootControllerProxyInterface::r#notify(self)
311    }
312}
313
314impl BootControllerProxyInterface for BootControllerProxy {
315    type NotifyResponseFut =
316        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
317    fn r#notify(&self) -> Self::NotifyResponseFut {
318        fn _decode(
319            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
320        ) -> Result<(), fidl::Error> {
321            let _response = fidl::client::decode_transaction_body::<
322                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
323                fidl::encoding::DefaultFuchsiaResourceDialect,
324                0x55173ddd1d9ed8de,
325            >(_buf?)?
326            .into_result::<BootControllerMarker>("notify")?;
327            Ok(_response)
328        }
329        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
330            (),
331            0x55173ddd1d9ed8de,
332            fidl::encoding::DynamicFlags::FLEXIBLE,
333            _decode,
334        )
335    }
336}
337
338pub struct BootControllerEventStream {
339    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
340}
341
342impl std::marker::Unpin for BootControllerEventStream {}
343
344impl futures::stream::FusedStream for BootControllerEventStream {
345    fn is_terminated(&self) -> bool {
346        self.event_receiver.is_terminated()
347    }
348}
349
350impl futures::Stream for BootControllerEventStream {
351    type Item = Result<BootControllerEvent, fidl::Error>;
352
353    fn poll_next(
354        mut self: std::pin::Pin<&mut Self>,
355        cx: &mut std::task::Context<'_>,
356    ) -> std::task::Poll<Option<Self::Item>> {
357        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
358            &mut self.event_receiver,
359            cx
360        )?) {
361            Some(buf) => std::task::Poll::Ready(Some(BootControllerEvent::decode(buf))),
362            None => std::task::Poll::Ready(None),
363        }
364    }
365}
366
367#[derive(Debug)]
368pub enum BootControllerEvent {
369    #[non_exhaustive]
370    _UnknownEvent {
371        /// Ordinal of the event that was sent.
372        ordinal: u64,
373    },
374}
375
376impl BootControllerEvent {
377    /// Decodes a message buffer as a [`BootControllerEvent`].
378    fn decode(
379        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
380    ) -> Result<BootControllerEvent, fidl::Error> {
381        let (bytes, _handles) = buf.split_mut();
382        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
383        debug_assert_eq!(tx_header.tx_id, 0);
384        match tx_header.ordinal {
385            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
386                Ok(BootControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
387            }
388            _ => Err(fidl::Error::UnknownOrdinal {
389                ordinal: tx_header.ordinal,
390                protocol_name:
391                    <BootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
392            }),
393        }
394    }
395}
396
397/// A Stream of incoming requests for fuchsia.sys2/BootController.
398pub struct BootControllerRequestStream {
399    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
400    is_terminated: bool,
401}
402
403impl std::marker::Unpin for BootControllerRequestStream {}
404
405impl futures::stream::FusedStream for BootControllerRequestStream {
406    fn is_terminated(&self) -> bool {
407        self.is_terminated
408    }
409}
410
411impl fidl::endpoints::RequestStream for BootControllerRequestStream {
412    type Protocol = BootControllerMarker;
413    type ControlHandle = BootControllerControlHandle;
414
415    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
416        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
417    }
418
419    fn control_handle(&self) -> Self::ControlHandle {
420        BootControllerControlHandle { inner: self.inner.clone() }
421    }
422
423    fn into_inner(
424        self,
425    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
426    {
427        (self.inner, self.is_terminated)
428    }
429
430    fn from_inner(
431        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
432        is_terminated: bool,
433    ) -> Self {
434        Self { inner, is_terminated }
435    }
436}
437
438impl futures::Stream for BootControllerRequestStream {
439    type Item = Result<BootControllerRequest, fidl::Error>;
440
441    fn poll_next(
442        mut self: std::pin::Pin<&mut Self>,
443        cx: &mut std::task::Context<'_>,
444    ) -> std::task::Poll<Option<Self::Item>> {
445        let this = &mut *self;
446        if this.inner.check_shutdown(cx) {
447            this.is_terminated = true;
448            return std::task::Poll::Ready(None);
449        }
450        if this.is_terminated {
451            panic!("polled BootControllerRequestStream after completion");
452        }
453        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
454            |bytes, handles| {
455                match this.inner.channel().read_etc(cx, bytes, handles) {
456                    std::task::Poll::Ready(Ok(())) => {}
457                    std::task::Poll::Pending => return std::task::Poll::Pending,
458                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
459                        this.is_terminated = true;
460                        return std::task::Poll::Ready(None);
461                    }
462                    std::task::Poll::Ready(Err(e)) => {
463                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
464                            e.into(),
465                        ))));
466                    }
467                }
468
469                // A message has been received from the channel
470                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
471
472                std::task::Poll::Ready(Some(match header.ordinal {
473                    0x55173ddd1d9ed8de => {
474                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
475                        let mut req = fidl::new_empty!(
476                            fidl::encoding::EmptyPayload,
477                            fidl::encoding::DefaultFuchsiaResourceDialect
478                        );
479                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
480                        let control_handle =
481                            BootControllerControlHandle { inner: this.inner.clone() };
482                        Ok(BootControllerRequest::Notify {
483                            responder: BootControllerNotifyResponder {
484                                control_handle: std::mem::ManuallyDrop::new(control_handle),
485                                tx_id: header.tx_id,
486                            },
487                        })
488                    }
489                    _ if header.tx_id == 0
490                        && header
491                            .dynamic_flags()
492                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
493                    {
494                        Ok(BootControllerRequest::_UnknownMethod {
495                            ordinal: header.ordinal,
496                            control_handle: BootControllerControlHandle {
497                                inner: this.inner.clone(),
498                            },
499                            method_type: fidl::MethodType::OneWay,
500                        })
501                    }
502                    _ if header
503                        .dynamic_flags()
504                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
505                    {
506                        this.inner.send_framework_err(
507                            fidl::encoding::FrameworkErr::UnknownMethod,
508                            header.tx_id,
509                            header.ordinal,
510                            header.dynamic_flags(),
511                            (bytes, handles),
512                        )?;
513                        Ok(BootControllerRequest::_UnknownMethod {
514                            ordinal: header.ordinal,
515                            control_handle: BootControllerControlHandle {
516                                inner: this.inner.clone(),
517                            },
518                            method_type: fidl::MethodType::TwoWay,
519                        })
520                    }
521                    _ => Err(fidl::Error::UnknownOrdinal {
522                        ordinal: header.ordinal,
523                        protocol_name:
524                            <BootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
525                    }),
526                }))
527            },
528        )
529    }
530}
531
532#[derive(Debug)]
533pub enum BootControllerRequest {
534    Notify {
535        responder: BootControllerNotifyResponder,
536    },
537    /// An interaction was received which does not match any known method.
538    #[non_exhaustive]
539    _UnknownMethod {
540        /// Ordinal of the method that was called.
541        ordinal: u64,
542        control_handle: BootControllerControlHandle,
543        method_type: fidl::MethodType,
544    },
545}
546
547impl BootControllerRequest {
548    #[allow(irrefutable_let_patterns)]
549    pub fn into_notify(self) -> Option<(BootControllerNotifyResponder)> {
550        if let BootControllerRequest::Notify { responder } = self {
551            Some((responder))
552        } else {
553            None
554        }
555    }
556
557    /// Name of the method defined in FIDL
558    pub fn method_name(&self) -> &'static str {
559        match *self {
560            BootControllerRequest::Notify { .. } => "notify",
561            BootControllerRequest::_UnknownMethod {
562                method_type: fidl::MethodType::OneWay, ..
563            } => "unknown one-way method",
564            BootControllerRequest::_UnknownMethod {
565                method_type: fidl::MethodType::TwoWay, ..
566            } => "unknown two-way method",
567        }
568    }
569}
570
571#[derive(Debug, Clone)]
572pub struct BootControllerControlHandle {
573    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
574}
575
576impl fidl::endpoints::ControlHandle for BootControllerControlHandle {
577    fn shutdown(&self) {
578        self.inner.shutdown()
579    }
580
581    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
582        self.inner.shutdown_with_epitaph(status)
583    }
584
585    fn is_closed(&self) -> bool {
586        self.inner.channel().is_closed()
587    }
588    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
589        self.inner.channel().on_closed()
590    }
591
592    #[cfg(target_os = "fuchsia")]
593    fn signal_peer(
594        &self,
595        clear_mask: zx::Signals,
596        set_mask: zx::Signals,
597    ) -> Result<(), zx_status::Status> {
598        use fidl::Peered;
599        self.inner.channel().signal_peer(clear_mask, set_mask)
600    }
601}
602
603impl BootControllerControlHandle {}
604
605#[must_use = "FIDL methods require a response to be sent"]
606#[derive(Debug)]
607pub struct BootControllerNotifyResponder {
608    control_handle: std::mem::ManuallyDrop<BootControllerControlHandle>,
609    tx_id: u32,
610}
611
612/// Set the the channel to be shutdown (see [`BootControllerControlHandle::shutdown`])
613/// if the responder is dropped without sending a response, so that the client
614/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
615impl std::ops::Drop for BootControllerNotifyResponder {
616    fn drop(&mut self) {
617        self.control_handle.shutdown();
618        // Safety: drops once, never accessed again
619        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
620    }
621}
622
623impl fidl::endpoints::Responder for BootControllerNotifyResponder {
624    type ControlHandle = BootControllerControlHandle;
625
626    fn control_handle(&self) -> &BootControllerControlHandle {
627        &self.control_handle
628    }
629
630    fn drop_without_shutdown(mut self) {
631        // Safety: drops once, never accessed again due to mem::forget
632        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
633        // Prevent Drop from running (which would shut down the channel)
634        std::mem::forget(self);
635    }
636}
637
638impl BootControllerNotifyResponder {
639    /// Sends a response to the FIDL transaction.
640    ///
641    /// Sets the channel to shutdown if an error occurs.
642    pub fn send(self) -> Result<(), fidl::Error> {
643        let _result = self.send_raw();
644        if _result.is_err() {
645            self.control_handle.shutdown();
646        }
647        self.drop_without_shutdown();
648        _result
649    }
650
651    /// Similar to "send" but does not shutdown the channel if an error occurs.
652    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
653        let _result = self.send_raw();
654        self.drop_without_shutdown();
655        _result
656    }
657
658    fn send_raw(&self) -> Result<(), fidl::Error> {
659        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
660            fidl::encoding::Flexible::new(()),
661            self.tx_id,
662            0x55173ddd1d9ed8de,
663            fidl::encoding::DynamicFlags::FLEXIBLE,
664        )
665    }
666}
667
668#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
669pub struct ConfigOverrideMarker;
670
671impl fidl::endpoints::ProtocolMarker for ConfigOverrideMarker {
672    type Proxy = ConfigOverrideProxy;
673    type RequestStream = ConfigOverrideRequestStream;
674    #[cfg(target_os = "fuchsia")]
675    type SynchronousProxy = ConfigOverrideSynchronousProxy;
676
677    const DEBUG_NAME: &'static str = "fuchsia.sys2.ConfigOverride";
678}
679impl fidl::endpoints::DiscoverableProtocolMarker for ConfigOverrideMarker {}
680pub type ConfigOverrideSetStructuredConfigResult = Result<(), ConfigOverrideError>;
681pub type ConfigOverrideUnsetStructuredConfigResult = Result<(), ConfigOverrideError>;
682
683pub trait ConfigOverrideProxyInterface: Send + Sync {
684    type SetStructuredConfigResponseFut: std::future::Future<Output = Result<ConfigOverrideSetStructuredConfigResult, fidl::Error>>
685        + Send;
686    fn r#set_structured_config(
687        &self,
688        moniker: &str,
689        fields: &[fidl_fuchsia_component_decl::ConfigOverride],
690    ) -> Self::SetStructuredConfigResponseFut;
691    type UnsetStructuredConfigResponseFut: std::future::Future<Output = Result<ConfigOverrideUnsetStructuredConfigResult, fidl::Error>>
692        + Send;
693    fn r#unset_structured_config(&self, moniker: &str) -> Self::UnsetStructuredConfigResponseFut;
694}
695#[derive(Debug)]
696#[cfg(target_os = "fuchsia")]
697pub struct ConfigOverrideSynchronousProxy {
698    client: fidl::client::sync::Client,
699}
700
701#[cfg(target_os = "fuchsia")]
702impl fidl::endpoints::SynchronousProxy for ConfigOverrideSynchronousProxy {
703    type Proxy = ConfigOverrideProxy;
704    type Protocol = ConfigOverrideMarker;
705
706    fn from_channel(inner: fidl::Channel) -> Self {
707        Self::new(inner)
708    }
709
710    fn into_channel(self) -> fidl::Channel {
711        self.client.into_channel()
712    }
713
714    fn as_channel(&self) -> &fidl::Channel {
715        self.client.as_channel()
716    }
717}
718
719#[cfg(target_os = "fuchsia")]
720impl ConfigOverrideSynchronousProxy {
721    pub fn new(channel: fidl::Channel) -> Self {
722        let protocol_name = <ConfigOverrideMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
723        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
724    }
725
726    pub fn into_channel(self) -> fidl::Channel {
727        self.client.into_channel()
728    }
729
730    /// Waits until an event arrives and returns it. It is safe for other
731    /// threads to make concurrent requests while waiting for an event.
732    pub fn wait_for_event(
733        &self,
734        deadline: zx::MonotonicInstant,
735    ) -> Result<ConfigOverrideEvent, fidl::Error> {
736        ConfigOverrideEvent::decode(self.client.wait_for_event(deadline)?)
737    }
738
739    /// Sets structured configuration fields with override values for the
740    /// component instance identified by moniker.
741    pub fn r#set_structured_config(
742        &self,
743        mut moniker: &str,
744        mut fields: &[fidl_fuchsia_component_decl::ConfigOverride],
745        ___deadline: zx::MonotonicInstant,
746    ) -> Result<ConfigOverrideSetStructuredConfigResult, fidl::Error> {
747        let _response = self.client.send_query::<
748            ConfigOverrideSetStructuredConfigRequest,
749            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConfigOverrideError>,
750        >(
751            (moniker, fields,),
752            0x2c6a138832d2e0ee,
753            fidl::encoding::DynamicFlags::FLEXIBLE,
754            ___deadline,
755        )?
756        .into_result::<ConfigOverrideMarker>("set_structured_config")?;
757        Ok(_response.map(|x| x))
758    }
759
760    /// Unsets structured configuration overrides for the component instance
761    /// identified by moniker.  If an empty moniker is supplied, then all
762    /// structured configuration overrides will be cleared.
763    pub fn r#unset_structured_config(
764        &self,
765        mut moniker: &str,
766        ___deadline: zx::MonotonicInstant,
767    ) -> Result<ConfigOverrideUnsetStructuredConfigResult, fidl::Error> {
768        let _response = self.client.send_query::<
769            ConfigOverrideUnsetStructuredConfigRequest,
770            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConfigOverrideError>,
771        >(
772            (moniker,),
773            0x342ec7d2bef05552,
774            fidl::encoding::DynamicFlags::FLEXIBLE,
775            ___deadline,
776        )?
777        .into_result::<ConfigOverrideMarker>("unset_structured_config")?;
778        Ok(_response.map(|x| x))
779    }
780}
781
782#[cfg(target_os = "fuchsia")]
783impl From<ConfigOverrideSynchronousProxy> for zx::NullableHandle {
784    fn from(value: ConfigOverrideSynchronousProxy) -> Self {
785        value.into_channel().into()
786    }
787}
788
789#[cfg(target_os = "fuchsia")]
790impl From<fidl::Channel> for ConfigOverrideSynchronousProxy {
791    fn from(value: fidl::Channel) -> Self {
792        Self::new(value)
793    }
794}
795
796#[cfg(target_os = "fuchsia")]
797impl fidl::endpoints::FromClient for ConfigOverrideSynchronousProxy {
798    type Protocol = ConfigOverrideMarker;
799
800    fn from_client(value: fidl::endpoints::ClientEnd<ConfigOverrideMarker>) -> Self {
801        Self::new(value.into_channel())
802    }
803}
804
805#[derive(Debug, Clone)]
806pub struct ConfigOverrideProxy {
807    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
808}
809
810impl fidl::endpoints::Proxy for ConfigOverrideProxy {
811    type Protocol = ConfigOverrideMarker;
812
813    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
814        Self::new(inner)
815    }
816
817    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
818        self.client.into_channel().map_err(|client| Self { client })
819    }
820
821    fn as_channel(&self) -> &::fidl::AsyncChannel {
822        self.client.as_channel()
823    }
824}
825
826impl ConfigOverrideProxy {
827    /// Create a new Proxy for fuchsia.sys2/ConfigOverride.
828    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
829        let protocol_name = <ConfigOverrideMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
830        Self { client: fidl::client::Client::new(channel, protocol_name) }
831    }
832
833    /// Get a Stream of events from the remote end of the protocol.
834    ///
835    /// # Panics
836    ///
837    /// Panics if the event stream was already taken.
838    pub fn take_event_stream(&self) -> ConfigOverrideEventStream {
839        ConfigOverrideEventStream { event_receiver: self.client.take_event_receiver() }
840    }
841
842    /// Sets structured configuration fields with override values for the
843    /// component instance identified by moniker.
844    pub fn r#set_structured_config(
845        &self,
846        mut moniker: &str,
847        mut fields: &[fidl_fuchsia_component_decl::ConfigOverride],
848    ) -> fidl::client::QueryResponseFut<
849        ConfigOverrideSetStructuredConfigResult,
850        fidl::encoding::DefaultFuchsiaResourceDialect,
851    > {
852        ConfigOverrideProxyInterface::r#set_structured_config(self, moniker, fields)
853    }
854
855    /// Unsets structured configuration overrides for the component instance
856    /// identified by moniker.  If an empty moniker is supplied, then all
857    /// structured configuration overrides will be cleared.
858    pub fn r#unset_structured_config(
859        &self,
860        mut moniker: &str,
861    ) -> fidl::client::QueryResponseFut<
862        ConfigOverrideUnsetStructuredConfigResult,
863        fidl::encoding::DefaultFuchsiaResourceDialect,
864    > {
865        ConfigOverrideProxyInterface::r#unset_structured_config(self, moniker)
866    }
867}
868
869impl ConfigOverrideProxyInterface for ConfigOverrideProxy {
870    type SetStructuredConfigResponseFut = fidl::client::QueryResponseFut<
871        ConfigOverrideSetStructuredConfigResult,
872        fidl::encoding::DefaultFuchsiaResourceDialect,
873    >;
874    fn r#set_structured_config(
875        &self,
876        mut moniker: &str,
877        mut fields: &[fidl_fuchsia_component_decl::ConfigOverride],
878    ) -> Self::SetStructuredConfigResponseFut {
879        fn _decode(
880            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
881        ) -> Result<ConfigOverrideSetStructuredConfigResult, fidl::Error> {
882            let _response = fidl::client::decode_transaction_body::<
883                fidl::encoding::FlexibleResultType<
884                    fidl::encoding::EmptyStruct,
885                    ConfigOverrideError,
886                >,
887                fidl::encoding::DefaultFuchsiaResourceDialect,
888                0x2c6a138832d2e0ee,
889            >(_buf?)?
890            .into_result::<ConfigOverrideMarker>("set_structured_config")?;
891            Ok(_response.map(|x| x))
892        }
893        self.client.send_query_and_decode::<
894            ConfigOverrideSetStructuredConfigRequest,
895            ConfigOverrideSetStructuredConfigResult,
896        >(
897            (moniker, fields,),
898            0x2c6a138832d2e0ee,
899            fidl::encoding::DynamicFlags::FLEXIBLE,
900            _decode,
901        )
902    }
903
904    type UnsetStructuredConfigResponseFut = fidl::client::QueryResponseFut<
905        ConfigOverrideUnsetStructuredConfigResult,
906        fidl::encoding::DefaultFuchsiaResourceDialect,
907    >;
908    fn r#unset_structured_config(
909        &self,
910        mut moniker: &str,
911    ) -> Self::UnsetStructuredConfigResponseFut {
912        fn _decode(
913            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
914        ) -> Result<ConfigOverrideUnsetStructuredConfigResult, fidl::Error> {
915            let _response = fidl::client::decode_transaction_body::<
916                fidl::encoding::FlexibleResultType<
917                    fidl::encoding::EmptyStruct,
918                    ConfigOverrideError,
919                >,
920                fidl::encoding::DefaultFuchsiaResourceDialect,
921                0x342ec7d2bef05552,
922            >(_buf?)?
923            .into_result::<ConfigOverrideMarker>("unset_structured_config")?;
924            Ok(_response.map(|x| x))
925        }
926        self.client.send_query_and_decode::<
927            ConfigOverrideUnsetStructuredConfigRequest,
928            ConfigOverrideUnsetStructuredConfigResult,
929        >(
930            (moniker,),
931            0x342ec7d2bef05552,
932            fidl::encoding::DynamicFlags::FLEXIBLE,
933            _decode,
934        )
935    }
936}
937
938pub struct ConfigOverrideEventStream {
939    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
940}
941
942impl std::marker::Unpin for ConfigOverrideEventStream {}
943
944impl futures::stream::FusedStream for ConfigOverrideEventStream {
945    fn is_terminated(&self) -> bool {
946        self.event_receiver.is_terminated()
947    }
948}
949
950impl futures::Stream for ConfigOverrideEventStream {
951    type Item = Result<ConfigOverrideEvent, fidl::Error>;
952
953    fn poll_next(
954        mut self: std::pin::Pin<&mut Self>,
955        cx: &mut std::task::Context<'_>,
956    ) -> std::task::Poll<Option<Self::Item>> {
957        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
958            &mut self.event_receiver,
959            cx
960        )?) {
961            Some(buf) => std::task::Poll::Ready(Some(ConfigOverrideEvent::decode(buf))),
962            None => std::task::Poll::Ready(None),
963        }
964    }
965}
966
967#[derive(Debug)]
968pub enum ConfigOverrideEvent {
969    #[non_exhaustive]
970    _UnknownEvent {
971        /// Ordinal of the event that was sent.
972        ordinal: u64,
973    },
974}
975
976impl ConfigOverrideEvent {
977    /// Decodes a message buffer as a [`ConfigOverrideEvent`].
978    fn decode(
979        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
980    ) -> Result<ConfigOverrideEvent, fidl::Error> {
981        let (bytes, _handles) = buf.split_mut();
982        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
983        debug_assert_eq!(tx_header.tx_id, 0);
984        match tx_header.ordinal {
985            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
986                Ok(ConfigOverrideEvent::_UnknownEvent { ordinal: tx_header.ordinal })
987            }
988            _ => Err(fidl::Error::UnknownOrdinal {
989                ordinal: tx_header.ordinal,
990                protocol_name:
991                    <ConfigOverrideMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
992            }),
993        }
994    }
995}
996
997/// A Stream of incoming requests for fuchsia.sys2/ConfigOverride.
998pub struct ConfigOverrideRequestStream {
999    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1000    is_terminated: bool,
1001}
1002
1003impl std::marker::Unpin for ConfigOverrideRequestStream {}
1004
1005impl futures::stream::FusedStream for ConfigOverrideRequestStream {
1006    fn is_terminated(&self) -> bool {
1007        self.is_terminated
1008    }
1009}
1010
1011impl fidl::endpoints::RequestStream for ConfigOverrideRequestStream {
1012    type Protocol = ConfigOverrideMarker;
1013    type ControlHandle = ConfigOverrideControlHandle;
1014
1015    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1016        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1017    }
1018
1019    fn control_handle(&self) -> Self::ControlHandle {
1020        ConfigOverrideControlHandle { inner: self.inner.clone() }
1021    }
1022
1023    fn into_inner(
1024        self,
1025    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1026    {
1027        (self.inner, self.is_terminated)
1028    }
1029
1030    fn from_inner(
1031        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1032        is_terminated: bool,
1033    ) -> Self {
1034        Self { inner, is_terminated }
1035    }
1036}
1037
1038impl futures::Stream for ConfigOverrideRequestStream {
1039    type Item = Result<ConfigOverrideRequest, fidl::Error>;
1040
1041    fn poll_next(
1042        mut self: std::pin::Pin<&mut Self>,
1043        cx: &mut std::task::Context<'_>,
1044    ) -> std::task::Poll<Option<Self::Item>> {
1045        let this = &mut *self;
1046        if this.inner.check_shutdown(cx) {
1047            this.is_terminated = true;
1048            return std::task::Poll::Ready(None);
1049        }
1050        if this.is_terminated {
1051            panic!("polled ConfigOverrideRequestStream after completion");
1052        }
1053        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1054            |bytes, handles| {
1055                match this.inner.channel().read_etc(cx, bytes, handles) {
1056                    std::task::Poll::Ready(Ok(())) => {}
1057                    std::task::Poll::Pending => return std::task::Poll::Pending,
1058                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1059                        this.is_terminated = true;
1060                        return std::task::Poll::Ready(None);
1061                    }
1062                    std::task::Poll::Ready(Err(e)) => {
1063                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1064                            e.into(),
1065                        ))));
1066                    }
1067                }
1068
1069                // A message has been received from the channel
1070                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1071
1072                std::task::Poll::Ready(Some(match header.ordinal {
1073                    0x2c6a138832d2e0ee => {
1074                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1075                        let mut req = fidl::new_empty!(
1076                            ConfigOverrideSetStructuredConfigRequest,
1077                            fidl::encoding::DefaultFuchsiaResourceDialect
1078                        );
1079                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConfigOverrideSetStructuredConfigRequest>(&header, _body_bytes, handles, &mut req)?;
1080                        let control_handle =
1081                            ConfigOverrideControlHandle { inner: this.inner.clone() };
1082                        Ok(ConfigOverrideRequest::SetStructuredConfig {
1083                            moniker: req.moniker,
1084                            fields: req.fields,
1085
1086                            responder: ConfigOverrideSetStructuredConfigResponder {
1087                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1088                                tx_id: header.tx_id,
1089                            },
1090                        })
1091                    }
1092                    0x342ec7d2bef05552 => {
1093                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1094                        let mut req = fidl::new_empty!(
1095                            ConfigOverrideUnsetStructuredConfigRequest,
1096                            fidl::encoding::DefaultFuchsiaResourceDialect
1097                        );
1098                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConfigOverrideUnsetStructuredConfigRequest>(&header, _body_bytes, handles, &mut req)?;
1099                        let control_handle =
1100                            ConfigOverrideControlHandle { inner: this.inner.clone() };
1101                        Ok(ConfigOverrideRequest::UnsetStructuredConfig {
1102                            moniker: req.moniker,
1103
1104                            responder: ConfigOverrideUnsetStructuredConfigResponder {
1105                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1106                                tx_id: header.tx_id,
1107                            },
1108                        })
1109                    }
1110                    _ if header.tx_id == 0
1111                        && header
1112                            .dynamic_flags()
1113                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1114                    {
1115                        Ok(ConfigOverrideRequest::_UnknownMethod {
1116                            ordinal: header.ordinal,
1117                            control_handle: ConfigOverrideControlHandle {
1118                                inner: this.inner.clone(),
1119                            },
1120                            method_type: fidl::MethodType::OneWay,
1121                        })
1122                    }
1123                    _ if header
1124                        .dynamic_flags()
1125                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1126                    {
1127                        this.inner.send_framework_err(
1128                            fidl::encoding::FrameworkErr::UnknownMethod,
1129                            header.tx_id,
1130                            header.ordinal,
1131                            header.dynamic_flags(),
1132                            (bytes, handles),
1133                        )?;
1134                        Ok(ConfigOverrideRequest::_UnknownMethod {
1135                            ordinal: header.ordinal,
1136                            control_handle: ConfigOverrideControlHandle {
1137                                inner: this.inner.clone(),
1138                            },
1139                            method_type: fidl::MethodType::TwoWay,
1140                        })
1141                    }
1142                    _ => Err(fidl::Error::UnknownOrdinal {
1143                        ordinal: header.ordinal,
1144                        protocol_name:
1145                            <ConfigOverrideMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1146                    }),
1147                }))
1148            },
1149        )
1150    }
1151}
1152
1153/// Manages structured configuration override values for components.
1154#[derive(Debug)]
1155pub enum ConfigOverrideRequest {
1156    /// Sets structured configuration fields with override values for the
1157    /// component instance identified by moniker.
1158    SetStructuredConfig {
1159        moniker: String,
1160        fields: Vec<fidl_fuchsia_component_decl::ConfigOverride>,
1161        responder: ConfigOverrideSetStructuredConfigResponder,
1162    },
1163    /// Unsets structured configuration overrides for the component instance
1164    /// identified by moniker.  If an empty moniker is supplied, then all
1165    /// structured configuration overrides will be cleared.
1166    UnsetStructuredConfig {
1167        moniker: String,
1168        responder: ConfigOverrideUnsetStructuredConfigResponder,
1169    },
1170    /// An interaction was received which does not match any known method.
1171    #[non_exhaustive]
1172    _UnknownMethod {
1173        /// Ordinal of the method that was called.
1174        ordinal: u64,
1175        control_handle: ConfigOverrideControlHandle,
1176        method_type: fidl::MethodType,
1177    },
1178}
1179
1180impl ConfigOverrideRequest {
1181    #[allow(irrefutable_let_patterns)]
1182    pub fn into_set_structured_config(
1183        self,
1184    ) -> Option<(
1185        String,
1186        Vec<fidl_fuchsia_component_decl::ConfigOverride>,
1187        ConfigOverrideSetStructuredConfigResponder,
1188    )> {
1189        if let ConfigOverrideRequest::SetStructuredConfig { moniker, fields, responder } = self {
1190            Some((moniker, fields, responder))
1191        } else {
1192            None
1193        }
1194    }
1195
1196    #[allow(irrefutable_let_patterns)]
1197    pub fn into_unset_structured_config(
1198        self,
1199    ) -> Option<(String, ConfigOverrideUnsetStructuredConfigResponder)> {
1200        if let ConfigOverrideRequest::UnsetStructuredConfig { moniker, responder } = self {
1201            Some((moniker, responder))
1202        } else {
1203            None
1204        }
1205    }
1206
1207    /// Name of the method defined in FIDL
1208    pub fn method_name(&self) -> &'static str {
1209        match *self {
1210            ConfigOverrideRequest::SetStructuredConfig { .. } => "set_structured_config",
1211            ConfigOverrideRequest::UnsetStructuredConfig { .. } => "unset_structured_config",
1212            ConfigOverrideRequest::_UnknownMethod {
1213                method_type: fidl::MethodType::OneWay, ..
1214            } => "unknown one-way method",
1215            ConfigOverrideRequest::_UnknownMethod {
1216                method_type: fidl::MethodType::TwoWay, ..
1217            } => "unknown two-way method",
1218        }
1219    }
1220}
1221
1222#[derive(Debug, Clone)]
1223pub struct ConfigOverrideControlHandle {
1224    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1225}
1226
1227impl fidl::endpoints::ControlHandle for ConfigOverrideControlHandle {
1228    fn shutdown(&self) {
1229        self.inner.shutdown()
1230    }
1231
1232    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1233        self.inner.shutdown_with_epitaph(status)
1234    }
1235
1236    fn is_closed(&self) -> bool {
1237        self.inner.channel().is_closed()
1238    }
1239    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1240        self.inner.channel().on_closed()
1241    }
1242
1243    #[cfg(target_os = "fuchsia")]
1244    fn signal_peer(
1245        &self,
1246        clear_mask: zx::Signals,
1247        set_mask: zx::Signals,
1248    ) -> Result<(), zx_status::Status> {
1249        use fidl::Peered;
1250        self.inner.channel().signal_peer(clear_mask, set_mask)
1251    }
1252}
1253
1254impl ConfigOverrideControlHandle {}
1255
1256#[must_use = "FIDL methods require a response to be sent"]
1257#[derive(Debug)]
1258pub struct ConfigOverrideSetStructuredConfigResponder {
1259    control_handle: std::mem::ManuallyDrop<ConfigOverrideControlHandle>,
1260    tx_id: u32,
1261}
1262
1263/// Set the the channel to be shutdown (see [`ConfigOverrideControlHandle::shutdown`])
1264/// if the responder is dropped without sending a response, so that the client
1265/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1266impl std::ops::Drop for ConfigOverrideSetStructuredConfigResponder {
1267    fn drop(&mut self) {
1268        self.control_handle.shutdown();
1269        // Safety: drops once, never accessed again
1270        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1271    }
1272}
1273
1274impl fidl::endpoints::Responder for ConfigOverrideSetStructuredConfigResponder {
1275    type ControlHandle = ConfigOverrideControlHandle;
1276
1277    fn control_handle(&self) -> &ConfigOverrideControlHandle {
1278        &self.control_handle
1279    }
1280
1281    fn drop_without_shutdown(mut self) {
1282        // Safety: drops once, never accessed again due to mem::forget
1283        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284        // Prevent Drop from running (which would shut down the channel)
1285        std::mem::forget(self);
1286    }
1287}
1288
1289impl ConfigOverrideSetStructuredConfigResponder {
1290    /// Sends a response to the FIDL transaction.
1291    ///
1292    /// Sets the channel to shutdown if an error occurs.
1293    pub fn send(self, mut result: Result<(), ConfigOverrideError>) -> Result<(), fidl::Error> {
1294        let _result = self.send_raw(result);
1295        if _result.is_err() {
1296            self.control_handle.shutdown();
1297        }
1298        self.drop_without_shutdown();
1299        _result
1300    }
1301
1302    /// Similar to "send" but does not shutdown the channel if an error occurs.
1303    pub fn send_no_shutdown_on_err(
1304        self,
1305        mut result: Result<(), ConfigOverrideError>,
1306    ) -> Result<(), fidl::Error> {
1307        let _result = self.send_raw(result);
1308        self.drop_without_shutdown();
1309        _result
1310    }
1311
1312    fn send_raw(&self, mut result: Result<(), ConfigOverrideError>) -> Result<(), fidl::Error> {
1313        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1314            fidl::encoding::EmptyStruct,
1315            ConfigOverrideError,
1316        >>(
1317            fidl::encoding::FlexibleResult::new(result),
1318            self.tx_id,
1319            0x2c6a138832d2e0ee,
1320            fidl::encoding::DynamicFlags::FLEXIBLE,
1321        )
1322    }
1323}
1324
1325#[must_use = "FIDL methods require a response to be sent"]
1326#[derive(Debug)]
1327pub struct ConfigOverrideUnsetStructuredConfigResponder {
1328    control_handle: std::mem::ManuallyDrop<ConfigOverrideControlHandle>,
1329    tx_id: u32,
1330}
1331
1332/// Set the the channel to be shutdown (see [`ConfigOverrideControlHandle::shutdown`])
1333/// if the responder is dropped without sending a response, so that the client
1334/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1335impl std::ops::Drop for ConfigOverrideUnsetStructuredConfigResponder {
1336    fn drop(&mut self) {
1337        self.control_handle.shutdown();
1338        // Safety: drops once, never accessed again
1339        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1340    }
1341}
1342
1343impl fidl::endpoints::Responder for ConfigOverrideUnsetStructuredConfigResponder {
1344    type ControlHandle = ConfigOverrideControlHandle;
1345
1346    fn control_handle(&self) -> &ConfigOverrideControlHandle {
1347        &self.control_handle
1348    }
1349
1350    fn drop_without_shutdown(mut self) {
1351        // Safety: drops once, never accessed again due to mem::forget
1352        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1353        // Prevent Drop from running (which would shut down the channel)
1354        std::mem::forget(self);
1355    }
1356}
1357
1358impl ConfigOverrideUnsetStructuredConfigResponder {
1359    /// Sends a response to the FIDL transaction.
1360    ///
1361    /// Sets the channel to shutdown if an error occurs.
1362    pub fn send(self, mut result: Result<(), ConfigOverrideError>) -> Result<(), fidl::Error> {
1363        let _result = self.send_raw(result);
1364        if _result.is_err() {
1365            self.control_handle.shutdown();
1366        }
1367        self.drop_without_shutdown();
1368        _result
1369    }
1370
1371    /// Similar to "send" but does not shutdown the channel if an error occurs.
1372    pub fn send_no_shutdown_on_err(
1373        self,
1374        mut result: Result<(), ConfigOverrideError>,
1375    ) -> Result<(), fidl::Error> {
1376        let _result = self.send_raw(result);
1377        self.drop_without_shutdown();
1378        _result
1379    }
1380
1381    fn send_raw(&self, mut result: Result<(), ConfigOverrideError>) -> Result<(), fidl::Error> {
1382        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1383            fidl::encoding::EmptyStruct,
1384            ConfigOverrideError,
1385        >>(
1386            fidl::encoding::FlexibleResult::new(result),
1387            self.tx_id,
1388            0x342ec7d2bef05552,
1389            fidl::encoding::DynamicFlags::FLEXIBLE,
1390        )
1391    }
1392}
1393
1394#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1395pub struct CrashIntrospectMarker;
1396
1397impl fidl::endpoints::ProtocolMarker for CrashIntrospectMarker {
1398    type Proxy = CrashIntrospectProxy;
1399    type RequestStream = CrashIntrospectRequestStream;
1400    #[cfg(target_os = "fuchsia")]
1401    type SynchronousProxy = CrashIntrospectSynchronousProxy;
1402
1403    const DEBUG_NAME: &'static str = "fuchsia.sys2.CrashIntrospect";
1404}
1405impl fidl::endpoints::DiscoverableProtocolMarker for CrashIntrospectMarker {}
1406pub type CrashIntrospectFindComponentByThreadKoidResult =
1407    Result<ComponentCrashInfo, fidl_fuchsia_component::Error>;
1408
1409pub trait CrashIntrospectProxyInterface: Send + Sync {
1410    type FindComponentByThreadKoidResponseFut: std::future::Future<
1411            Output = Result<CrashIntrospectFindComponentByThreadKoidResult, fidl::Error>,
1412        > + Send;
1413    fn r#find_component_by_thread_koid(
1414        &self,
1415        thread_koid: u64,
1416    ) -> Self::FindComponentByThreadKoidResponseFut;
1417}
1418#[derive(Debug)]
1419#[cfg(target_os = "fuchsia")]
1420pub struct CrashIntrospectSynchronousProxy {
1421    client: fidl::client::sync::Client,
1422}
1423
1424#[cfg(target_os = "fuchsia")]
1425impl fidl::endpoints::SynchronousProxy for CrashIntrospectSynchronousProxy {
1426    type Proxy = CrashIntrospectProxy;
1427    type Protocol = CrashIntrospectMarker;
1428
1429    fn from_channel(inner: fidl::Channel) -> Self {
1430        Self::new(inner)
1431    }
1432
1433    fn into_channel(self) -> fidl::Channel {
1434        self.client.into_channel()
1435    }
1436
1437    fn as_channel(&self) -> &fidl::Channel {
1438        self.client.as_channel()
1439    }
1440}
1441
1442#[cfg(target_os = "fuchsia")]
1443impl CrashIntrospectSynchronousProxy {
1444    pub fn new(channel: fidl::Channel) -> Self {
1445        let protocol_name = <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1446        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1447    }
1448
1449    pub fn into_channel(self) -> fidl::Channel {
1450        self.client.into_channel()
1451    }
1452
1453    /// Waits until an event arrives and returns it. It is safe for other
1454    /// threads to make concurrent requests while waiting for an event.
1455    pub fn wait_for_event(
1456        &self,
1457        deadline: zx::MonotonicInstant,
1458    ) -> Result<CrashIntrospectEvent, fidl::Error> {
1459        CrashIntrospectEvent::decode(self.client.wait_for_event(deadline)?)
1460    }
1461
1462    /// Given a thread koid, returns the information that was stored when the
1463    /// ELF runner observed a crash from that thread.
1464    ///
1465    /// The information for a crash is deleted when it is accessed or when 10
1466    /// minutes have passed, whichever comes first.
1467    ///
1468    /// If there is no information available on the given thread koid,
1469    /// `zx::Status::NOT_FOUND` is returned.
1470    pub fn r#find_component_by_thread_koid(
1471        &self,
1472        mut thread_koid: u64,
1473        ___deadline: zx::MonotonicInstant,
1474    ) -> Result<CrashIntrospectFindComponentByThreadKoidResult, fidl::Error> {
1475        let _response = self.client.send_query::<
1476            CrashIntrospectFindComponentByThreadKoidRequest,
1477            fidl::encoding::ResultType<CrashIntrospectFindComponentByThreadKoidResponse, fidl_fuchsia_component::Error>,
1478        >(
1479            (thread_koid,),
1480            0x75d3ff081eca468d,
1481            fidl::encoding::DynamicFlags::empty(),
1482            ___deadline,
1483        )?;
1484        Ok(_response.map(|x| x.info))
1485    }
1486}
1487
1488#[cfg(target_os = "fuchsia")]
1489impl From<CrashIntrospectSynchronousProxy> for zx::NullableHandle {
1490    fn from(value: CrashIntrospectSynchronousProxy) -> Self {
1491        value.into_channel().into()
1492    }
1493}
1494
1495#[cfg(target_os = "fuchsia")]
1496impl From<fidl::Channel> for CrashIntrospectSynchronousProxy {
1497    fn from(value: fidl::Channel) -> Self {
1498        Self::new(value)
1499    }
1500}
1501
1502#[cfg(target_os = "fuchsia")]
1503impl fidl::endpoints::FromClient for CrashIntrospectSynchronousProxy {
1504    type Protocol = CrashIntrospectMarker;
1505
1506    fn from_client(value: fidl::endpoints::ClientEnd<CrashIntrospectMarker>) -> Self {
1507        Self::new(value.into_channel())
1508    }
1509}
1510
1511#[derive(Debug, Clone)]
1512pub struct CrashIntrospectProxy {
1513    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1514}
1515
1516impl fidl::endpoints::Proxy for CrashIntrospectProxy {
1517    type Protocol = CrashIntrospectMarker;
1518
1519    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1520        Self::new(inner)
1521    }
1522
1523    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1524        self.client.into_channel().map_err(|client| Self { client })
1525    }
1526
1527    fn as_channel(&self) -> &::fidl::AsyncChannel {
1528        self.client.as_channel()
1529    }
1530}
1531
1532impl CrashIntrospectProxy {
1533    /// Create a new Proxy for fuchsia.sys2/CrashIntrospect.
1534    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1535        let protocol_name = <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1536        Self { client: fidl::client::Client::new(channel, protocol_name) }
1537    }
1538
1539    /// Get a Stream of events from the remote end of the protocol.
1540    ///
1541    /// # Panics
1542    ///
1543    /// Panics if the event stream was already taken.
1544    pub fn take_event_stream(&self) -> CrashIntrospectEventStream {
1545        CrashIntrospectEventStream { event_receiver: self.client.take_event_receiver() }
1546    }
1547
1548    /// Given a thread koid, returns the information that was stored when the
1549    /// ELF runner observed a crash from that thread.
1550    ///
1551    /// The information for a crash is deleted when it is accessed or when 10
1552    /// minutes have passed, whichever comes first.
1553    ///
1554    /// If there is no information available on the given thread koid,
1555    /// `zx::Status::NOT_FOUND` is returned.
1556    pub fn r#find_component_by_thread_koid(
1557        &self,
1558        mut thread_koid: u64,
1559    ) -> fidl::client::QueryResponseFut<
1560        CrashIntrospectFindComponentByThreadKoidResult,
1561        fidl::encoding::DefaultFuchsiaResourceDialect,
1562    > {
1563        CrashIntrospectProxyInterface::r#find_component_by_thread_koid(self, thread_koid)
1564    }
1565}
1566
1567impl CrashIntrospectProxyInterface for CrashIntrospectProxy {
1568    type FindComponentByThreadKoidResponseFut = fidl::client::QueryResponseFut<
1569        CrashIntrospectFindComponentByThreadKoidResult,
1570        fidl::encoding::DefaultFuchsiaResourceDialect,
1571    >;
1572    fn r#find_component_by_thread_koid(
1573        &self,
1574        mut thread_koid: u64,
1575    ) -> Self::FindComponentByThreadKoidResponseFut {
1576        fn _decode(
1577            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1578        ) -> Result<CrashIntrospectFindComponentByThreadKoidResult, fidl::Error> {
1579            let _response = fidl::client::decode_transaction_body::<
1580                fidl::encoding::ResultType<
1581                    CrashIntrospectFindComponentByThreadKoidResponse,
1582                    fidl_fuchsia_component::Error,
1583                >,
1584                fidl::encoding::DefaultFuchsiaResourceDialect,
1585                0x75d3ff081eca468d,
1586            >(_buf?)?;
1587            Ok(_response.map(|x| x.info))
1588        }
1589        self.client.send_query_and_decode::<
1590            CrashIntrospectFindComponentByThreadKoidRequest,
1591            CrashIntrospectFindComponentByThreadKoidResult,
1592        >(
1593            (thread_koid,),
1594            0x75d3ff081eca468d,
1595            fidl::encoding::DynamicFlags::empty(),
1596            _decode,
1597        )
1598    }
1599}
1600
1601pub struct CrashIntrospectEventStream {
1602    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1603}
1604
1605impl std::marker::Unpin for CrashIntrospectEventStream {}
1606
1607impl futures::stream::FusedStream for CrashIntrospectEventStream {
1608    fn is_terminated(&self) -> bool {
1609        self.event_receiver.is_terminated()
1610    }
1611}
1612
1613impl futures::Stream for CrashIntrospectEventStream {
1614    type Item = Result<CrashIntrospectEvent, fidl::Error>;
1615
1616    fn poll_next(
1617        mut self: std::pin::Pin<&mut Self>,
1618        cx: &mut std::task::Context<'_>,
1619    ) -> std::task::Poll<Option<Self::Item>> {
1620        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1621            &mut self.event_receiver,
1622            cx
1623        )?) {
1624            Some(buf) => std::task::Poll::Ready(Some(CrashIntrospectEvent::decode(buf))),
1625            None => std::task::Poll::Ready(None),
1626        }
1627    }
1628}
1629
1630#[derive(Debug)]
1631pub enum CrashIntrospectEvent {}
1632
1633impl CrashIntrospectEvent {
1634    /// Decodes a message buffer as a [`CrashIntrospectEvent`].
1635    fn decode(
1636        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1637    ) -> Result<CrashIntrospectEvent, fidl::Error> {
1638        let (bytes, _handles) = buf.split_mut();
1639        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1640        debug_assert_eq!(tx_header.tx_id, 0);
1641        match tx_header.ordinal {
1642            _ => Err(fidl::Error::UnknownOrdinal {
1643                ordinal: tx_header.ordinal,
1644                protocol_name:
1645                    <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1646            }),
1647        }
1648    }
1649}
1650
1651/// A Stream of incoming requests for fuchsia.sys2/CrashIntrospect.
1652pub struct CrashIntrospectRequestStream {
1653    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1654    is_terminated: bool,
1655}
1656
1657impl std::marker::Unpin for CrashIntrospectRequestStream {}
1658
1659impl futures::stream::FusedStream for CrashIntrospectRequestStream {
1660    fn is_terminated(&self) -> bool {
1661        self.is_terminated
1662    }
1663}
1664
1665impl fidl::endpoints::RequestStream for CrashIntrospectRequestStream {
1666    type Protocol = CrashIntrospectMarker;
1667    type ControlHandle = CrashIntrospectControlHandle;
1668
1669    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1670        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1671    }
1672
1673    fn control_handle(&self) -> Self::ControlHandle {
1674        CrashIntrospectControlHandle { inner: self.inner.clone() }
1675    }
1676
1677    fn into_inner(
1678        self,
1679    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1680    {
1681        (self.inner, self.is_terminated)
1682    }
1683
1684    fn from_inner(
1685        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1686        is_terminated: bool,
1687    ) -> Self {
1688        Self { inner, is_terminated }
1689    }
1690}
1691
1692impl futures::Stream for CrashIntrospectRequestStream {
1693    type Item = Result<CrashIntrospectRequest, fidl::Error>;
1694
1695    fn poll_next(
1696        mut self: std::pin::Pin<&mut Self>,
1697        cx: &mut std::task::Context<'_>,
1698    ) -> std::task::Poll<Option<Self::Item>> {
1699        let this = &mut *self;
1700        if this.inner.check_shutdown(cx) {
1701            this.is_terminated = true;
1702            return std::task::Poll::Ready(None);
1703        }
1704        if this.is_terminated {
1705            panic!("polled CrashIntrospectRequestStream after completion");
1706        }
1707        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1708            |bytes, handles| {
1709                match this.inner.channel().read_etc(cx, bytes, handles) {
1710                    std::task::Poll::Ready(Ok(())) => {}
1711                    std::task::Poll::Pending => return std::task::Poll::Pending,
1712                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1713                        this.is_terminated = true;
1714                        return std::task::Poll::Ready(None);
1715                    }
1716                    std::task::Poll::Ready(Err(e)) => {
1717                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1718                            e.into(),
1719                        ))));
1720                    }
1721                }
1722
1723                // A message has been received from the channel
1724                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1725
1726                std::task::Poll::Ready(Some(match header.ordinal {
1727                    0x75d3ff081eca468d => {
1728                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1729                        let mut req = fidl::new_empty!(
1730                            CrashIntrospectFindComponentByThreadKoidRequest,
1731                            fidl::encoding::DefaultFuchsiaResourceDialect
1732                        );
1733                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CrashIntrospectFindComponentByThreadKoidRequest>(&header, _body_bytes, handles, &mut req)?;
1734                        let control_handle =
1735                            CrashIntrospectControlHandle { inner: this.inner.clone() };
1736                        Ok(CrashIntrospectRequest::FindComponentByThreadKoid {
1737                            thread_koid: req.thread_koid,
1738
1739                            responder: CrashIntrospectFindComponentByThreadKoidResponder {
1740                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1741                                tx_id: header.tx_id,
1742                            },
1743                        })
1744                    }
1745                    _ => Err(fidl::Error::UnknownOrdinal {
1746                        ordinal: header.ordinal,
1747                        protocol_name:
1748                            <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1749                    }),
1750                }))
1751            },
1752        )
1753    }
1754}
1755
1756/// When a thread from a component using the ELF runner crashes, the thread
1757/// koid along with other information is stored. This protocol can be used to
1758/// retrieve that stored information.
1759#[derive(Debug)]
1760pub enum CrashIntrospectRequest {
1761    /// Given a thread koid, returns the information that was stored when the
1762    /// ELF runner observed a crash from that thread.
1763    ///
1764    /// The information for a crash is deleted when it is accessed or when 10
1765    /// minutes have passed, whichever comes first.
1766    ///
1767    /// If there is no information available on the given thread koid,
1768    /// `zx::Status::NOT_FOUND` is returned.
1769    FindComponentByThreadKoid {
1770        thread_koid: u64,
1771        responder: CrashIntrospectFindComponentByThreadKoidResponder,
1772    },
1773}
1774
1775impl CrashIntrospectRequest {
1776    #[allow(irrefutable_let_patterns)]
1777    pub fn into_find_component_by_thread_koid(
1778        self,
1779    ) -> Option<(u64, CrashIntrospectFindComponentByThreadKoidResponder)> {
1780        if let CrashIntrospectRequest::FindComponentByThreadKoid { thread_koid, responder } = self {
1781            Some((thread_koid, responder))
1782        } else {
1783            None
1784        }
1785    }
1786
1787    /// Name of the method defined in FIDL
1788    pub fn method_name(&self) -> &'static str {
1789        match *self {
1790            CrashIntrospectRequest::FindComponentByThreadKoid { .. } => {
1791                "find_component_by_thread_koid"
1792            }
1793        }
1794    }
1795}
1796
1797#[derive(Debug, Clone)]
1798pub struct CrashIntrospectControlHandle {
1799    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1800}
1801
1802impl fidl::endpoints::ControlHandle for CrashIntrospectControlHandle {
1803    fn shutdown(&self) {
1804        self.inner.shutdown()
1805    }
1806
1807    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1808        self.inner.shutdown_with_epitaph(status)
1809    }
1810
1811    fn is_closed(&self) -> bool {
1812        self.inner.channel().is_closed()
1813    }
1814    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1815        self.inner.channel().on_closed()
1816    }
1817
1818    #[cfg(target_os = "fuchsia")]
1819    fn signal_peer(
1820        &self,
1821        clear_mask: zx::Signals,
1822        set_mask: zx::Signals,
1823    ) -> Result<(), zx_status::Status> {
1824        use fidl::Peered;
1825        self.inner.channel().signal_peer(clear_mask, set_mask)
1826    }
1827}
1828
1829impl CrashIntrospectControlHandle {}
1830
1831#[must_use = "FIDL methods require a response to be sent"]
1832#[derive(Debug)]
1833pub struct CrashIntrospectFindComponentByThreadKoidResponder {
1834    control_handle: std::mem::ManuallyDrop<CrashIntrospectControlHandle>,
1835    tx_id: u32,
1836}
1837
1838/// Set the the channel to be shutdown (see [`CrashIntrospectControlHandle::shutdown`])
1839/// if the responder is dropped without sending a response, so that the client
1840/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1841impl std::ops::Drop for CrashIntrospectFindComponentByThreadKoidResponder {
1842    fn drop(&mut self) {
1843        self.control_handle.shutdown();
1844        // Safety: drops once, never accessed again
1845        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1846    }
1847}
1848
1849impl fidl::endpoints::Responder for CrashIntrospectFindComponentByThreadKoidResponder {
1850    type ControlHandle = CrashIntrospectControlHandle;
1851
1852    fn control_handle(&self) -> &CrashIntrospectControlHandle {
1853        &self.control_handle
1854    }
1855
1856    fn drop_without_shutdown(mut self) {
1857        // Safety: drops once, never accessed again due to mem::forget
1858        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1859        // Prevent Drop from running (which would shut down the channel)
1860        std::mem::forget(self);
1861    }
1862}
1863
1864impl CrashIntrospectFindComponentByThreadKoidResponder {
1865    /// Sends a response to the FIDL transaction.
1866    ///
1867    /// Sets the channel to shutdown if an error occurs.
1868    pub fn send(
1869        self,
1870        mut result: Result<&ComponentCrashInfo, fidl_fuchsia_component::Error>,
1871    ) -> Result<(), fidl::Error> {
1872        let _result = self.send_raw(result);
1873        if _result.is_err() {
1874            self.control_handle.shutdown();
1875        }
1876        self.drop_without_shutdown();
1877        _result
1878    }
1879
1880    /// Similar to "send" but does not shutdown the channel if an error occurs.
1881    pub fn send_no_shutdown_on_err(
1882        self,
1883        mut result: Result<&ComponentCrashInfo, fidl_fuchsia_component::Error>,
1884    ) -> Result<(), fidl::Error> {
1885        let _result = self.send_raw(result);
1886        self.drop_without_shutdown();
1887        _result
1888    }
1889
1890    fn send_raw(
1891        &self,
1892        mut result: Result<&ComponentCrashInfo, fidl_fuchsia_component::Error>,
1893    ) -> Result<(), fidl::Error> {
1894        self.control_handle.inner.send::<fidl::encoding::ResultType<
1895            CrashIntrospectFindComponentByThreadKoidResponse,
1896            fidl_fuchsia_component::Error,
1897        >>(
1898            result.map(|info| (info,)),
1899            self.tx_id,
1900            0x75d3ff081eca468d,
1901            fidl::encoding::DynamicFlags::empty(),
1902        )
1903    }
1904}
1905
1906#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1907pub struct InstanceIteratorMarker;
1908
1909impl fidl::endpoints::ProtocolMarker for InstanceIteratorMarker {
1910    type Proxy = InstanceIteratorProxy;
1911    type RequestStream = InstanceIteratorRequestStream;
1912    #[cfg(target_os = "fuchsia")]
1913    type SynchronousProxy = InstanceIteratorSynchronousProxy;
1914
1915    const DEBUG_NAME: &'static str = "(anonymous) InstanceIterator";
1916}
1917
1918pub trait InstanceIteratorProxyInterface: Send + Sync {
1919    type NextResponseFut: std::future::Future<Output = Result<Vec<Instance>, fidl::Error>> + Send;
1920    fn r#next(&self) -> Self::NextResponseFut;
1921}
1922#[derive(Debug)]
1923#[cfg(target_os = "fuchsia")]
1924pub struct InstanceIteratorSynchronousProxy {
1925    client: fidl::client::sync::Client,
1926}
1927
1928#[cfg(target_os = "fuchsia")]
1929impl fidl::endpoints::SynchronousProxy for InstanceIteratorSynchronousProxy {
1930    type Proxy = InstanceIteratorProxy;
1931    type Protocol = InstanceIteratorMarker;
1932
1933    fn from_channel(inner: fidl::Channel) -> Self {
1934        Self::new(inner)
1935    }
1936
1937    fn into_channel(self) -> fidl::Channel {
1938        self.client.into_channel()
1939    }
1940
1941    fn as_channel(&self) -> &fidl::Channel {
1942        self.client.as_channel()
1943    }
1944}
1945
1946#[cfg(target_os = "fuchsia")]
1947impl InstanceIteratorSynchronousProxy {
1948    pub fn new(channel: fidl::Channel) -> Self {
1949        let protocol_name = <InstanceIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1950        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1951    }
1952
1953    pub fn into_channel(self) -> fidl::Channel {
1954        self.client.into_channel()
1955    }
1956
1957    /// Waits until an event arrives and returns it. It is safe for other
1958    /// threads to make concurrent requests while waiting for an event.
1959    pub fn wait_for_event(
1960        &self,
1961        deadline: zx::MonotonicInstant,
1962    ) -> Result<InstanceIteratorEvent, fidl::Error> {
1963        InstanceIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1964    }
1965
1966    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Instance>, fidl::Error> {
1967        let _response =
1968            self.client.send_query::<fidl::encoding::EmptyPayload, InstanceIteratorNextResponse>(
1969                (),
1970                0x3a4e3d52432a52ee,
1971                fidl::encoding::DynamicFlags::empty(),
1972                ___deadline,
1973            )?;
1974        Ok(_response.infos)
1975    }
1976}
1977
1978#[cfg(target_os = "fuchsia")]
1979impl From<InstanceIteratorSynchronousProxy> for zx::NullableHandle {
1980    fn from(value: InstanceIteratorSynchronousProxy) -> Self {
1981        value.into_channel().into()
1982    }
1983}
1984
1985#[cfg(target_os = "fuchsia")]
1986impl From<fidl::Channel> for InstanceIteratorSynchronousProxy {
1987    fn from(value: fidl::Channel) -> Self {
1988        Self::new(value)
1989    }
1990}
1991
1992#[cfg(target_os = "fuchsia")]
1993impl fidl::endpoints::FromClient for InstanceIteratorSynchronousProxy {
1994    type Protocol = InstanceIteratorMarker;
1995
1996    fn from_client(value: fidl::endpoints::ClientEnd<InstanceIteratorMarker>) -> Self {
1997        Self::new(value.into_channel())
1998    }
1999}
2000
2001#[derive(Debug, Clone)]
2002pub struct InstanceIteratorProxy {
2003    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2004}
2005
2006impl fidl::endpoints::Proxy for InstanceIteratorProxy {
2007    type Protocol = InstanceIteratorMarker;
2008
2009    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2010        Self::new(inner)
2011    }
2012
2013    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2014        self.client.into_channel().map_err(|client| Self { client })
2015    }
2016
2017    fn as_channel(&self) -> &::fidl::AsyncChannel {
2018        self.client.as_channel()
2019    }
2020}
2021
2022impl InstanceIteratorProxy {
2023    /// Create a new Proxy for fuchsia.sys2/InstanceIterator.
2024    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2025        let protocol_name = <InstanceIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2026        Self { client: fidl::client::Client::new(channel, protocol_name) }
2027    }
2028
2029    /// Get a Stream of events from the remote end of the protocol.
2030    ///
2031    /// # Panics
2032    ///
2033    /// Panics if the event stream was already taken.
2034    pub fn take_event_stream(&self) -> InstanceIteratorEventStream {
2035        InstanceIteratorEventStream { event_receiver: self.client.take_event_receiver() }
2036    }
2037
2038    pub fn r#next(
2039        &self,
2040    ) -> fidl::client::QueryResponseFut<Vec<Instance>, fidl::encoding::DefaultFuchsiaResourceDialect>
2041    {
2042        InstanceIteratorProxyInterface::r#next(self)
2043    }
2044}
2045
2046impl InstanceIteratorProxyInterface for InstanceIteratorProxy {
2047    type NextResponseFut = fidl::client::QueryResponseFut<
2048        Vec<Instance>,
2049        fidl::encoding::DefaultFuchsiaResourceDialect,
2050    >;
2051    fn r#next(&self) -> Self::NextResponseFut {
2052        fn _decode(
2053            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2054        ) -> Result<Vec<Instance>, fidl::Error> {
2055            let _response = fidl::client::decode_transaction_body::<
2056                InstanceIteratorNextResponse,
2057                fidl::encoding::DefaultFuchsiaResourceDialect,
2058                0x3a4e3d52432a52ee,
2059            >(_buf?)?;
2060            Ok(_response.infos)
2061        }
2062        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Instance>>(
2063            (),
2064            0x3a4e3d52432a52ee,
2065            fidl::encoding::DynamicFlags::empty(),
2066            _decode,
2067        )
2068    }
2069}
2070
2071pub struct InstanceIteratorEventStream {
2072    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2073}
2074
2075impl std::marker::Unpin for InstanceIteratorEventStream {}
2076
2077impl futures::stream::FusedStream for InstanceIteratorEventStream {
2078    fn is_terminated(&self) -> bool {
2079        self.event_receiver.is_terminated()
2080    }
2081}
2082
2083impl futures::Stream for InstanceIteratorEventStream {
2084    type Item = Result<InstanceIteratorEvent, fidl::Error>;
2085
2086    fn poll_next(
2087        mut self: std::pin::Pin<&mut Self>,
2088        cx: &mut std::task::Context<'_>,
2089    ) -> std::task::Poll<Option<Self::Item>> {
2090        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2091            &mut self.event_receiver,
2092            cx
2093        )?) {
2094            Some(buf) => std::task::Poll::Ready(Some(InstanceIteratorEvent::decode(buf))),
2095            None => std::task::Poll::Ready(None),
2096        }
2097    }
2098}
2099
2100#[derive(Debug)]
2101pub enum InstanceIteratorEvent {}
2102
2103impl InstanceIteratorEvent {
2104    /// Decodes a message buffer as a [`InstanceIteratorEvent`].
2105    fn decode(
2106        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2107    ) -> Result<InstanceIteratorEvent, fidl::Error> {
2108        let (bytes, _handles) = buf.split_mut();
2109        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2110        debug_assert_eq!(tx_header.tx_id, 0);
2111        match tx_header.ordinal {
2112            _ => Err(fidl::Error::UnknownOrdinal {
2113                ordinal: tx_header.ordinal,
2114                protocol_name:
2115                    <InstanceIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2116            }),
2117        }
2118    }
2119}
2120
2121/// A Stream of incoming requests for fuchsia.sys2/InstanceIterator.
2122pub struct InstanceIteratorRequestStream {
2123    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2124    is_terminated: bool,
2125}
2126
2127impl std::marker::Unpin for InstanceIteratorRequestStream {}
2128
2129impl futures::stream::FusedStream for InstanceIteratorRequestStream {
2130    fn is_terminated(&self) -> bool {
2131        self.is_terminated
2132    }
2133}
2134
2135impl fidl::endpoints::RequestStream for InstanceIteratorRequestStream {
2136    type Protocol = InstanceIteratorMarker;
2137    type ControlHandle = InstanceIteratorControlHandle;
2138
2139    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2140        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2141    }
2142
2143    fn control_handle(&self) -> Self::ControlHandle {
2144        InstanceIteratorControlHandle { inner: self.inner.clone() }
2145    }
2146
2147    fn into_inner(
2148        self,
2149    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2150    {
2151        (self.inner, self.is_terminated)
2152    }
2153
2154    fn from_inner(
2155        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2156        is_terminated: bool,
2157    ) -> Self {
2158        Self { inner, is_terminated }
2159    }
2160}
2161
2162impl futures::Stream for InstanceIteratorRequestStream {
2163    type Item = Result<InstanceIteratorRequest, fidl::Error>;
2164
2165    fn poll_next(
2166        mut self: std::pin::Pin<&mut Self>,
2167        cx: &mut std::task::Context<'_>,
2168    ) -> std::task::Poll<Option<Self::Item>> {
2169        let this = &mut *self;
2170        if this.inner.check_shutdown(cx) {
2171            this.is_terminated = true;
2172            return std::task::Poll::Ready(None);
2173        }
2174        if this.is_terminated {
2175            panic!("polled InstanceIteratorRequestStream after completion");
2176        }
2177        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2178            |bytes, handles| {
2179                match this.inner.channel().read_etc(cx, bytes, handles) {
2180                    std::task::Poll::Ready(Ok(())) => {}
2181                    std::task::Poll::Pending => return std::task::Poll::Pending,
2182                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2183                        this.is_terminated = true;
2184                        return std::task::Poll::Ready(None);
2185                    }
2186                    std::task::Poll::Ready(Err(e)) => {
2187                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2188                            e.into(),
2189                        ))));
2190                    }
2191                }
2192
2193                // A message has been received from the channel
2194                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2195
2196                std::task::Poll::Ready(Some(match header.ordinal {
2197                    0x3a4e3d52432a52ee => {
2198                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2199                        let mut req = fidl::new_empty!(
2200                            fidl::encoding::EmptyPayload,
2201                            fidl::encoding::DefaultFuchsiaResourceDialect
2202                        );
2203                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2204                        let control_handle =
2205                            InstanceIteratorControlHandle { inner: this.inner.clone() };
2206                        Ok(InstanceIteratorRequest::Next {
2207                            responder: InstanceIteratorNextResponder {
2208                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2209                                tx_id: header.tx_id,
2210                            },
2211                        })
2212                    }
2213                    _ => Err(fidl::Error::UnknownOrdinal {
2214                        ordinal: header.ordinal,
2215                        protocol_name:
2216                            <InstanceIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2217                    }),
2218                }))
2219            },
2220        )
2221    }
2222}
2223
2224/// An iterator over all instances in the realm
2225#[derive(Debug)]
2226pub enum InstanceIteratorRequest {
2227    Next { responder: InstanceIteratorNextResponder },
2228}
2229
2230impl InstanceIteratorRequest {
2231    #[allow(irrefutable_let_patterns)]
2232    pub fn into_next(self) -> Option<(InstanceIteratorNextResponder)> {
2233        if let InstanceIteratorRequest::Next { responder } = self {
2234            Some((responder))
2235        } else {
2236            None
2237        }
2238    }
2239
2240    /// Name of the method defined in FIDL
2241    pub fn method_name(&self) -> &'static str {
2242        match *self {
2243            InstanceIteratorRequest::Next { .. } => "next",
2244        }
2245    }
2246}
2247
2248#[derive(Debug, Clone)]
2249pub struct InstanceIteratorControlHandle {
2250    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2251}
2252
2253impl fidl::endpoints::ControlHandle for InstanceIteratorControlHandle {
2254    fn shutdown(&self) {
2255        self.inner.shutdown()
2256    }
2257
2258    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2259        self.inner.shutdown_with_epitaph(status)
2260    }
2261
2262    fn is_closed(&self) -> bool {
2263        self.inner.channel().is_closed()
2264    }
2265    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2266        self.inner.channel().on_closed()
2267    }
2268
2269    #[cfg(target_os = "fuchsia")]
2270    fn signal_peer(
2271        &self,
2272        clear_mask: zx::Signals,
2273        set_mask: zx::Signals,
2274    ) -> Result<(), zx_status::Status> {
2275        use fidl::Peered;
2276        self.inner.channel().signal_peer(clear_mask, set_mask)
2277    }
2278}
2279
2280impl InstanceIteratorControlHandle {}
2281
2282#[must_use = "FIDL methods require a response to be sent"]
2283#[derive(Debug)]
2284pub struct InstanceIteratorNextResponder {
2285    control_handle: std::mem::ManuallyDrop<InstanceIteratorControlHandle>,
2286    tx_id: u32,
2287}
2288
2289/// Set the the channel to be shutdown (see [`InstanceIteratorControlHandle::shutdown`])
2290/// if the responder is dropped without sending a response, so that the client
2291/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2292impl std::ops::Drop for InstanceIteratorNextResponder {
2293    fn drop(&mut self) {
2294        self.control_handle.shutdown();
2295        // Safety: drops once, never accessed again
2296        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2297    }
2298}
2299
2300impl fidl::endpoints::Responder for InstanceIteratorNextResponder {
2301    type ControlHandle = InstanceIteratorControlHandle;
2302
2303    fn control_handle(&self) -> &InstanceIteratorControlHandle {
2304        &self.control_handle
2305    }
2306
2307    fn drop_without_shutdown(mut self) {
2308        // Safety: drops once, never accessed again due to mem::forget
2309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2310        // Prevent Drop from running (which would shut down the channel)
2311        std::mem::forget(self);
2312    }
2313}
2314
2315impl InstanceIteratorNextResponder {
2316    /// Sends a response to the FIDL transaction.
2317    ///
2318    /// Sets the channel to shutdown if an error occurs.
2319    pub fn send(self, mut infos: &[Instance]) -> Result<(), fidl::Error> {
2320        let _result = self.send_raw(infos);
2321        if _result.is_err() {
2322            self.control_handle.shutdown();
2323        }
2324        self.drop_without_shutdown();
2325        _result
2326    }
2327
2328    /// Similar to "send" but does not shutdown the channel if an error occurs.
2329    pub fn send_no_shutdown_on_err(self, mut infos: &[Instance]) -> Result<(), fidl::Error> {
2330        let _result = self.send_raw(infos);
2331        self.drop_without_shutdown();
2332        _result
2333    }
2334
2335    fn send_raw(&self, mut infos: &[Instance]) -> Result<(), fidl::Error> {
2336        self.control_handle.inner.send::<InstanceIteratorNextResponse>(
2337            (infos,),
2338            self.tx_id,
2339            0x3a4e3d52432a52ee,
2340            fidl::encoding::DynamicFlags::empty(),
2341        )
2342    }
2343}
2344
2345#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2346pub struct LifecycleControllerMarker;
2347
2348impl fidl::endpoints::ProtocolMarker for LifecycleControllerMarker {
2349    type Proxy = LifecycleControllerProxy;
2350    type RequestStream = LifecycleControllerRequestStream;
2351    #[cfg(target_os = "fuchsia")]
2352    type SynchronousProxy = LifecycleControllerSynchronousProxy;
2353
2354    const DEBUG_NAME: &'static str = "fuchsia.sys2.LifecycleController";
2355}
2356impl fidl::endpoints::DiscoverableProtocolMarker for LifecycleControllerMarker {}
2357pub type LifecycleControllerStartInstanceResult = Result<(), StartError>;
2358pub type LifecycleControllerStartInstanceWithArgsResult = Result<(), StartError>;
2359pub type LifecycleControllerStopInstanceResult = Result<(), StopError>;
2360pub type LifecycleControllerResolveInstanceResult = Result<(), ResolveError>;
2361pub type LifecycleControllerUnresolveInstanceResult = Result<(), UnresolveError>;
2362pub type LifecycleControllerCreateInstanceResult = Result<(), CreateError>;
2363pub type LifecycleControllerDestroyInstanceResult = Result<(), DestroyError>;
2364
2365pub trait LifecycleControllerProxyInterface: Send + Sync {
2366    type StartInstanceResponseFut: std::future::Future<Output = Result<LifecycleControllerStartInstanceResult, fidl::Error>>
2367        + Send;
2368    fn r#start_instance(
2369        &self,
2370        moniker: &str,
2371        binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2372    ) -> Self::StartInstanceResponseFut;
2373    type StartInstanceWithArgsResponseFut: std::future::Future<
2374            Output = Result<LifecycleControllerStartInstanceWithArgsResult, fidl::Error>,
2375        > + Send;
2376    fn r#start_instance_with_args(
2377        &self,
2378        moniker: &str,
2379        binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2380        args: fidl_fuchsia_component::StartChildArgs,
2381    ) -> Self::StartInstanceWithArgsResponseFut;
2382    type StopInstanceResponseFut: std::future::Future<Output = Result<LifecycleControllerStopInstanceResult, fidl::Error>>
2383        + Send;
2384    fn r#stop_instance(&self, moniker: &str) -> Self::StopInstanceResponseFut;
2385    type ResolveInstanceResponseFut: std::future::Future<Output = Result<LifecycleControllerResolveInstanceResult, fidl::Error>>
2386        + Send;
2387    fn r#resolve_instance(&self, moniker: &str) -> Self::ResolveInstanceResponseFut;
2388    type UnresolveInstanceResponseFut: std::future::Future<
2389            Output = Result<LifecycleControllerUnresolveInstanceResult, fidl::Error>,
2390        > + Send;
2391    fn r#unresolve_instance(&self, moniker: &str) -> Self::UnresolveInstanceResponseFut;
2392    type CreateInstanceResponseFut: std::future::Future<Output = Result<LifecycleControllerCreateInstanceResult, fidl::Error>>
2393        + Send;
2394    fn r#create_instance(
2395        &self,
2396        parent_moniker: &str,
2397        collection: &fidl_fuchsia_component_decl::CollectionRef,
2398        decl: &fidl_fuchsia_component_decl::Child,
2399        args: fidl_fuchsia_component::CreateChildArgs,
2400    ) -> Self::CreateInstanceResponseFut;
2401    type DestroyInstanceResponseFut: std::future::Future<Output = Result<LifecycleControllerDestroyInstanceResult, fidl::Error>>
2402        + Send;
2403    fn r#destroy_instance(
2404        &self,
2405        parent_moniker: &str,
2406        child: &fidl_fuchsia_component_decl::ChildRef,
2407    ) -> Self::DestroyInstanceResponseFut;
2408}
2409#[derive(Debug)]
2410#[cfg(target_os = "fuchsia")]
2411pub struct LifecycleControllerSynchronousProxy {
2412    client: fidl::client::sync::Client,
2413}
2414
2415#[cfg(target_os = "fuchsia")]
2416impl fidl::endpoints::SynchronousProxy for LifecycleControllerSynchronousProxy {
2417    type Proxy = LifecycleControllerProxy;
2418    type Protocol = LifecycleControllerMarker;
2419
2420    fn from_channel(inner: fidl::Channel) -> Self {
2421        Self::new(inner)
2422    }
2423
2424    fn into_channel(self) -> fidl::Channel {
2425        self.client.into_channel()
2426    }
2427
2428    fn as_channel(&self) -> &fidl::Channel {
2429        self.client.as_channel()
2430    }
2431}
2432
2433#[cfg(target_os = "fuchsia")]
2434impl LifecycleControllerSynchronousProxy {
2435    pub fn new(channel: fidl::Channel) -> Self {
2436        let protocol_name =
2437            <LifecycleControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2438        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2439    }
2440
2441    pub fn into_channel(self) -> fidl::Channel {
2442        self.client.into_channel()
2443    }
2444
2445    /// Waits until an event arrives and returns it. It is safe for other
2446    /// threads to make concurrent requests while waiting for an event.
2447    pub fn wait_for_event(
2448        &self,
2449        deadline: zx::MonotonicInstant,
2450    ) -> Result<LifecycleControllerEvent, fidl::Error> {
2451        LifecycleControllerEvent::decode(self.client.wait_for_event(deadline)?)
2452    }
2453
2454    /// Starts the instance identified by the given moniker. Relative
2455    /// monikers must start with "./".
2456    ///
2457    /// The client can pass in the server end of a channel
2458    /// for the fuchsia.component.Binder protocol. This protocol
2459    /// will notify the client when the instance has stopped.
2460    ///
2461    /// The function returns once the instance has been started. Calling
2462    /// StartInstance() when the instance is already running is a no-op, but
2463    /// it will connect the Binder channel if a valid handle is provided.
2464    pub fn r#start_instance(
2465        &self,
2466        mut moniker: &str,
2467        mut binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2468        ___deadline: zx::MonotonicInstant,
2469    ) -> Result<LifecycleControllerStartInstanceResult, fidl::Error> {
2470        let _response = self.client.send_query::<
2471            LifecycleControllerStartInstanceRequest,
2472            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StartError>,
2473        >(
2474            (moniker, binder,),
2475            0x13fcb422876384bf,
2476            fidl::encoding::DynamicFlags::empty(),
2477            ___deadline,
2478        )?;
2479        Ok(_response.map(|x| x))
2480    }
2481
2482    pub fn r#start_instance_with_args(
2483        &self,
2484        mut moniker: &str,
2485        mut binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2486        mut args: fidl_fuchsia_component::StartChildArgs,
2487        ___deadline: zx::MonotonicInstant,
2488    ) -> Result<LifecycleControllerStartInstanceWithArgsResult, fidl::Error> {
2489        let _response = self.client.send_query::<
2490            LifecycleControllerStartInstanceWithArgsRequest,
2491            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StartError>,
2492        >(
2493            (moniker, binder, &mut args,),
2494            0xd3b467436223e9,
2495            fidl::encoding::DynamicFlags::empty(),
2496            ___deadline,
2497        )?;
2498        Ok(_response.map(|x| x))
2499    }
2500
2501    /// Stops the instance identified by the given moniker. Relative
2502    /// monikers must start with "./".
2503    ///
2504    /// The function returns once the instance has been stopped.
2505    pub fn r#stop_instance(
2506        &self,
2507        mut moniker: &str,
2508        ___deadline: zx::MonotonicInstant,
2509    ) -> Result<LifecycleControllerStopInstanceResult, fidl::Error> {
2510        let _response = self.client.send_query::<
2511            LifecycleControllerStopInstanceRequest,
2512            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StopError>,
2513        >(
2514            (moniker,),
2515            0x1362ba9d0e3caf36,
2516            fidl::encoding::DynamicFlags::empty(),
2517            ___deadline,
2518        )?;
2519        Ok(_response.map(|x| x))
2520    }
2521
2522    /// Resolves the instance identified by the given moniker. Relative
2523    /// monikers must start with "./".
2524    ///
2525    /// The function returns once the instance has been resolved.
2526    pub fn r#resolve_instance(
2527        &self,
2528        mut moniker: &str,
2529        ___deadline: zx::MonotonicInstant,
2530    ) -> Result<LifecycleControllerResolveInstanceResult, fidl::Error> {
2531        let _response = self.client.send_query::<
2532            LifecycleControllerResolveInstanceRequest,
2533            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResolveError>,
2534        >(
2535            (moniker,),
2536            0x426ab8dd53d8e737,
2537            fidl::encoding::DynamicFlags::empty(),
2538            ___deadline,
2539        )?;
2540        Ok(_response.map(|x| x))
2541    }
2542
2543    /// Unresolves the component designated by the provided moniker. Relative
2544    /// monikers must start with "./".
2545    ///
2546    /// The function returns once the instance has been unresolved.
2547    pub fn r#unresolve_instance(
2548        &self,
2549        mut moniker: &str,
2550        ___deadline: zx::MonotonicInstant,
2551    ) -> Result<LifecycleControllerUnresolveInstanceResult, fidl::Error> {
2552        let _response = self.client.send_query::<
2553            LifecycleControllerUnresolveInstanceRequest,
2554            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, UnresolveError>,
2555        >(
2556            (moniker,),
2557            0x18166a2aa798cb99,
2558            fidl::encoding::DynamicFlags::empty(),
2559            ___deadline,
2560        )?;
2561        Ok(_response.map(|x| x))
2562    }
2563
2564    /// Creates a new child instance identified by the given moniker. Relative
2565    /// monikers must start with "./".
2566    ///
2567    /// The function returns once the child instance has been added to the topology.
2568    pub fn r#create_instance(
2569        &self,
2570        mut parent_moniker: &str,
2571        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
2572        mut decl: &fidl_fuchsia_component_decl::Child,
2573        mut args: fidl_fuchsia_component::CreateChildArgs,
2574        ___deadline: zx::MonotonicInstant,
2575    ) -> Result<LifecycleControllerCreateInstanceResult, fidl::Error> {
2576        let _response = self.client.send_query::<
2577            LifecycleControllerCreateInstanceRequest,
2578            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CreateError>,
2579        >(
2580            (parent_moniker, collection, decl, &mut args,),
2581            0x48d17ae777e4f9,
2582            fidl::encoding::DynamicFlags::empty(),
2583            ___deadline,
2584        )?;
2585        Ok(_response.map(|x| x))
2586    }
2587
2588    /// Destroys the instance identified by the given moniker. Relative
2589    /// monikers must start with "./".
2590    ///
2591    /// The function returns once the child instance no longer exists in the topology.
2592    pub fn r#destroy_instance(
2593        &self,
2594        mut parent_moniker: &str,
2595        mut child: &fidl_fuchsia_component_decl::ChildRef,
2596        ___deadline: zx::MonotonicInstant,
2597    ) -> Result<LifecycleControllerDestroyInstanceResult, fidl::Error> {
2598        let _response = self.client.send_query::<
2599            LifecycleControllerDestroyInstanceRequest,
2600            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DestroyError>,
2601        >(
2602            (parent_moniker, child,),
2603            0x27640ae5889d7443,
2604            fidl::encoding::DynamicFlags::empty(),
2605            ___deadline,
2606        )?;
2607        Ok(_response.map(|x| x))
2608    }
2609}
2610
2611#[cfg(target_os = "fuchsia")]
2612impl From<LifecycleControllerSynchronousProxy> for zx::NullableHandle {
2613    fn from(value: LifecycleControllerSynchronousProxy) -> Self {
2614        value.into_channel().into()
2615    }
2616}
2617
2618#[cfg(target_os = "fuchsia")]
2619impl From<fidl::Channel> for LifecycleControllerSynchronousProxy {
2620    fn from(value: fidl::Channel) -> Self {
2621        Self::new(value)
2622    }
2623}
2624
2625#[cfg(target_os = "fuchsia")]
2626impl fidl::endpoints::FromClient for LifecycleControllerSynchronousProxy {
2627    type Protocol = LifecycleControllerMarker;
2628
2629    fn from_client(value: fidl::endpoints::ClientEnd<LifecycleControllerMarker>) -> Self {
2630        Self::new(value.into_channel())
2631    }
2632}
2633
2634#[derive(Debug, Clone)]
2635pub struct LifecycleControllerProxy {
2636    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2637}
2638
2639impl fidl::endpoints::Proxy for LifecycleControllerProxy {
2640    type Protocol = LifecycleControllerMarker;
2641
2642    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2643        Self::new(inner)
2644    }
2645
2646    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2647        self.client.into_channel().map_err(|client| Self { client })
2648    }
2649
2650    fn as_channel(&self) -> &::fidl::AsyncChannel {
2651        self.client.as_channel()
2652    }
2653}
2654
2655impl LifecycleControllerProxy {
2656    /// Create a new Proxy for fuchsia.sys2/LifecycleController.
2657    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2658        let protocol_name =
2659            <LifecycleControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2660        Self { client: fidl::client::Client::new(channel, protocol_name) }
2661    }
2662
2663    /// Get a Stream of events from the remote end of the protocol.
2664    ///
2665    /// # Panics
2666    ///
2667    /// Panics if the event stream was already taken.
2668    pub fn take_event_stream(&self) -> LifecycleControllerEventStream {
2669        LifecycleControllerEventStream { event_receiver: self.client.take_event_receiver() }
2670    }
2671
2672    /// Starts the instance identified by the given moniker. Relative
2673    /// monikers must start with "./".
2674    ///
2675    /// The client can pass in the server end of a channel
2676    /// for the fuchsia.component.Binder protocol. This protocol
2677    /// will notify the client when the instance has stopped.
2678    ///
2679    /// The function returns once the instance has been started. Calling
2680    /// StartInstance() when the instance is already running is a no-op, but
2681    /// it will connect the Binder channel if a valid handle is provided.
2682    pub fn r#start_instance(
2683        &self,
2684        mut moniker: &str,
2685        mut binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2686    ) -> fidl::client::QueryResponseFut<
2687        LifecycleControllerStartInstanceResult,
2688        fidl::encoding::DefaultFuchsiaResourceDialect,
2689    > {
2690        LifecycleControllerProxyInterface::r#start_instance(self, moniker, binder)
2691    }
2692
2693    pub fn r#start_instance_with_args(
2694        &self,
2695        mut moniker: &str,
2696        mut binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2697        mut args: fidl_fuchsia_component::StartChildArgs,
2698    ) -> fidl::client::QueryResponseFut<
2699        LifecycleControllerStartInstanceWithArgsResult,
2700        fidl::encoding::DefaultFuchsiaResourceDialect,
2701    > {
2702        LifecycleControllerProxyInterface::r#start_instance_with_args(self, moniker, binder, args)
2703    }
2704
2705    /// Stops the instance identified by the given moniker. Relative
2706    /// monikers must start with "./".
2707    ///
2708    /// The function returns once the instance has been stopped.
2709    pub fn r#stop_instance(
2710        &self,
2711        mut moniker: &str,
2712    ) -> fidl::client::QueryResponseFut<
2713        LifecycleControllerStopInstanceResult,
2714        fidl::encoding::DefaultFuchsiaResourceDialect,
2715    > {
2716        LifecycleControllerProxyInterface::r#stop_instance(self, moniker)
2717    }
2718
2719    /// Resolves the instance identified by the given moniker. Relative
2720    /// monikers must start with "./".
2721    ///
2722    /// The function returns once the instance has been resolved.
2723    pub fn r#resolve_instance(
2724        &self,
2725        mut moniker: &str,
2726    ) -> fidl::client::QueryResponseFut<
2727        LifecycleControllerResolveInstanceResult,
2728        fidl::encoding::DefaultFuchsiaResourceDialect,
2729    > {
2730        LifecycleControllerProxyInterface::r#resolve_instance(self, moniker)
2731    }
2732
2733    /// Unresolves the component designated by the provided moniker. Relative
2734    /// monikers must start with "./".
2735    ///
2736    /// The function returns once the instance has been unresolved.
2737    pub fn r#unresolve_instance(
2738        &self,
2739        mut moniker: &str,
2740    ) -> fidl::client::QueryResponseFut<
2741        LifecycleControllerUnresolveInstanceResult,
2742        fidl::encoding::DefaultFuchsiaResourceDialect,
2743    > {
2744        LifecycleControllerProxyInterface::r#unresolve_instance(self, moniker)
2745    }
2746
2747    /// Creates a new child instance identified by the given moniker. Relative
2748    /// monikers must start with "./".
2749    ///
2750    /// The function returns once the child instance has been added to the topology.
2751    pub fn r#create_instance(
2752        &self,
2753        mut parent_moniker: &str,
2754        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
2755        mut decl: &fidl_fuchsia_component_decl::Child,
2756        mut args: fidl_fuchsia_component::CreateChildArgs,
2757    ) -> fidl::client::QueryResponseFut<
2758        LifecycleControllerCreateInstanceResult,
2759        fidl::encoding::DefaultFuchsiaResourceDialect,
2760    > {
2761        LifecycleControllerProxyInterface::r#create_instance(
2762            self,
2763            parent_moniker,
2764            collection,
2765            decl,
2766            args,
2767        )
2768    }
2769
2770    /// Destroys the instance identified by the given moniker. Relative
2771    /// monikers must start with "./".
2772    ///
2773    /// The function returns once the child instance no longer exists in the topology.
2774    pub fn r#destroy_instance(
2775        &self,
2776        mut parent_moniker: &str,
2777        mut child: &fidl_fuchsia_component_decl::ChildRef,
2778    ) -> fidl::client::QueryResponseFut<
2779        LifecycleControllerDestroyInstanceResult,
2780        fidl::encoding::DefaultFuchsiaResourceDialect,
2781    > {
2782        LifecycleControllerProxyInterface::r#destroy_instance(self, parent_moniker, child)
2783    }
2784}
2785
2786impl LifecycleControllerProxyInterface for LifecycleControllerProxy {
2787    type StartInstanceResponseFut = fidl::client::QueryResponseFut<
2788        LifecycleControllerStartInstanceResult,
2789        fidl::encoding::DefaultFuchsiaResourceDialect,
2790    >;
2791    fn r#start_instance(
2792        &self,
2793        mut moniker: &str,
2794        mut binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2795    ) -> Self::StartInstanceResponseFut {
2796        fn _decode(
2797            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2798        ) -> Result<LifecycleControllerStartInstanceResult, fidl::Error> {
2799            let _response = fidl::client::decode_transaction_body::<
2800                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StartError>,
2801                fidl::encoding::DefaultFuchsiaResourceDialect,
2802                0x13fcb422876384bf,
2803            >(_buf?)?;
2804            Ok(_response.map(|x| x))
2805        }
2806        self.client.send_query_and_decode::<
2807            LifecycleControllerStartInstanceRequest,
2808            LifecycleControllerStartInstanceResult,
2809        >(
2810            (moniker, binder,),
2811            0x13fcb422876384bf,
2812            fidl::encoding::DynamicFlags::empty(),
2813            _decode,
2814        )
2815    }
2816
2817    type StartInstanceWithArgsResponseFut = fidl::client::QueryResponseFut<
2818        LifecycleControllerStartInstanceWithArgsResult,
2819        fidl::encoding::DefaultFuchsiaResourceDialect,
2820    >;
2821    fn r#start_instance_with_args(
2822        &self,
2823        mut moniker: &str,
2824        mut binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
2825        mut args: fidl_fuchsia_component::StartChildArgs,
2826    ) -> Self::StartInstanceWithArgsResponseFut {
2827        fn _decode(
2828            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2829        ) -> Result<LifecycleControllerStartInstanceWithArgsResult, fidl::Error> {
2830            let _response = fidl::client::decode_transaction_body::<
2831                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StartError>,
2832                fidl::encoding::DefaultFuchsiaResourceDialect,
2833                0xd3b467436223e9,
2834            >(_buf?)?;
2835            Ok(_response.map(|x| x))
2836        }
2837        self.client.send_query_and_decode::<
2838            LifecycleControllerStartInstanceWithArgsRequest,
2839            LifecycleControllerStartInstanceWithArgsResult,
2840        >(
2841            (moniker, binder, &mut args,),
2842            0xd3b467436223e9,
2843            fidl::encoding::DynamicFlags::empty(),
2844            _decode,
2845        )
2846    }
2847
2848    type StopInstanceResponseFut = fidl::client::QueryResponseFut<
2849        LifecycleControllerStopInstanceResult,
2850        fidl::encoding::DefaultFuchsiaResourceDialect,
2851    >;
2852    fn r#stop_instance(&self, mut moniker: &str) -> Self::StopInstanceResponseFut {
2853        fn _decode(
2854            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2855        ) -> Result<LifecycleControllerStopInstanceResult, fidl::Error> {
2856            let _response = fidl::client::decode_transaction_body::<
2857                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StopError>,
2858                fidl::encoding::DefaultFuchsiaResourceDialect,
2859                0x1362ba9d0e3caf36,
2860            >(_buf?)?;
2861            Ok(_response.map(|x| x))
2862        }
2863        self.client.send_query_and_decode::<
2864            LifecycleControllerStopInstanceRequest,
2865            LifecycleControllerStopInstanceResult,
2866        >(
2867            (moniker,),
2868            0x1362ba9d0e3caf36,
2869            fidl::encoding::DynamicFlags::empty(),
2870            _decode,
2871        )
2872    }
2873
2874    type ResolveInstanceResponseFut = fidl::client::QueryResponseFut<
2875        LifecycleControllerResolveInstanceResult,
2876        fidl::encoding::DefaultFuchsiaResourceDialect,
2877    >;
2878    fn r#resolve_instance(&self, mut moniker: &str) -> Self::ResolveInstanceResponseFut {
2879        fn _decode(
2880            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2881        ) -> Result<LifecycleControllerResolveInstanceResult, fidl::Error> {
2882            let _response = fidl::client::decode_transaction_body::<
2883                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResolveError>,
2884                fidl::encoding::DefaultFuchsiaResourceDialect,
2885                0x426ab8dd53d8e737,
2886            >(_buf?)?;
2887            Ok(_response.map(|x| x))
2888        }
2889        self.client.send_query_and_decode::<
2890            LifecycleControllerResolveInstanceRequest,
2891            LifecycleControllerResolveInstanceResult,
2892        >(
2893            (moniker,),
2894            0x426ab8dd53d8e737,
2895            fidl::encoding::DynamicFlags::empty(),
2896            _decode,
2897        )
2898    }
2899
2900    type UnresolveInstanceResponseFut = fidl::client::QueryResponseFut<
2901        LifecycleControllerUnresolveInstanceResult,
2902        fidl::encoding::DefaultFuchsiaResourceDialect,
2903    >;
2904    fn r#unresolve_instance(&self, mut moniker: &str) -> Self::UnresolveInstanceResponseFut {
2905        fn _decode(
2906            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2907        ) -> Result<LifecycleControllerUnresolveInstanceResult, fidl::Error> {
2908            let _response = fidl::client::decode_transaction_body::<
2909                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, UnresolveError>,
2910                fidl::encoding::DefaultFuchsiaResourceDialect,
2911                0x18166a2aa798cb99,
2912            >(_buf?)?;
2913            Ok(_response.map(|x| x))
2914        }
2915        self.client.send_query_and_decode::<
2916            LifecycleControllerUnresolveInstanceRequest,
2917            LifecycleControllerUnresolveInstanceResult,
2918        >(
2919            (moniker,),
2920            0x18166a2aa798cb99,
2921            fidl::encoding::DynamicFlags::empty(),
2922            _decode,
2923        )
2924    }
2925
2926    type CreateInstanceResponseFut = fidl::client::QueryResponseFut<
2927        LifecycleControllerCreateInstanceResult,
2928        fidl::encoding::DefaultFuchsiaResourceDialect,
2929    >;
2930    fn r#create_instance(
2931        &self,
2932        mut parent_moniker: &str,
2933        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
2934        mut decl: &fidl_fuchsia_component_decl::Child,
2935        mut args: fidl_fuchsia_component::CreateChildArgs,
2936    ) -> Self::CreateInstanceResponseFut {
2937        fn _decode(
2938            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2939        ) -> Result<LifecycleControllerCreateInstanceResult, fidl::Error> {
2940            let _response = fidl::client::decode_transaction_body::<
2941                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CreateError>,
2942                fidl::encoding::DefaultFuchsiaResourceDialect,
2943                0x48d17ae777e4f9,
2944            >(_buf?)?;
2945            Ok(_response.map(|x| x))
2946        }
2947        self.client.send_query_and_decode::<
2948            LifecycleControllerCreateInstanceRequest,
2949            LifecycleControllerCreateInstanceResult,
2950        >(
2951            (parent_moniker, collection, decl, &mut args,),
2952            0x48d17ae777e4f9,
2953            fidl::encoding::DynamicFlags::empty(),
2954            _decode,
2955        )
2956    }
2957
2958    type DestroyInstanceResponseFut = fidl::client::QueryResponseFut<
2959        LifecycleControllerDestroyInstanceResult,
2960        fidl::encoding::DefaultFuchsiaResourceDialect,
2961    >;
2962    fn r#destroy_instance(
2963        &self,
2964        mut parent_moniker: &str,
2965        mut child: &fidl_fuchsia_component_decl::ChildRef,
2966    ) -> Self::DestroyInstanceResponseFut {
2967        fn _decode(
2968            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2969        ) -> Result<LifecycleControllerDestroyInstanceResult, fidl::Error> {
2970            let _response = fidl::client::decode_transaction_body::<
2971                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DestroyError>,
2972                fidl::encoding::DefaultFuchsiaResourceDialect,
2973                0x27640ae5889d7443,
2974            >(_buf?)?;
2975            Ok(_response.map(|x| x))
2976        }
2977        self.client.send_query_and_decode::<
2978            LifecycleControllerDestroyInstanceRequest,
2979            LifecycleControllerDestroyInstanceResult,
2980        >(
2981            (parent_moniker, child,),
2982            0x27640ae5889d7443,
2983            fidl::encoding::DynamicFlags::empty(),
2984            _decode,
2985        )
2986    }
2987}
2988
2989pub struct LifecycleControllerEventStream {
2990    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2991}
2992
2993impl std::marker::Unpin for LifecycleControllerEventStream {}
2994
2995impl futures::stream::FusedStream for LifecycleControllerEventStream {
2996    fn is_terminated(&self) -> bool {
2997        self.event_receiver.is_terminated()
2998    }
2999}
3000
3001impl futures::Stream for LifecycleControllerEventStream {
3002    type Item = Result<LifecycleControllerEvent, fidl::Error>;
3003
3004    fn poll_next(
3005        mut self: std::pin::Pin<&mut Self>,
3006        cx: &mut std::task::Context<'_>,
3007    ) -> std::task::Poll<Option<Self::Item>> {
3008        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3009            &mut self.event_receiver,
3010            cx
3011        )?) {
3012            Some(buf) => std::task::Poll::Ready(Some(LifecycleControllerEvent::decode(buf))),
3013            None => std::task::Poll::Ready(None),
3014        }
3015    }
3016}
3017
3018#[derive(Debug)]
3019pub enum LifecycleControllerEvent {}
3020
3021impl LifecycleControllerEvent {
3022    /// Decodes a message buffer as a [`LifecycleControllerEvent`].
3023    fn decode(
3024        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3025    ) -> Result<LifecycleControllerEvent, fidl::Error> {
3026        let (bytes, _handles) = buf.split_mut();
3027        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3028        debug_assert_eq!(tx_header.tx_id, 0);
3029        match tx_header.ordinal {
3030            _ => Err(fidl::Error::UnknownOrdinal {
3031                ordinal: tx_header.ordinal,
3032                protocol_name:
3033                    <LifecycleControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3034            }),
3035        }
3036    }
3037}
3038
3039/// A Stream of incoming requests for fuchsia.sys2/LifecycleController.
3040pub struct LifecycleControllerRequestStream {
3041    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3042    is_terminated: bool,
3043}
3044
3045impl std::marker::Unpin for LifecycleControllerRequestStream {}
3046
3047impl futures::stream::FusedStream for LifecycleControllerRequestStream {
3048    fn is_terminated(&self) -> bool {
3049        self.is_terminated
3050    }
3051}
3052
3053impl fidl::endpoints::RequestStream for LifecycleControllerRequestStream {
3054    type Protocol = LifecycleControllerMarker;
3055    type ControlHandle = LifecycleControllerControlHandle;
3056
3057    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3058        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3059    }
3060
3061    fn control_handle(&self) -> Self::ControlHandle {
3062        LifecycleControllerControlHandle { inner: self.inner.clone() }
3063    }
3064
3065    fn into_inner(
3066        self,
3067    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3068    {
3069        (self.inner, self.is_terminated)
3070    }
3071
3072    fn from_inner(
3073        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3074        is_terminated: bool,
3075    ) -> Self {
3076        Self { inner, is_terminated }
3077    }
3078}
3079
3080impl futures::Stream for LifecycleControllerRequestStream {
3081    type Item = Result<LifecycleControllerRequest, fidl::Error>;
3082
3083    fn poll_next(
3084        mut self: std::pin::Pin<&mut Self>,
3085        cx: &mut std::task::Context<'_>,
3086    ) -> std::task::Poll<Option<Self::Item>> {
3087        let this = &mut *self;
3088        if this.inner.check_shutdown(cx) {
3089            this.is_terminated = true;
3090            return std::task::Poll::Ready(None);
3091        }
3092        if this.is_terminated {
3093            panic!("polled LifecycleControllerRequestStream after completion");
3094        }
3095        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3096            |bytes, handles| {
3097                match this.inner.channel().read_etc(cx, bytes, handles) {
3098                    std::task::Poll::Ready(Ok(())) => {}
3099                    std::task::Poll::Pending => return std::task::Poll::Pending,
3100                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3101                        this.is_terminated = true;
3102                        return std::task::Poll::Ready(None);
3103                    }
3104                    std::task::Poll::Ready(Err(e)) => {
3105                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3106                            e.into(),
3107                        ))));
3108                    }
3109                }
3110
3111                // A message has been received from the channel
3112                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3113
3114                std::task::Poll::Ready(Some(match header.ordinal {
3115                0x13fcb422876384bf => {
3116                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3117                    let mut req = fidl::new_empty!(LifecycleControllerStartInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3118                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerStartInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
3119                    let control_handle = LifecycleControllerControlHandle {
3120                        inner: this.inner.clone(),
3121                    };
3122                    Ok(LifecycleControllerRequest::StartInstance {moniker: req.moniker,
3123binder: req.binder,
3124
3125                        responder: LifecycleControllerStartInstanceResponder {
3126                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3127                            tx_id: header.tx_id,
3128                        },
3129                    })
3130                }
3131                0xd3b467436223e9 => {
3132                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3133                    let mut req = fidl::new_empty!(LifecycleControllerStartInstanceWithArgsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3134                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerStartInstanceWithArgsRequest>(&header, _body_bytes, handles, &mut req)?;
3135                    let control_handle = LifecycleControllerControlHandle {
3136                        inner: this.inner.clone(),
3137                    };
3138                    Ok(LifecycleControllerRequest::StartInstanceWithArgs {moniker: req.moniker,
3139binder: req.binder,
3140args: req.args,
3141
3142                        responder: LifecycleControllerStartInstanceWithArgsResponder {
3143                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3144                            tx_id: header.tx_id,
3145                        },
3146                    })
3147                }
3148                0x1362ba9d0e3caf36 => {
3149                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3150                    let mut req = fidl::new_empty!(LifecycleControllerStopInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3151                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerStopInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
3152                    let control_handle = LifecycleControllerControlHandle {
3153                        inner: this.inner.clone(),
3154                    };
3155                    Ok(LifecycleControllerRequest::StopInstance {moniker: req.moniker,
3156
3157                        responder: LifecycleControllerStopInstanceResponder {
3158                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3159                            tx_id: header.tx_id,
3160                        },
3161                    })
3162                }
3163                0x426ab8dd53d8e737 => {
3164                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3165                    let mut req = fidl::new_empty!(LifecycleControllerResolveInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3166                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerResolveInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
3167                    let control_handle = LifecycleControllerControlHandle {
3168                        inner: this.inner.clone(),
3169                    };
3170                    Ok(LifecycleControllerRequest::ResolveInstance {moniker: req.moniker,
3171
3172                        responder: LifecycleControllerResolveInstanceResponder {
3173                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3174                            tx_id: header.tx_id,
3175                        },
3176                    })
3177                }
3178                0x18166a2aa798cb99 => {
3179                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3180                    let mut req = fidl::new_empty!(LifecycleControllerUnresolveInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3181                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerUnresolveInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
3182                    let control_handle = LifecycleControllerControlHandle {
3183                        inner: this.inner.clone(),
3184                    };
3185                    Ok(LifecycleControllerRequest::UnresolveInstance {moniker: req.moniker,
3186
3187                        responder: LifecycleControllerUnresolveInstanceResponder {
3188                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3189                            tx_id: header.tx_id,
3190                        },
3191                    })
3192                }
3193                0x48d17ae777e4f9 => {
3194                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3195                    let mut req = fidl::new_empty!(LifecycleControllerCreateInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3196                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerCreateInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
3197                    let control_handle = LifecycleControllerControlHandle {
3198                        inner: this.inner.clone(),
3199                    };
3200                    Ok(LifecycleControllerRequest::CreateInstance {parent_moniker: req.parent_moniker,
3201collection: req.collection,
3202decl: req.decl,
3203args: req.args,
3204
3205                        responder: LifecycleControllerCreateInstanceResponder {
3206                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3207                            tx_id: header.tx_id,
3208                        },
3209                    })
3210                }
3211                0x27640ae5889d7443 => {
3212                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3213                    let mut req = fidl::new_empty!(LifecycleControllerDestroyInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3214                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleControllerDestroyInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
3215                    let control_handle = LifecycleControllerControlHandle {
3216                        inner: this.inner.clone(),
3217                    };
3218                    Ok(LifecycleControllerRequest::DestroyInstance {parent_moniker: req.parent_moniker,
3219child: req.child,
3220
3221                        responder: LifecycleControllerDestroyInstanceResponder {
3222                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3223                            tx_id: header.tx_id,
3224                        },
3225                    })
3226                }
3227                _ => Err(fidl::Error::UnknownOrdinal {
3228                    ordinal: header.ordinal,
3229                    protocol_name: <LifecycleControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3230                }),
3231            }))
3232            },
3233        )
3234    }
3235}
3236
3237/// Mutates the component instance state in a realm.
3238#[derive(Debug)]
3239pub enum LifecycleControllerRequest {
3240    /// Starts the instance identified by the given moniker. Relative
3241    /// monikers must start with "./".
3242    ///
3243    /// The client can pass in the server end of a channel
3244    /// for the fuchsia.component.Binder protocol. This protocol
3245    /// will notify the client when the instance has stopped.
3246    ///
3247    /// The function returns once the instance has been started. Calling
3248    /// StartInstance() when the instance is already running is a no-op, but
3249    /// it will connect the Binder channel if a valid handle is provided.
3250    StartInstance {
3251        moniker: String,
3252        binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
3253        responder: LifecycleControllerStartInstanceResponder,
3254    },
3255    StartInstanceWithArgs {
3256        moniker: String,
3257        binder: fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
3258        args: fidl_fuchsia_component::StartChildArgs,
3259        responder: LifecycleControllerStartInstanceWithArgsResponder,
3260    },
3261    /// Stops the instance identified by the given moniker. Relative
3262    /// monikers must start with "./".
3263    ///
3264    /// The function returns once the instance has been stopped.
3265    StopInstance { moniker: String, responder: LifecycleControllerStopInstanceResponder },
3266    /// Resolves the instance identified by the given moniker. Relative
3267    /// monikers must start with "./".
3268    ///
3269    /// The function returns once the instance has been resolved.
3270    ResolveInstance { moniker: String, responder: LifecycleControllerResolveInstanceResponder },
3271    /// Unresolves the component designated by the provided moniker. Relative
3272    /// monikers must start with "./".
3273    ///
3274    /// The function returns once the instance has been unresolved.
3275    UnresolveInstance { moniker: String, responder: LifecycleControllerUnresolveInstanceResponder },
3276    /// Creates a new child instance identified by the given moniker. Relative
3277    /// monikers must start with "./".
3278    ///
3279    /// The function returns once the child instance has been added to the topology.
3280    CreateInstance {
3281        parent_moniker: String,
3282        collection: fidl_fuchsia_component_decl::CollectionRef,
3283        decl: fidl_fuchsia_component_decl::Child,
3284        args: fidl_fuchsia_component::CreateChildArgs,
3285        responder: LifecycleControllerCreateInstanceResponder,
3286    },
3287    /// Destroys the instance identified by the given moniker. Relative
3288    /// monikers must start with "./".
3289    ///
3290    /// The function returns once the child instance no longer exists in the topology.
3291    DestroyInstance {
3292        parent_moniker: String,
3293        child: fidl_fuchsia_component_decl::ChildRef,
3294        responder: LifecycleControllerDestroyInstanceResponder,
3295    },
3296}
3297
3298impl LifecycleControllerRequest {
3299    #[allow(irrefutable_let_patterns)]
3300    pub fn into_start_instance(
3301        self,
3302    ) -> Option<(
3303        String,
3304        fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
3305        LifecycleControllerStartInstanceResponder,
3306    )> {
3307        if let LifecycleControllerRequest::StartInstance { moniker, binder, responder } = self {
3308            Some((moniker, binder, responder))
3309        } else {
3310            None
3311        }
3312    }
3313
3314    #[allow(irrefutable_let_patterns)]
3315    pub fn into_start_instance_with_args(
3316        self,
3317    ) -> Option<(
3318        String,
3319        fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
3320        fidl_fuchsia_component::StartChildArgs,
3321        LifecycleControllerStartInstanceWithArgsResponder,
3322    )> {
3323        if let LifecycleControllerRequest::StartInstanceWithArgs {
3324            moniker,
3325            binder,
3326            args,
3327            responder,
3328        } = self
3329        {
3330            Some((moniker, binder, args, responder))
3331        } else {
3332            None
3333        }
3334    }
3335
3336    #[allow(irrefutable_let_patterns)]
3337    pub fn into_stop_instance(self) -> Option<(String, LifecycleControllerStopInstanceResponder)> {
3338        if let LifecycleControllerRequest::StopInstance { moniker, responder } = self {
3339            Some((moniker, responder))
3340        } else {
3341            None
3342        }
3343    }
3344
3345    #[allow(irrefutable_let_patterns)]
3346    pub fn into_resolve_instance(
3347        self,
3348    ) -> Option<(String, LifecycleControllerResolveInstanceResponder)> {
3349        if let LifecycleControllerRequest::ResolveInstance { moniker, responder } = self {
3350            Some((moniker, responder))
3351        } else {
3352            None
3353        }
3354    }
3355
3356    #[allow(irrefutable_let_patterns)]
3357    pub fn into_unresolve_instance(
3358        self,
3359    ) -> Option<(String, LifecycleControllerUnresolveInstanceResponder)> {
3360        if let LifecycleControllerRequest::UnresolveInstance { moniker, responder } = self {
3361            Some((moniker, responder))
3362        } else {
3363            None
3364        }
3365    }
3366
3367    #[allow(irrefutable_let_patterns)]
3368    pub fn into_create_instance(
3369        self,
3370    ) -> Option<(
3371        String,
3372        fidl_fuchsia_component_decl::CollectionRef,
3373        fidl_fuchsia_component_decl::Child,
3374        fidl_fuchsia_component::CreateChildArgs,
3375        LifecycleControllerCreateInstanceResponder,
3376    )> {
3377        if let LifecycleControllerRequest::CreateInstance {
3378            parent_moniker,
3379            collection,
3380            decl,
3381            args,
3382            responder,
3383        } = self
3384        {
3385            Some((parent_moniker, collection, decl, args, responder))
3386        } else {
3387            None
3388        }
3389    }
3390
3391    #[allow(irrefutable_let_patterns)]
3392    pub fn into_destroy_instance(
3393        self,
3394    ) -> Option<(
3395        String,
3396        fidl_fuchsia_component_decl::ChildRef,
3397        LifecycleControllerDestroyInstanceResponder,
3398    )> {
3399        if let LifecycleControllerRequest::DestroyInstance { parent_moniker, child, responder } =
3400            self
3401        {
3402            Some((parent_moniker, child, responder))
3403        } else {
3404            None
3405        }
3406    }
3407
3408    /// Name of the method defined in FIDL
3409    pub fn method_name(&self) -> &'static str {
3410        match *self {
3411            LifecycleControllerRequest::StartInstance { .. } => "start_instance",
3412            LifecycleControllerRequest::StartInstanceWithArgs { .. } => "start_instance_with_args",
3413            LifecycleControllerRequest::StopInstance { .. } => "stop_instance",
3414            LifecycleControllerRequest::ResolveInstance { .. } => "resolve_instance",
3415            LifecycleControllerRequest::UnresolveInstance { .. } => "unresolve_instance",
3416            LifecycleControllerRequest::CreateInstance { .. } => "create_instance",
3417            LifecycleControllerRequest::DestroyInstance { .. } => "destroy_instance",
3418        }
3419    }
3420}
3421
3422#[derive(Debug, Clone)]
3423pub struct LifecycleControllerControlHandle {
3424    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3425}
3426
3427impl fidl::endpoints::ControlHandle for LifecycleControllerControlHandle {
3428    fn shutdown(&self) {
3429        self.inner.shutdown()
3430    }
3431
3432    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3433        self.inner.shutdown_with_epitaph(status)
3434    }
3435
3436    fn is_closed(&self) -> bool {
3437        self.inner.channel().is_closed()
3438    }
3439    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3440        self.inner.channel().on_closed()
3441    }
3442
3443    #[cfg(target_os = "fuchsia")]
3444    fn signal_peer(
3445        &self,
3446        clear_mask: zx::Signals,
3447        set_mask: zx::Signals,
3448    ) -> Result<(), zx_status::Status> {
3449        use fidl::Peered;
3450        self.inner.channel().signal_peer(clear_mask, set_mask)
3451    }
3452}
3453
3454impl LifecycleControllerControlHandle {}
3455
3456#[must_use = "FIDL methods require a response to be sent"]
3457#[derive(Debug)]
3458pub struct LifecycleControllerStartInstanceResponder {
3459    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3460    tx_id: u32,
3461}
3462
3463/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3464/// if the responder is dropped without sending a response, so that the client
3465/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3466impl std::ops::Drop for LifecycleControllerStartInstanceResponder {
3467    fn drop(&mut self) {
3468        self.control_handle.shutdown();
3469        // Safety: drops once, never accessed again
3470        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3471    }
3472}
3473
3474impl fidl::endpoints::Responder for LifecycleControllerStartInstanceResponder {
3475    type ControlHandle = LifecycleControllerControlHandle;
3476
3477    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3478        &self.control_handle
3479    }
3480
3481    fn drop_without_shutdown(mut self) {
3482        // Safety: drops once, never accessed again due to mem::forget
3483        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3484        // Prevent Drop from running (which would shut down the channel)
3485        std::mem::forget(self);
3486    }
3487}
3488
3489impl LifecycleControllerStartInstanceResponder {
3490    /// Sends a response to the FIDL transaction.
3491    ///
3492    /// Sets the channel to shutdown if an error occurs.
3493    pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
3494        let _result = self.send_raw(result);
3495        if _result.is_err() {
3496            self.control_handle.shutdown();
3497        }
3498        self.drop_without_shutdown();
3499        _result
3500    }
3501
3502    /// Similar to "send" but does not shutdown the channel if an error occurs.
3503    pub fn send_no_shutdown_on_err(
3504        self,
3505        mut result: Result<(), StartError>,
3506    ) -> Result<(), fidl::Error> {
3507        let _result = self.send_raw(result);
3508        self.drop_without_shutdown();
3509        _result
3510    }
3511
3512    fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
3513        self.control_handle
3514            .inner
3515            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StartError>>(
3516                result,
3517                self.tx_id,
3518                0x13fcb422876384bf,
3519                fidl::encoding::DynamicFlags::empty(),
3520            )
3521    }
3522}
3523
3524#[must_use = "FIDL methods require a response to be sent"]
3525#[derive(Debug)]
3526pub struct LifecycleControllerStartInstanceWithArgsResponder {
3527    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3528    tx_id: u32,
3529}
3530
3531/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3532/// if the responder is dropped without sending a response, so that the client
3533/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3534impl std::ops::Drop for LifecycleControllerStartInstanceWithArgsResponder {
3535    fn drop(&mut self) {
3536        self.control_handle.shutdown();
3537        // Safety: drops once, never accessed again
3538        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3539    }
3540}
3541
3542impl fidl::endpoints::Responder for LifecycleControllerStartInstanceWithArgsResponder {
3543    type ControlHandle = LifecycleControllerControlHandle;
3544
3545    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3546        &self.control_handle
3547    }
3548
3549    fn drop_without_shutdown(mut self) {
3550        // Safety: drops once, never accessed again due to mem::forget
3551        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3552        // Prevent Drop from running (which would shut down the channel)
3553        std::mem::forget(self);
3554    }
3555}
3556
3557impl LifecycleControllerStartInstanceWithArgsResponder {
3558    /// Sends a response to the FIDL transaction.
3559    ///
3560    /// Sets the channel to shutdown if an error occurs.
3561    pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
3562        let _result = self.send_raw(result);
3563        if _result.is_err() {
3564            self.control_handle.shutdown();
3565        }
3566        self.drop_without_shutdown();
3567        _result
3568    }
3569
3570    /// Similar to "send" but does not shutdown the channel if an error occurs.
3571    pub fn send_no_shutdown_on_err(
3572        self,
3573        mut result: Result<(), StartError>,
3574    ) -> Result<(), fidl::Error> {
3575        let _result = self.send_raw(result);
3576        self.drop_without_shutdown();
3577        _result
3578    }
3579
3580    fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
3581        self.control_handle
3582            .inner
3583            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StartError>>(
3584                result,
3585                self.tx_id,
3586                0xd3b467436223e9,
3587                fidl::encoding::DynamicFlags::empty(),
3588            )
3589    }
3590}
3591
3592#[must_use = "FIDL methods require a response to be sent"]
3593#[derive(Debug)]
3594pub struct LifecycleControllerStopInstanceResponder {
3595    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3596    tx_id: u32,
3597}
3598
3599/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3600/// if the responder is dropped without sending a response, so that the client
3601/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3602impl std::ops::Drop for LifecycleControllerStopInstanceResponder {
3603    fn drop(&mut self) {
3604        self.control_handle.shutdown();
3605        // Safety: drops once, never accessed again
3606        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3607    }
3608}
3609
3610impl fidl::endpoints::Responder for LifecycleControllerStopInstanceResponder {
3611    type ControlHandle = LifecycleControllerControlHandle;
3612
3613    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3614        &self.control_handle
3615    }
3616
3617    fn drop_without_shutdown(mut self) {
3618        // Safety: drops once, never accessed again due to mem::forget
3619        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3620        // Prevent Drop from running (which would shut down the channel)
3621        std::mem::forget(self);
3622    }
3623}
3624
3625impl LifecycleControllerStopInstanceResponder {
3626    /// Sends a response to the FIDL transaction.
3627    ///
3628    /// Sets the channel to shutdown if an error occurs.
3629    pub fn send(self, mut result: Result<(), StopError>) -> Result<(), fidl::Error> {
3630        let _result = self.send_raw(result);
3631        if _result.is_err() {
3632            self.control_handle.shutdown();
3633        }
3634        self.drop_without_shutdown();
3635        _result
3636    }
3637
3638    /// Similar to "send" but does not shutdown the channel if an error occurs.
3639    pub fn send_no_shutdown_on_err(
3640        self,
3641        mut result: Result<(), StopError>,
3642    ) -> Result<(), fidl::Error> {
3643        let _result = self.send_raw(result);
3644        self.drop_without_shutdown();
3645        _result
3646    }
3647
3648    fn send_raw(&self, mut result: Result<(), StopError>) -> Result<(), fidl::Error> {
3649        self.control_handle
3650            .inner
3651            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, StopError>>(
3652                result,
3653                self.tx_id,
3654                0x1362ba9d0e3caf36,
3655                fidl::encoding::DynamicFlags::empty(),
3656            )
3657    }
3658}
3659
3660#[must_use = "FIDL methods require a response to be sent"]
3661#[derive(Debug)]
3662pub struct LifecycleControllerResolveInstanceResponder {
3663    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3664    tx_id: u32,
3665}
3666
3667/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3668/// if the responder is dropped without sending a response, so that the client
3669/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3670impl std::ops::Drop for LifecycleControllerResolveInstanceResponder {
3671    fn drop(&mut self) {
3672        self.control_handle.shutdown();
3673        // Safety: drops once, never accessed again
3674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3675    }
3676}
3677
3678impl fidl::endpoints::Responder for LifecycleControllerResolveInstanceResponder {
3679    type ControlHandle = LifecycleControllerControlHandle;
3680
3681    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3682        &self.control_handle
3683    }
3684
3685    fn drop_without_shutdown(mut self) {
3686        // Safety: drops once, never accessed again due to mem::forget
3687        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3688        // Prevent Drop from running (which would shut down the channel)
3689        std::mem::forget(self);
3690    }
3691}
3692
3693impl LifecycleControllerResolveInstanceResponder {
3694    /// Sends a response to the FIDL transaction.
3695    ///
3696    /// Sets the channel to shutdown if an error occurs.
3697    pub fn send(self, mut result: Result<(), ResolveError>) -> Result<(), fidl::Error> {
3698        let _result = self.send_raw(result);
3699        if _result.is_err() {
3700            self.control_handle.shutdown();
3701        }
3702        self.drop_without_shutdown();
3703        _result
3704    }
3705
3706    /// Similar to "send" but does not shutdown the channel if an error occurs.
3707    pub fn send_no_shutdown_on_err(
3708        self,
3709        mut result: Result<(), ResolveError>,
3710    ) -> Result<(), fidl::Error> {
3711        let _result = self.send_raw(result);
3712        self.drop_without_shutdown();
3713        _result
3714    }
3715
3716    fn send_raw(&self, mut result: Result<(), ResolveError>) -> Result<(), fidl::Error> {
3717        self.control_handle.inner.send::<fidl::encoding::ResultType<
3718            fidl::encoding::EmptyStruct,
3719            ResolveError,
3720        >>(
3721            result,
3722            self.tx_id,
3723            0x426ab8dd53d8e737,
3724            fidl::encoding::DynamicFlags::empty(),
3725        )
3726    }
3727}
3728
3729#[must_use = "FIDL methods require a response to be sent"]
3730#[derive(Debug)]
3731pub struct LifecycleControllerUnresolveInstanceResponder {
3732    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3733    tx_id: u32,
3734}
3735
3736/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3737/// if the responder is dropped without sending a response, so that the client
3738/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3739impl std::ops::Drop for LifecycleControllerUnresolveInstanceResponder {
3740    fn drop(&mut self) {
3741        self.control_handle.shutdown();
3742        // Safety: drops once, never accessed again
3743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3744    }
3745}
3746
3747impl fidl::endpoints::Responder for LifecycleControllerUnresolveInstanceResponder {
3748    type ControlHandle = LifecycleControllerControlHandle;
3749
3750    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3751        &self.control_handle
3752    }
3753
3754    fn drop_without_shutdown(mut self) {
3755        // Safety: drops once, never accessed again due to mem::forget
3756        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3757        // Prevent Drop from running (which would shut down the channel)
3758        std::mem::forget(self);
3759    }
3760}
3761
3762impl LifecycleControllerUnresolveInstanceResponder {
3763    /// Sends a response to the FIDL transaction.
3764    ///
3765    /// Sets the channel to shutdown if an error occurs.
3766    pub fn send(self, mut result: Result<(), UnresolveError>) -> Result<(), fidl::Error> {
3767        let _result = self.send_raw(result);
3768        if _result.is_err() {
3769            self.control_handle.shutdown();
3770        }
3771        self.drop_without_shutdown();
3772        _result
3773    }
3774
3775    /// Similar to "send" but does not shutdown the channel if an error occurs.
3776    pub fn send_no_shutdown_on_err(
3777        self,
3778        mut result: Result<(), UnresolveError>,
3779    ) -> Result<(), fidl::Error> {
3780        let _result = self.send_raw(result);
3781        self.drop_without_shutdown();
3782        _result
3783    }
3784
3785    fn send_raw(&self, mut result: Result<(), UnresolveError>) -> Result<(), fidl::Error> {
3786        self.control_handle.inner.send::<fidl::encoding::ResultType<
3787            fidl::encoding::EmptyStruct,
3788            UnresolveError,
3789        >>(
3790            result,
3791            self.tx_id,
3792            0x18166a2aa798cb99,
3793            fidl::encoding::DynamicFlags::empty(),
3794        )
3795    }
3796}
3797
3798#[must_use = "FIDL methods require a response to be sent"]
3799#[derive(Debug)]
3800pub struct LifecycleControllerCreateInstanceResponder {
3801    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3802    tx_id: u32,
3803}
3804
3805/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3806/// if the responder is dropped without sending a response, so that the client
3807/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3808impl std::ops::Drop for LifecycleControllerCreateInstanceResponder {
3809    fn drop(&mut self) {
3810        self.control_handle.shutdown();
3811        // Safety: drops once, never accessed again
3812        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3813    }
3814}
3815
3816impl fidl::endpoints::Responder for LifecycleControllerCreateInstanceResponder {
3817    type ControlHandle = LifecycleControllerControlHandle;
3818
3819    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3820        &self.control_handle
3821    }
3822
3823    fn drop_without_shutdown(mut self) {
3824        // Safety: drops once, never accessed again due to mem::forget
3825        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3826        // Prevent Drop from running (which would shut down the channel)
3827        std::mem::forget(self);
3828    }
3829}
3830
3831impl LifecycleControllerCreateInstanceResponder {
3832    /// Sends a response to the FIDL transaction.
3833    ///
3834    /// Sets the channel to shutdown if an error occurs.
3835    pub fn send(self, mut result: Result<(), CreateError>) -> Result<(), fidl::Error> {
3836        let _result = self.send_raw(result);
3837        if _result.is_err() {
3838            self.control_handle.shutdown();
3839        }
3840        self.drop_without_shutdown();
3841        _result
3842    }
3843
3844    /// Similar to "send" but does not shutdown the channel if an error occurs.
3845    pub fn send_no_shutdown_on_err(
3846        self,
3847        mut result: Result<(), CreateError>,
3848    ) -> Result<(), fidl::Error> {
3849        let _result = self.send_raw(result);
3850        self.drop_without_shutdown();
3851        _result
3852    }
3853
3854    fn send_raw(&self, mut result: Result<(), CreateError>) -> Result<(), fidl::Error> {
3855        self.control_handle.inner.send::<fidl::encoding::ResultType<
3856            fidl::encoding::EmptyStruct,
3857            CreateError,
3858        >>(
3859            result,
3860            self.tx_id,
3861            0x48d17ae777e4f9,
3862            fidl::encoding::DynamicFlags::empty(),
3863        )
3864    }
3865}
3866
3867#[must_use = "FIDL methods require a response to be sent"]
3868#[derive(Debug)]
3869pub struct LifecycleControllerDestroyInstanceResponder {
3870    control_handle: std::mem::ManuallyDrop<LifecycleControllerControlHandle>,
3871    tx_id: u32,
3872}
3873
3874/// Set the the channel to be shutdown (see [`LifecycleControllerControlHandle::shutdown`])
3875/// if the responder is dropped without sending a response, so that the client
3876/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3877impl std::ops::Drop for LifecycleControllerDestroyInstanceResponder {
3878    fn drop(&mut self) {
3879        self.control_handle.shutdown();
3880        // Safety: drops once, never accessed again
3881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3882    }
3883}
3884
3885impl fidl::endpoints::Responder for LifecycleControllerDestroyInstanceResponder {
3886    type ControlHandle = LifecycleControllerControlHandle;
3887
3888    fn control_handle(&self) -> &LifecycleControllerControlHandle {
3889        &self.control_handle
3890    }
3891
3892    fn drop_without_shutdown(mut self) {
3893        // Safety: drops once, never accessed again due to mem::forget
3894        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3895        // Prevent Drop from running (which would shut down the channel)
3896        std::mem::forget(self);
3897    }
3898}
3899
3900impl LifecycleControllerDestroyInstanceResponder {
3901    /// Sends a response to the FIDL transaction.
3902    ///
3903    /// Sets the channel to shutdown if an error occurs.
3904    pub fn send(self, mut result: Result<(), DestroyError>) -> Result<(), fidl::Error> {
3905        let _result = self.send_raw(result);
3906        if _result.is_err() {
3907            self.control_handle.shutdown();
3908        }
3909        self.drop_without_shutdown();
3910        _result
3911    }
3912
3913    /// Similar to "send" but does not shutdown the channel if an error occurs.
3914    pub fn send_no_shutdown_on_err(
3915        self,
3916        mut result: Result<(), DestroyError>,
3917    ) -> Result<(), fidl::Error> {
3918        let _result = self.send_raw(result);
3919        self.drop_without_shutdown();
3920        _result
3921    }
3922
3923    fn send_raw(&self, mut result: Result<(), DestroyError>) -> Result<(), fidl::Error> {
3924        self.control_handle.inner.send::<fidl::encoding::ResultType<
3925            fidl::encoding::EmptyStruct,
3926            DestroyError,
3927        >>(
3928            result,
3929            self.tx_id,
3930            0x27640ae5889d7443,
3931            fidl::encoding::DynamicFlags::empty(),
3932        )
3933    }
3934}
3935
3936#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3937pub struct ManifestBytesIteratorMarker;
3938
3939impl fidl::endpoints::ProtocolMarker for ManifestBytesIteratorMarker {
3940    type Proxy = ManifestBytesIteratorProxy;
3941    type RequestStream = ManifestBytesIteratorRequestStream;
3942    #[cfg(target_os = "fuchsia")]
3943    type SynchronousProxy = ManifestBytesIteratorSynchronousProxy;
3944
3945    const DEBUG_NAME: &'static str = "(anonymous) ManifestBytesIterator";
3946}
3947
3948pub trait ManifestBytesIteratorProxyInterface: Send + Sync {
3949    type NextResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
3950    fn r#next(&self) -> Self::NextResponseFut;
3951}
3952#[derive(Debug)]
3953#[cfg(target_os = "fuchsia")]
3954pub struct ManifestBytesIteratorSynchronousProxy {
3955    client: fidl::client::sync::Client,
3956}
3957
3958#[cfg(target_os = "fuchsia")]
3959impl fidl::endpoints::SynchronousProxy for ManifestBytesIteratorSynchronousProxy {
3960    type Proxy = ManifestBytesIteratorProxy;
3961    type Protocol = ManifestBytesIteratorMarker;
3962
3963    fn from_channel(inner: fidl::Channel) -> Self {
3964        Self::new(inner)
3965    }
3966
3967    fn into_channel(self) -> fidl::Channel {
3968        self.client.into_channel()
3969    }
3970
3971    fn as_channel(&self) -> &fidl::Channel {
3972        self.client.as_channel()
3973    }
3974}
3975
3976#[cfg(target_os = "fuchsia")]
3977impl ManifestBytesIteratorSynchronousProxy {
3978    pub fn new(channel: fidl::Channel) -> Self {
3979        let protocol_name =
3980            <ManifestBytesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3981        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3982    }
3983
3984    pub fn into_channel(self) -> fidl::Channel {
3985        self.client.into_channel()
3986    }
3987
3988    /// Waits until an event arrives and returns it. It is safe for other
3989    /// threads to make concurrent requests while waiting for an event.
3990    pub fn wait_for_event(
3991        &self,
3992        deadline: zx::MonotonicInstant,
3993    ) -> Result<ManifestBytesIteratorEvent, fidl::Error> {
3994        ManifestBytesIteratorEvent::decode(self.client.wait_for_event(deadline)?)
3995    }
3996
3997    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<u8>, fidl::Error> {
3998        let _response = self
3999            .client
4000            .send_query::<fidl::encoding::EmptyPayload, ManifestBytesIteratorNextResponse>(
4001                (),
4002                0x4be4659549b15500,
4003                fidl::encoding::DynamicFlags::empty(),
4004                ___deadline,
4005            )?;
4006        Ok(_response.infos)
4007    }
4008}
4009
4010#[cfg(target_os = "fuchsia")]
4011impl From<ManifestBytesIteratorSynchronousProxy> for zx::NullableHandle {
4012    fn from(value: ManifestBytesIteratorSynchronousProxy) -> Self {
4013        value.into_channel().into()
4014    }
4015}
4016
4017#[cfg(target_os = "fuchsia")]
4018impl From<fidl::Channel> for ManifestBytesIteratorSynchronousProxy {
4019    fn from(value: fidl::Channel) -> Self {
4020        Self::new(value)
4021    }
4022}
4023
4024#[cfg(target_os = "fuchsia")]
4025impl fidl::endpoints::FromClient for ManifestBytesIteratorSynchronousProxy {
4026    type Protocol = ManifestBytesIteratorMarker;
4027
4028    fn from_client(value: fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>) -> Self {
4029        Self::new(value.into_channel())
4030    }
4031}
4032
4033#[derive(Debug, Clone)]
4034pub struct ManifestBytesIteratorProxy {
4035    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4036}
4037
4038impl fidl::endpoints::Proxy for ManifestBytesIteratorProxy {
4039    type Protocol = ManifestBytesIteratorMarker;
4040
4041    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4042        Self::new(inner)
4043    }
4044
4045    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4046        self.client.into_channel().map_err(|client| Self { client })
4047    }
4048
4049    fn as_channel(&self) -> &::fidl::AsyncChannel {
4050        self.client.as_channel()
4051    }
4052}
4053
4054impl ManifestBytesIteratorProxy {
4055    /// Create a new Proxy for fuchsia.sys2/ManifestBytesIterator.
4056    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4057        let protocol_name =
4058            <ManifestBytesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4059        Self { client: fidl::client::Client::new(channel, protocol_name) }
4060    }
4061
4062    /// Get a Stream of events from the remote end of the protocol.
4063    ///
4064    /// # Panics
4065    ///
4066    /// Panics if the event stream was already taken.
4067    pub fn take_event_stream(&self) -> ManifestBytesIteratorEventStream {
4068        ManifestBytesIteratorEventStream { event_receiver: self.client.take_event_receiver() }
4069    }
4070
4071    pub fn r#next(
4072        &self,
4073    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
4074    {
4075        ManifestBytesIteratorProxyInterface::r#next(self)
4076    }
4077}
4078
4079impl ManifestBytesIteratorProxyInterface for ManifestBytesIteratorProxy {
4080    type NextResponseFut =
4081        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
4082    fn r#next(&self) -> Self::NextResponseFut {
4083        fn _decode(
4084            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4085        ) -> Result<Vec<u8>, fidl::Error> {
4086            let _response = fidl::client::decode_transaction_body::<
4087                ManifestBytesIteratorNextResponse,
4088                fidl::encoding::DefaultFuchsiaResourceDialect,
4089                0x4be4659549b15500,
4090            >(_buf?)?;
4091            Ok(_response.infos)
4092        }
4093        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
4094            (),
4095            0x4be4659549b15500,
4096            fidl::encoding::DynamicFlags::empty(),
4097            _decode,
4098        )
4099    }
4100}
4101
4102pub struct ManifestBytesIteratorEventStream {
4103    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4104}
4105
4106impl std::marker::Unpin for ManifestBytesIteratorEventStream {}
4107
4108impl futures::stream::FusedStream for ManifestBytesIteratorEventStream {
4109    fn is_terminated(&self) -> bool {
4110        self.event_receiver.is_terminated()
4111    }
4112}
4113
4114impl futures::Stream for ManifestBytesIteratorEventStream {
4115    type Item = Result<ManifestBytesIteratorEvent, fidl::Error>;
4116
4117    fn poll_next(
4118        mut self: std::pin::Pin<&mut Self>,
4119        cx: &mut std::task::Context<'_>,
4120    ) -> std::task::Poll<Option<Self::Item>> {
4121        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4122            &mut self.event_receiver,
4123            cx
4124        )?) {
4125            Some(buf) => std::task::Poll::Ready(Some(ManifestBytesIteratorEvent::decode(buf))),
4126            None => std::task::Poll::Ready(None),
4127        }
4128    }
4129}
4130
4131#[derive(Debug)]
4132pub enum ManifestBytesIteratorEvent {}
4133
4134impl ManifestBytesIteratorEvent {
4135    /// Decodes a message buffer as a [`ManifestBytesIteratorEvent`].
4136    fn decode(
4137        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4138    ) -> Result<ManifestBytesIteratorEvent, fidl::Error> {
4139        let (bytes, _handles) = buf.split_mut();
4140        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4141        debug_assert_eq!(tx_header.tx_id, 0);
4142        match tx_header.ordinal {
4143            _ => Err(fidl::Error::UnknownOrdinal {
4144                ordinal: tx_header.ordinal,
4145                protocol_name:
4146                    <ManifestBytesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4147            }),
4148        }
4149    }
4150}
4151
4152/// A Stream of incoming requests for fuchsia.sys2/ManifestBytesIterator.
4153pub struct ManifestBytesIteratorRequestStream {
4154    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4155    is_terminated: bool,
4156}
4157
4158impl std::marker::Unpin for ManifestBytesIteratorRequestStream {}
4159
4160impl futures::stream::FusedStream for ManifestBytesIteratorRequestStream {
4161    fn is_terminated(&self) -> bool {
4162        self.is_terminated
4163    }
4164}
4165
4166impl fidl::endpoints::RequestStream for ManifestBytesIteratorRequestStream {
4167    type Protocol = ManifestBytesIteratorMarker;
4168    type ControlHandle = ManifestBytesIteratorControlHandle;
4169
4170    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4171        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4172    }
4173
4174    fn control_handle(&self) -> Self::ControlHandle {
4175        ManifestBytesIteratorControlHandle { inner: self.inner.clone() }
4176    }
4177
4178    fn into_inner(
4179        self,
4180    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4181    {
4182        (self.inner, self.is_terminated)
4183    }
4184
4185    fn from_inner(
4186        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4187        is_terminated: bool,
4188    ) -> Self {
4189        Self { inner, is_terminated }
4190    }
4191}
4192
4193impl futures::Stream for ManifestBytesIteratorRequestStream {
4194    type Item = Result<ManifestBytesIteratorRequest, fidl::Error>;
4195
4196    fn poll_next(
4197        mut self: std::pin::Pin<&mut Self>,
4198        cx: &mut std::task::Context<'_>,
4199    ) -> std::task::Poll<Option<Self::Item>> {
4200        let this = &mut *self;
4201        if this.inner.check_shutdown(cx) {
4202            this.is_terminated = true;
4203            return std::task::Poll::Ready(None);
4204        }
4205        if this.is_terminated {
4206            panic!("polled ManifestBytesIteratorRequestStream after completion");
4207        }
4208        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4209            |bytes, handles| {
4210                match this.inner.channel().read_etc(cx, bytes, handles) {
4211                    std::task::Poll::Ready(Ok(())) => {}
4212                    std::task::Poll::Pending => return std::task::Poll::Pending,
4213                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4214                        this.is_terminated = true;
4215                        return std::task::Poll::Ready(None);
4216                    }
4217                    std::task::Poll::Ready(Err(e)) => {
4218                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4219                            e.into(),
4220                        ))));
4221                    }
4222                }
4223
4224                // A message has been received from the channel
4225                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4226
4227                std::task::Poll::Ready(Some(match header.ordinal {
4228                0x4be4659549b15500 => {
4229                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4230                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4231                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4232                    let control_handle = ManifestBytesIteratorControlHandle {
4233                        inner: this.inner.clone(),
4234                    };
4235                    Ok(ManifestBytesIteratorRequest::Next {
4236                        responder: ManifestBytesIteratorNextResponder {
4237                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4238                            tx_id: header.tx_id,
4239                        },
4240                    })
4241                }
4242                _ => Err(fidl::Error::UnknownOrdinal {
4243                    ordinal: header.ordinal,
4244                    protocol_name: <ManifestBytesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4245                }),
4246            }))
4247            },
4248        )
4249    }
4250}
4251
4252/// An iterator over the bytes of an instance's manifest
4253#[derive(Debug)]
4254pub enum ManifestBytesIteratorRequest {
4255    Next { responder: ManifestBytesIteratorNextResponder },
4256}
4257
4258impl ManifestBytesIteratorRequest {
4259    #[allow(irrefutable_let_patterns)]
4260    pub fn into_next(self) -> Option<(ManifestBytesIteratorNextResponder)> {
4261        if let ManifestBytesIteratorRequest::Next { responder } = self {
4262            Some((responder))
4263        } else {
4264            None
4265        }
4266    }
4267
4268    /// Name of the method defined in FIDL
4269    pub fn method_name(&self) -> &'static str {
4270        match *self {
4271            ManifestBytesIteratorRequest::Next { .. } => "next",
4272        }
4273    }
4274}
4275
4276#[derive(Debug, Clone)]
4277pub struct ManifestBytesIteratorControlHandle {
4278    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4279}
4280
4281impl fidl::endpoints::ControlHandle for ManifestBytesIteratorControlHandle {
4282    fn shutdown(&self) {
4283        self.inner.shutdown()
4284    }
4285
4286    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4287        self.inner.shutdown_with_epitaph(status)
4288    }
4289
4290    fn is_closed(&self) -> bool {
4291        self.inner.channel().is_closed()
4292    }
4293    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4294        self.inner.channel().on_closed()
4295    }
4296
4297    #[cfg(target_os = "fuchsia")]
4298    fn signal_peer(
4299        &self,
4300        clear_mask: zx::Signals,
4301        set_mask: zx::Signals,
4302    ) -> Result<(), zx_status::Status> {
4303        use fidl::Peered;
4304        self.inner.channel().signal_peer(clear_mask, set_mask)
4305    }
4306}
4307
4308impl ManifestBytesIteratorControlHandle {}
4309
4310#[must_use = "FIDL methods require a response to be sent"]
4311#[derive(Debug)]
4312pub struct ManifestBytesIteratorNextResponder {
4313    control_handle: std::mem::ManuallyDrop<ManifestBytesIteratorControlHandle>,
4314    tx_id: u32,
4315}
4316
4317/// Set the the channel to be shutdown (see [`ManifestBytesIteratorControlHandle::shutdown`])
4318/// if the responder is dropped without sending a response, so that the client
4319/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4320impl std::ops::Drop for ManifestBytesIteratorNextResponder {
4321    fn drop(&mut self) {
4322        self.control_handle.shutdown();
4323        // Safety: drops once, never accessed again
4324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4325    }
4326}
4327
4328impl fidl::endpoints::Responder for ManifestBytesIteratorNextResponder {
4329    type ControlHandle = ManifestBytesIteratorControlHandle;
4330
4331    fn control_handle(&self) -> &ManifestBytesIteratorControlHandle {
4332        &self.control_handle
4333    }
4334
4335    fn drop_without_shutdown(mut self) {
4336        // Safety: drops once, never accessed again due to mem::forget
4337        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4338        // Prevent Drop from running (which would shut down the channel)
4339        std::mem::forget(self);
4340    }
4341}
4342
4343impl ManifestBytesIteratorNextResponder {
4344    /// Sends a response to the FIDL transaction.
4345    ///
4346    /// Sets the channel to shutdown if an error occurs.
4347    pub fn send(self, mut infos: &[u8]) -> Result<(), fidl::Error> {
4348        let _result = self.send_raw(infos);
4349        if _result.is_err() {
4350            self.control_handle.shutdown();
4351        }
4352        self.drop_without_shutdown();
4353        _result
4354    }
4355
4356    /// Similar to "send" but does not shutdown the channel if an error occurs.
4357    pub fn send_no_shutdown_on_err(self, mut infos: &[u8]) -> Result<(), fidl::Error> {
4358        let _result = self.send_raw(infos);
4359        self.drop_without_shutdown();
4360        _result
4361    }
4362
4363    fn send_raw(&self, mut infos: &[u8]) -> Result<(), fidl::Error> {
4364        self.control_handle.inner.send::<ManifestBytesIteratorNextResponse>(
4365            (infos,),
4366            self.tx_id,
4367            0x4be4659549b15500,
4368            fidl::encoding::DynamicFlags::empty(),
4369        )
4370    }
4371}
4372
4373#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4374pub struct RealmExplorerMarker;
4375
4376impl fidl::endpoints::ProtocolMarker for RealmExplorerMarker {
4377    type Proxy = RealmExplorerProxy;
4378    type RequestStream = RealmExplorerRequestStream;
4379    #[cfg(target_os = "fuchsia")]
4380    type SynchronousProxy = RealmExplorerSynchronousProxy;
4381
4382    const DEBUG_NAME: &'static str = "fuchsia.sys2.RealmExplorer";
4383}
4384impl fidl::endpoints::DiscoverableProtocolMarker for RealmExplorerMarker {}
4385
4386pub trait RealmExplorerProxyInterface: Send + Sync {}
4387#[derive(Debug)]
4388#[cfg(target_os = "fuchsia")]
4389pub struct RealmExplorerSynchronousProxy {
4390    client: fidl::client::sync::Client,
4391}
4392
4393#[cfg(target_os = "fuchsia")]
4394impl fidl::endpoints::SynchronousProxy for RealmExplorerSynchronousProxy {
4395    type Proxy = RealmExplorerProxy;
4396    type Protocol = RealmExplorerMarker;
4397
4398    fn from_channel(inner: fidl::Channel) -> Self {
4399        Self::new(inner)
4400    }
4401
4402    fn into_channel(self) -> fidl::Channel {
4403        self.client.into_channel()
4404    }
4405
4406    fn as_channel(&self) -> &fidl::Channel {
4407        self.client.as_channel()
4408    }
4409}
4410
4411#[cfg(target_os = "fuchsia")]
4412impl RealmExplorerSynchronousProxy {
4413    pub fn new(channel: fidl::Channel) -> Self {
4414        let protocol_name = <RealmExplorerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4415        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4416    }
4417
4418    pub fn into_channel(self) -> fidl::Channel {
4419        self.client.into_channel()
4420    }
4421
4422    /// Waits until an event arrives and returns it. It is safe for other
4423    /// threads to make concurrent requests while waiting for an event.
4424    pub fn wait_for_event(
4425        &self,
4426        deadline: zx::MonotonicInstant,
4427    ) -> Result<RealmExplorerEvent, fidl::Error> {
4428        RealmExplorerEvent::decode(self.client.wait_for_event(deadline)?)
4429    }
4430}
4431
4432#[cfg(target_os = "fuchsia")]
4433impl From<RealmExplorerSynchronousProxy> for zx::NullableHandle {
4434    fn from(value: RealmExplorerSynchronousProxy) -> Self {
4435        value.into_channel().into()
4436    }
4437}
4438
4439#[cfg(target_os = "fuchsia")]
4440impl From<fidl::Channel> for RealmExplorerSynchronousProxy {
4441    fn from(value: fidl::Channel) -> Self {
4442        Self::new(value)
4443    }
4444}
4445
4446#[cfg(target_os = "fuchsia")]
4447impl fidl::endpoints::FromClient for RealmExplorerSynchronousProxy {
4448    type Protocol = RealmExplorerMarker;
4449
4450    fn from_client(value: fidl::endpoints::ClientEnd<RealmExplorerMarker>) -> Self {
4451        Self::new(value.into_channel())
4452    }
4453}
4454
4455#[derive(Debug, Clone)]
4456pub struct RealmExplorerProxy {
4457    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4458}
4459
4460impl fidl::endpoints::Proxy for RealmExplorerProxy {
4461    type Protocol = RealmExplorerMarker;
4462
4463    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4464        Self::new(inner)
4465    }
4466
4467    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4468        self.client.into_channel().map_err(|client| Self { client })
4469    }
4470
4471    fn as_channel(&self) -> &::fidl::AsyncChannel {
4472        self.client.as_channel()
4473    }
4474}
4475
4476impl RealmExplorerProxy {
4477    /// Create a new Proxy for fuchsia.sys2/RealmExplorer.
4478    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4479        let protocol_name = <RealmExplorerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4480        Self { client: fidl::client::Client::new(channel, protocol_name) }
4481    }
4482
4483    /// Get a Stream of events from the remote end of the protocol.
4484    ///
4485    /// # Panics
4486    ///
4487    /// Panics if the event stream was already taken.
4488    pub fn take_event_stream(&self) -> RealmExplorerEventStream {
4489        RealmExplorerEventStream { event_receiver: self.client.take_event_receiver() }
4490    }
4491}
4492
4493impl RealmExplorerProxyInterface for RealmExplorerProxy {}
4494
4495pub struct RealmExplorerEventStream {
4496    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4497}
4498
4499impl std::marker::Unpin for RealmExplorerEventStream {}
4500
4501impl futures::stream::FusedStream for RealmExplorerEventStream {
4502    fn is_terminated(&self) -> bool {
4503        self.event_receiver.is_terminated()
4504    }
4505}
4506
4507impl futures::Stream for RealmExplorerEventStream {
4508    type Item = Result<RealmExplorerEvent, fidl::Error>;
4509
4510    fn poll_next(
4511        mut self: std::pin::Pin<&mut Self>,
4512        cx: &mut std::task::Context<'_>,
4513    ) -> std::task::Poll<Option<Self::Item>> {
4514        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4515            &mut self.event_receiver,
4516            cx
4517        )?) {
4518            Some(buf) => std::task::Poll::Ready(Some(RealmExplorerEvent::decode(buf))),
4519            None => std::task::Poll::Ready(None),
4520        }
4521    }
4522}
4523
4524#[derive(Debug)]
4525pub enum RealmExplorerEvent {}
4526
4527impl RealmExplorerEvent {
4528    /// Decodes a message buffer as a [`RealmExplorerEvent`].
4529    fn decode(
4530        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4531    ) -> Result<RealmExplorerEvent, fidl::Error> {
4532        let (bytes, _handles) = buf.split_mut();
4533        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4534        debug_assert_eq!(tx_header.tx_id, 0);
4535        match tx_header.ordinal {
4536            _ => Err(fidl::Error::UnknownOrdinal {
4537                ordinal: tx_header.ordinal,
4538                protocol_name: <RealmExplorerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4539            }),
4540        }
4541    }
4542}
4543
4544/// A Stream of incoming requests for fuchsia.sys2/RealmExplorer.
4545pub struct RealmExplorerRequestStream {
4546    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4547    is_terminated: bool,
4548}
4549
4550impl std::marker::Unpin for RealmExplorerRequestStream {}
4551
4552impl futures::stream::FusedStream for RealmExplorerRequestStream {
4553    fn is_terminated(&self) -> bool {
4554        self.is_terminated
4555    }
4556}
4557
4558impl fidl::endpoints::RequestStream for RealmExplorerRequestStream {
4559    type Protocol = RealmExplorerMarker;
4560    type ControlHandle = RealmExplorerControlHandle;
4561
4562    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4563        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4564    }
4565
4566    fn control_handle(&self) -> Self::ControlHandle {
4567        RealmExplorerControlHandle { inner: self.inner.clone() }
4568    }
4569
4570    fn into_inner(
4571        self,
4572    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4573    {
4574        (self.inner, self.is_terminated)
4575    }
4576
4577    fn from_inner(
4578        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4579        is_terminated: bool,
4580    ) -> Self {
4581        Self { inner, is_terminated }
4582    }
4583}
4584
4585impl futures::Stream for RealmExplorerRequestStream {
4586    type Item = Result<RealmExplorerRequest, fidl::Error>;
4587
4588    fn poll_next(
4589        mut self: std::pin::Pin<&mut Self>,
4590        cx: &mut std::task::Context<'_>,
4591    ) -> std::task::Poll<Option<Self::Item>> {
4592        let this = &mut *self;
4593        if this.inner.check_shutdown(cx) {
4594            this.is_terminated = true;
4595            return std::task::Poll::Ready(None);
4596        }
4597        if this.is_terminated {
4598            panic!("polled RealmExplorerRequestStream after completion");
4599        }
4600        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4601            |bytes, handles| {
4602                match this.inner.channel().read_etc(cx, bytes, handles) {
4603                    std::task::Poll::Ready(Ok(())) => {}
4604                    std::task::Poll::Pending => return std::task::Poll::Pending,
4605                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4606                        this.is_terminated = true;
4607                        return std::task::Poll::Ready(None);
4608                    }
4609                    std::task::Poll::Ready(Err(e)) => {
4610                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4611                            e.into(),
4612                        ))));
4613                    }
4614                }
4615
4616                // A message has been received from the channel
4617                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4618
4619                std::task::Poll::Ready(Some(match header.ordinal {
4620                    _ => Err(fidl::Error::UnknownOrdinal {
4621                        ordinal: header.ordinal,
4622                        protocol_name:
4623                            <RealmExplorerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4624                    }),
4625                }))
4626            },
4627        )
4628    }
4629}
4630
4631/// Offers basic introspection into component instances under a realm.
4632#[derive(Debug)]
4633pub enum RealmExplorerRequest {}
4634
4635impl RealmExplorerRequest {
4636    /// Name of the method defined in FIDL
4637    pub fn method_name(&self) -> &'static str {
4638        match *self {}
4639    }
4640}
4641
4642#[derive(Debug, Clone)]
4643pub struct RealmExplorerControlHandle {
4644    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4645}
4646
4647impl fidl::endpoints::ControlHandle for RealmExplorerControlHandle {
4648    fn shutdown(&self) {
4649        self.inner.shutdown()
4650    }
4651
4652    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4653        self.inner.shutdown_with_epitaph(status)
4654    }
4655
4656    fn is_closed(&self) -> bool {
4657        self.inner.channel().is_closed()
4658    }
4659    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4660        self.inner.channel().on_closed()
4661    }
4662
4663    #[cfg(target_os = "fuchsia")]
4664    fn signal_peer(
4665        &self,
4666        clear_mask: zx::Signals,
4667        set_mask: zx::Signals,
4668    ) -> Result<(), zx_status::Status> {
4669        use fidl::Peered;
4670        self.inner.channel().signal_peer(clear_mask, set_mask)
4671    }
4672}
4673
4674impl RealmExplorerControlHandle {}
4675
4676#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4677pub struct RealmQueryMarker;
4678
4679impl fidl::endpoints::ProtocolMarker for RealmQueryMarker {
4680    type Proxy = RealmQueryProxy;
4681    type RequestStream = RealmQueryRequestStream;
4682    #[cfg(target_os = "fuchsia")]
4683    type SynchronousProxy = RealmQuerySynchronousProxy;
4684
4685    const DEBUG_NAME: &'static str = "fuchsia.sys2.RealmQuery";
4686}
4687impl fidl::endpoints::DiscoverableProtocolMarker for RealmQueryMarker {}
4688pub type RealmQueryGetInstanceResult = Result<Instance, GetInstanceError>;
4689pub type RealmQueryGetResolvedDeclarationResult =
4690    Result<fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>, GetDeclarationError>;
4691pub type RealmQueryResolveDeclarationResult =
4692    Result<fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>, GetDeclarationError>;
4693pub type RealmQueryGetStructuredConfigResult =
4694    Result<fidl_fuchsia_component_decl::ResolvedConfig, GetStructuredConfigError>;
4695pub type RealmQueryGetAllInstancesResult =
4696    Result<fidl::endpoints::ClientEnd<InstanceIteratorMarker>, GetAllInstancesError>;
4697pub type RealmQueryConstructNamespaceResult =
4698    Result<Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>, ConstructNamespaceError>;
4699pub type RealmQueryOpenDirectoryResult = Result<(), OpenError>;
4700pub type RealmQueryConnectToStorageAdminResult = Result<(), ConnectToStorageAdminError>;
4701pub type RealmQueryOpenStorageAdminResult = Result<(), ConnectToStorageAdminError>;
4702
4703pub trait RealmQueryProxyInterface: Send + Sync {
4704    type GetInstanceResponseFut: std::future::Future<Output = Result<RealmQueryGetInstanceResult, fidl::Error>>
4705        + Send;
4706    fn r#get_instance(&self, moniker: &str) -> Self::GetInstanceResponseFut;
4707    type GetResolvedDeclarationResponseFut: std::future::Future<Output = Result<RealmQueryGetResolvedDeclarationResult, fidl::Error>>
4708        + Send;
4709    fn r#get_resolved_declaration(&self, moniker: &str) -> Self::GetResolvedDeclarationResponseFut;
4710    type ResolveDeclarationResponseFut: std::future::Future<Output = Result<RealmQueryResolveDeclarationResult, fidl::Error>>
4711        + Send;
4712    fn r#resolve_declaration(
4713        &self,
4714        parent: &str,
4715        child_location: &ChildLocation,
4716        url: &str,
4717    ) -> Self::ResolveDeclarationResponseFut;
4718    type GetStructuredConfigResponseFut: std::future::Future<Output = Result<RealmQueryGetStructuredConfigResult, fidl::Error>>
4719        + Send;
4720    fn r#get_structured_config(&self, moniker: &str) -> Self::GetStructuredConfigResponseFut;
4721    type GetAllInstancesResponseFut: std::future::Future<Output = Result<RealmQueryGetAllInstancesResult, fidl::Error>>
4722        + Send;
4723    fn r#get_all_instances(&self) -> Self::GetAllInstancesResponseFut;
4724    type ConstructNamespaceResponseFut: std::future::Future<Output = Result<RealmQueryConstructNamespaceResult, fidl::Error>>
4725        + Send;
4726    fn r#construct_namespace(&self, moniker: &str) -> Self::ConstructNamespaceResponseFut;
4727    type OpenDirectoryResponseFut: std::future::Future<Output = Result<RealmQueryOpenDirectoryResult, fidl::Error>>
4728        + Send;
4729    fn r#open_directory(
4730        &self,
4731        moniker: &str,
4732        dir_type: OpenDirType,
4733        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4734    ) -> Self::OpenDirectoryResponseFut;
4735    type ConnectToStorageAdminResponseFut: std::future::Future<Output = Result<RealmQueryConnectToStorageAdminResult, fidl::Error>>
4736        + Send;
4737    fn r#connect_to_storage_admin(
4738        &self,
4739        moniker: &str,
4740        storage_name: &str,
4741        server_end: fidl::endpoints::ServerEnd<StorageAdminMarker>,
4742    ) -> Self::ConnectToStorageAdminResponseFut;
4743    type OpenStorageAdminResponseFut: std::future::Future<Output = Result<RealmQueryOpenStorageAdminResult, fidl::Error>>
4744        + Send;
4745    fn r#open_storage_admin(
4746        &self,
4747        moniker: &str,
4748        storage_name: &str,
4749        server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
4750    ) -> Self::OpenStorageAdminResponseFut;
4751}
4752#[derive(Debug)]
4753#[cfg(target_os = "fuchsia")]
4754pub struct RealmQuerySynchronousProxy {
4755    client: fidl::client::sync::Client,
4756}
4757
4758#[cfg(target_os = "fuchsia")]
4759impl fidl::endpoints::SynchronousProxy for RealmQuerySynchronousProxy {
4760    type Proxy = RealmQueryProxy;
4761    type Protocol = RealmQueryMarker;
4762
4763    fn from_channel(inner: fidl::Channel) -> Self {
4764        Self::new(inner)
4765    }
4766
4767    fn into_channel(self) -> fidl::Channel {
4768        self.client.into_channel()
4769    }
4770
4771    fn as_channel(&self) -> &fidl::Channel {
4772        self.client.as_channel()
4773    }
4774}
4775
4776#[cfg(target_os = "fuchsia")]
4777impl RealmQuerySynchronousProxy {
4778    pub fn new(channel: fidl::Channel) -> Self {
4779        let protocol_name = <RealmQueryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4780        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4781    }
4782
4783    pub fn into_channel(self) -> fidl::Channel {
4784        self.client.into_channel()
4785    }
4786
4787    /// Waits until an event arrives and returns it. It is safe for other
4788    /// threads to make concurrent requests while waiting for an event.
4789    pub fn wait_for_event(
4790        &self,
4791        deadline: zx::MonotonicInstant,
4792    ) -> Result<RealmQueryEvent, fidl::Error> {
4793        RealmQueryEvent::decode(self.client.wait_for_event(deadline)?)
4794    }
4795
4796    /// Gets an instance identified by its moniker.
4797    pub fn r#get_instance(
4798        &self,
4799        mut moniker: &str,
4800        ___deadline: zx::MonotonicInstant,
4801    ) -> Result<RealmQueryGetInstanceResult, fidl::Error> {
4802        let _response =
4803            self.client.send_query::<RealmQueryGetInstanceRequest, fidl::encoding::ResultType<
4804                RealmQueryGetInstanceResponse,
4805                GetInstanceError,
4806            >>(
4807                (moniker,),
4808                0x3496ca1e5a0c13a8,
4809                fidl::encoding::DynamicFlags::empty(),
4810                ___deadline,
4811            )?;
4812        Ok(_response.map(|x| x.instance))
4813    }
4814
4815    /// Gets the manifest of an instance identified by its moniker.
4816    ///
4817    /// The manifest is encoded in its standalone persistable format per RFC-0120 and
4818    /// is sent across using an iterator. Some manifests are too large to send over a
4819    /// Zircon channel and we can't use a VMO because we need an approach that is
4820    /// compatible with overnet.
4821    pub fn r#get_resolved_declaration(
4822        &self,
4823        mut moniker: &str,
4824        ___deadline: zx::MonotonicInstant,
4825    ) -> Result<RealmQueryGetResolvedDeclarationResult, fidl::Error> {
4826        let _response = self
4827            .client
4828            .send_query::<RealmQueryGetResolvedDeclarationRequest, fidl::encoding::ResultType<
4829                RealmQueryGetResolvedDeclarationResponse,
4830                GetDeclarationError,
4831            >>(
4832                (moniker,),
4833                0x31a493d284a0bc1f,
4834                fidl::encoding::DynamicFlags::empty(),
4835                ___deadline,
4836            )?;
4837        Ok(_response.map(|x| x.iterator))
4838    }
4839
4840    /// Gets the manifest of a component URL as if it were a child of the specified parent
4841    /// without actually creating or starting that component.
4842    ///
4843    /// The manifest is encoded in its standalone persistable format per RFC-0120 and
4844    /// is sent across using an iterator. Some manifests are too large to send over a
4845    /// Zircon channel and we can't use a VMO because we need an approach that is
4846    /// compatible with overnet.
4847    pub fn r#resolve_declaration(
4848        &self,
4849        mut parent: &str,
4850        mut child_location: &ChildLocation,
4851        mut url: &str,
4852        ___deadline: zx::MonotonicInstant,
4853    ) -> Result<RealmQueryResolveDeclarationResult, fidl::Error> {
4854        let _response =
4855            self.client
4856                .send_query::<RealmQueryResolveDeclarationRequest, fidl::encoding::ResultType<
4857                    RealmQueryResolveDeclarationResponse,
4858                    GetDeclarationError,
4859                >>(
4860                    (parent, child_location, url),
4861                    0x1ab1adf2a87d962d,
4862                    fidl::encoding::DynamicFlags::empty(),
4863                    ___deadline,
4864                )?;
4865        Ok(_response.map(|x| x.iterator))
4866    }
4867
4868    /// Gets the structured config of an instance identified by its moniker.
4869    pub fn r#get_structured_config(
4870        &self,
4871        mut moniker: &str,
4872        ___deadline: zx::MonotonicInstant,
4873    ) -> Result<RealmQueryGetStructuredConfigResult, fidl::Error> {
4874        let _response = self
4875            .client
4876            .send_query::<RealmQueryGetStructuredConfigRequest, fidl::encoding::ResultType<
4877                RealmQueryGetStructuredConfigResponse,
4878                GetStructuredConfigError,
4879            >>(
4880                (moniker,), 0x16f88f6735bd204, fidl::encoding::DynamicFlags::empty(), ___deadline
4881            )?;
4882        Ok(_response.map(|x| x.config))
4883    }
4884
4885    /// Returns an iterator over all component instances in this realm and instances within resolved
4886    /// children, recursively. Unresolved child components will be included in this list, but
4887    /// children of unresolved children will not be.
4888    pub fn r#get_all_instances(
4889        &self,
4890        ___deadline: zx::MonotonicInstant,
4891    ) -> Result<RealmQueryGetAllInstancesResult, fidl::Error> {
4892        let _response =
4893            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
4894                RealmQueryGetAllInstancesResponse,
4895                GetAllInstancesError,
4896            >>(
4897                (),
4898                0x7b5a8775d30cad47,
4899                fidl::encoding::DynamicFlags::empty(),
4900                ___deadline,
4901            )?;
4902        Ok(_response.map(|x| x.iterator))
4903    }
4904
4905    /// Constructs the namespace of an instance as determined by its use declarations.
4906    /// This is usually identical to what would be given to the component's runner on
4907    /// component start time, unless extended by
4908    /// `fuchsia.component/StartChildArgs.namespace_entries`.
4909    pub fn r#construct_namespace(
4910        &self,
4911        mut moniker: &str,
4912        ___deadline: zx::MonotonicInstant,
4913    ) -> Result<RealmQueryConstructNamespaceResult, fidl::Error> {
4914        let _response = self
4915            .client
4916            .send_query::<RealmQueryConstructNamespaceRequest, fidl::encoding::ResultType<
4917                RealmQueryConstructNamespaceResponse,
4918                ConstructNamespaceError,
4919            >>(
4920                (moniker,),
4921                0x5ecb29c02c488eeb,
4922                fidl::encoding::DynamicFlags::empty(),
4923                ___deadline,
4924            )?;
4925        Ok(_response.map(|x| x.namespace))
4926    }
4927
4928    /// Opens the specified directory in an instance.
4929    pub fn r#open_directory(
4930        &self,
4931        mut moniker: &str,
4932        mut dir_type: OpenDirType,
4933        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4934        ___deadline: zx::MonotonicInstant,
4935    ) -> Result<RealmQueryOpenDirectoryResult, fidl::Error> {
4936        let _response = self.client.send_query::<
4937            RealmQueryOpenDirectoryRequest,
4938            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenError>,
4939        >(
4940            (moniker, dir_type, object,),
4941            0x333d68f1deecec85,
4942            fidl::encoding::DynamicFlags::empty(),
4943            ___deadline,
4944        )?;
4945        Ok(_response.map(|x| x))
4946    }
4947
4948    /// Connects to the StorageAdmin protocol of a storage declared by an instance.
4949    /// Deprecated, use OpenStorageAdmin instead.
4950    pub fn r#connect_to_storage_admin(
4951        &self,
4952        mut moniker: &str,
4953        mut storage_name: &str,
4954        mut server_end: fidl::endpoints::ServerEnd<StorageAdminMarker>,
4955        ___deadline: zx::MonotonicInstant,
4956    ) -> Result<RealmQueryConnectToStorageAdminResult, fidl::Error> {
4957        let _response =
4958            self.client
4959                .send_query::<RealmQueryConnectToStorageAdminRequest, fidl::encoding::ResultType<
4960                    fidl::encoding::EmptyStruct,
4961                    ConnectToStorageAdminError,
4962                >>(
4963                    (moniker, storage_name, server_end),
4964                    0x7807e6b4f623ace,
4965                    fidl::encoding::DynamicFlags::empty(),
4966                    ___deadline,
4967                )?;
4968        Ok(_response.map(|x| x))
4969    }
4970
4971    /// Connects to the StorageAdmin protocol of a storage declared by an instance.
4972    pub fn r#open_storage_admin(
4973        &self,
4974        mut moniker: &str,
4975        mut storage_name: &str,
4976        mut server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
4977        ___deadline: zx::MonotonicInstant,
4978    ) -> Result<RealmQueryOpenStorageAdminResult, fidl::Error> {
4979        let _response =
4980            self.client
4981                .send_query::<RealmQueryOpenStorageAdminRequest, fidl::encoding::ResultType<
4982                    fidl::encoding::EmptyStruct,
4983                    ConnectToStorageAdminError,
4984                >>(
4985                    (moniker, storage_name, server_end),
4986                    0x54d6af83942b4069,
4987                    fidl::encoding::DynamicFlags::empty(),
4988                    ___deadline,
4989                )?;
4990        Ok(_response.map(|x| x))
4991    }
4992}
4993
4994#[cfg(target_os = "fuchsia")]
4995impl From<RealmQuerySynchronousProxy> for zx::NullableHandle {
4996    fn from(value: RealmQuerySynchronousProxy) -> Self {
4997        value.into_channel().into()
4998    }
4999}
5000
5001#[cfg(target_os = "fuchsia")]
5002impl From<fidl::Channel> for RealmQuerySynchronousProxy {
5003    fn from(value: fidl::Channel) -> Self {
5004        Self::new(value)
5005    }
5006}
5007
5008#[cfg(target_os = "fuchsia")]
5009impl fidl::endpoints::FromClient for RealmQuerySynchronousProxy {
5010    type Protocol = RealmQueryMarker;
5011
5012    fn from_client(value: fidl::endpoints::ClientEnd<RealmQueryMarker>) -> Self {
5013        Self::new(value.into_channel())
5014    }
5015}
5016
5017#[derive(Debug, Clone)]
5018pub struct RealmQueryProxy {
5019    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5020}
5021
5022impl fidl::endpoints::Proxy for RealmQueryProxy {
5023    type Protocol = RealmQueryMarker;
5024
5025    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5026        Self::new(inner)
5027    }
5028
5029    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5030        self.client.into_channel().map_err(|client| Self { client })
5031    }
5032
5033    fn as_channel(&self) -> &::fidl::AsyncChannel {
5034        self.client.as_channel()
5035    }
5036}
5037
5038impl RealmQueryProxy {
5039    /// Create a new Proxy for fuchsia.sys2/RealmQuery.
5040    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5041        let protocol_name = <RealmQueryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5042        Self { client: fidl::client::Client::new(channel, protocol_name) }
5043    }
5044
5045    /// Get a Stream of events from the remote end of the protocol.
5046    ///
5047    /// # Panics
5048    ///
5049    /// Panics if the event stream was already taken.
5050    pub fn take_event_stream(&self) -> RealmQueryEventStream {
5051        RealmQueryEventStream { event_receiver: self.client.take_event_receiver() }
5052    }
5053
5054    /// Gets an instance identified by its moniker.
5055    pub fn r#get_instance(
5056        &self,
5057        mut moniker: &str,
5058    ) -> fidl::client::QueryResponseFut<
5059        RealmQueryGetInstanceResult,
5060        fidl::encoding::DefaultFuchsiaResourceDialect,
5061    > {
5062        RealmQueryProxyInterface::r#get_instance(self, moniker)
5063    }
5064
5065    /// Gets the manifest of an instance identified by its moniker.
5066    ///
5067    /// The manifest is encoded in its standalone persistable format per RFC-0120 and
5068    /// is sent across using an iterator. Some manifests are too large to send over a
5069    /// Zircon channel and we can't use a VMO because we need an approach that is
5070    /// compatible with overnet.
5071    pub fn r#get_resolved_declaration(
5072        &self,
5073        mut moniker: &str,
5074    ) -> fidl::client::QueryResponseFut<
5075        RealmQueryGetResolvedDeclarationResult,
5076        fidl::encoding::DefaultFuchsiaResourceDialect,
5077    > {
5078        RealmQueryProxyInterface::r#get_resolved_declaration(self, moniker)
5079    }
5080
5081    /// Gets the manifest of a component URL as if it were a child of the specified parent
5082    /// without actually creating or starting that component.
5083    ///
5084    /// The manifest is encoded in its standalone persistable format per RFC-0120 and
5085    /// is sent across using an iterator. Some manifests are too large to send over a
5086    /// Zircon channel and we can't use a VMO because we need an approach that is
5087    /// compatible with overnet.
5088    pub fn r#resolve_declaration(
5089        &self,
5090        mut parent: &str,
5091        mut child_location: &ChildLocation,
5092        mut url: &str,
5093    ) -> fidl::client::QueryResponseFut<
5094        RealmQueryResolveDeclarationResult,
5095        fidl::encoding::DefaultFuchsiaResourceDialect,
5096    > {
5097        RealmQueryProxyInterface::r#resolve_declaration(self, parent, child_location, url)
5098    }
5099
5100    /// Gets the structured config of an instance identified by its moniker.
5101    pub fn r#get_structured_config(
5102        &self,
5103        mut moniker: &str,
5104    ) -> fidl::client::QueryResponseFut<
5105        RealmQueryGetStructuredConfigResult,
5106        fidl::encoding::DefaultFuchsiaResourceDialect,
5107    > {
5108        RealmQueryProxyInterface::r#get_structured_config(self, moniker)
5109    }
5110
5111    /// Returns an iterator over all component instances in this realm and instances within resolved
5112    /// children, recursively. Unresolved child components will be included in this list, but
5113    /// children of unresolved children will not be.
5114    pub fn r#get_all_instances(
5115        &self,
5116    ) -> fidl::client::QueryResponseFut<
5117        RealmQueryGetAllInstancesResult,
5118        fidl::encoding::DefaultFuchsiaResourceDialect,
5119    > {
5120        RealmQueryProxyInterface::r#get_all_instances(self)
5121    }
5122
5123    /// Constructs the namespace of an instance as determined by its use declarations.
5124    /// This is usually identical to what would be given to the component's runner on
5125    /// component start time, unless extended by
5126    /// `fuchsia.component/StartChildArgs.namespace_entries`.
5127    pub fn r#construct_namespace(
5128        &self,
5129        mut moniker: &str,
5130    ) -> fidl::client::QueryResponseFut<
5131        RealmQueryConstructNamespaceResult,
5132        fidl::encoding::DefaultFuchsiaResourceDialect,
5133    > {
5134        RealmQueryProxyInterface::r#construct_namespace(self, moniker)
5135    }
5136
5137    /// Opens the specified directory in an instance.
5138    pub fn r#open_directory(
5139        &self,
5140        mut moniker: &str,
5141        mut dir_type: OpenDirType,
5142        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5143    ) -> fidl::client::QueryResponseFut<
5144        RealmQueryOpenDirectoryResult,
5145        fidl::encoding::DefaultFuchsiaResourceDialect,
5146    > {
5147        RealmQueryProxyInterface::r#open_directory(self, moniker, dir_type, object)
5148    }
5149
5150    /// Connects to the StorageAdmin protocol of a storage declared by an instance.
5151    /// Deprecated, use OpenStorageAdmin instead.
5152    pub fn r#connect_to_storage_admin(
5153        &self,
5154        mut moniker: &str,
5155        mut storage_name: &str,
5156        mut server_end: fidl::endpoints::ServerEnd<StorageAdminMarker>,
5157    ) -> fidl::client::QueryResponseFut<
5158        RealmQueryConnectToStorageAdminResult,
5159        fidl::encoding::DefaultFuchsiaResourceDialect,
5160    > {
5161        RealmQueryProxyInterface::r#connect_to_storage_admin(
5162            self,
5163            moniker,
5164            storage_name,
5165            server_end,
5166        )
5167    }
5168
5169    /// Connects to the StorageAdmin protocol of a storage declared by an instance.
5170    pub fn r#open_storage_admin(
5171        &self,
5172        mut moniker: &str,
5173        mut storage_name: &str,
5174        mut server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
5175    ) -> fidl::client::QueryResponseFut<
5176        RealmQueryOpenStorageAdminResult,
5177        fidl::encoding::DefaultFuchsiaResourceDialect,
5178    > {
5179        RealmQueryProxyInterface::r#open_storage_admin(self, moniker, storage_name, server_end)
5180    }
5181}
5182
5183impl RealmQueryProxyInterface for RealmQueryProxy {
5184    type GetInstanceResponseFut = fidl::client::QueryResponseFut<
5185        RealmQueryGetInstanceResult,
5186        fidl::encoding::DefaultFuchsiaResourceDialect,
5187    >;
5188    fn r#get_instance(&self, mut moniker: &str) -> Self::GetInstanceResponseFut {
5189        fn _decode(
5190            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5191        ) -> Result<RealmQueryGetInstanceResult, fidl::Error> {
5192            let _response = fidl::client::decode_transaction_body::<
5193                fidl::encoding::ResultType<RealmQueryGetInstanceResponse, GetInstanceError>,
5194                fidl::encoding::DefaultFuchsiaResourceDialect,
5195                0x3496ca1e5a0c13a8,
5196            >(_buf?)?;
5197            Ok(_response.map(|x| x.instance))
5198        }
5199        self.client
5200            .send_query_and_decode::<RealmQueryGetInstanceRequest, RealmQueryGetInstanceResult>(
5201                (moniker,),
5202                0x3496ca1e5a0c13a8,
5203                fidl::encoding::DynamicFlags::empty(),
5204                _decode,
5205            )
5206    }
5207
5208    type GetResolvedDeclarationResponseFut = fidl::client::QueryResponseFut<
5209        RealmQueryGetResolvedDeclarationResult,
5210        fidl::encoding::DefaultFuchsiaResourceDialect,
5211    >;
5212    fn r#get_resolved_declaration(
5213        &self,
5214        mut moniker: &str,
5215    ) -> Self::GetResolvedDeclarationResponseFut {
5216        fn _decode(
5217            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5218        ) -> Result<RealmQueryGetResolvedDeclarationResult, fidl::Error> {
5219            let _response = fidl::client::decode_transaction_body::<
5220                fidl::encoding::ResultType<
5221                    RealmQueryGetResolvedDeclarationResponse,
5222                    GetDeclarationError,
5223                >,
5224                fidl::encoding::DefaultFuchsiaResourceDialect,
5225                0x31a493d284a0bc1f,
5226            >(_buf?)?;
5227            Ok(_response.map(|x| x.iterator))
5228        }
5229        self.client.send_query_and_decode::<
5230            RealmQueryGetResolvedDeclarationRequest,
5231            RealmQueryGetResolvedDeclarationResult,
5232        >(
5233            (moniker,),
5234            0x31a493d284a0bc1f,
5235            fidl::encoding::DynamicFlags::empty(),
5236            _decode,
5237        )
5238    }
5239
5240    type ResolveDeclarationResponseFut = fidl::client::QueryResponseFut<
5241        RealmQueryResolveDeclarationResult,
5242        fidl::encoding::DefaultFuchsiaResourceDialect,
5243    >;
5244    fn r#resolve_declaration(
5245        &self,
5246        mut parent: &str,
5247        mut child_location: &ChildLocation,
5248        mut url: &str,
5249    ) -> Self::ResolveDeclarationResponseFut {
5250        fn _decode(
5251            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5252        ) -> Result<RealmQueryResolveDeclarationResult, fidl::Error> {
5253            let _response = fidl::client::decode_transaction_body::<
5254                fidl::encoding::ResultType<
5255                    RealmQueryResolveDeclarationResponse,
5256                    GetDeclarationError,
5257                >,
5258                fidl::encoding::DefaultFuchsiaResourceDialect,
5259                0x1ab1adf2a87d962d,
5260            >(_buf?)?;
5261            Ok(_response.map(|x| x.iterator))
5262        }
5263        self.client.send_query_and_decode::<
5264            RealmQueryResolveDeclarationRequest,
5265            RealmQueryResolveDeclarationResult,
5266        >(
5267            (parent, child_location, url,),
5268            0x1ab1adf2a87d962d,
5269            fidl::encoding::DynamicFlags::empty(),
5270            _decode,
5271        )
5272    }
5273
5274    type GetStructuredConfigResponseFut = fidl::client::QueryResponseFut<
5275        RealmQueryGetStructuredConfigResult,
5276        fidl::encoding::DefaultFuchsiaResourceDialect,
5277    >;
5278    fn r#get_structured_config(&self, mut moniker: &str) -> Self::GetStructuredConfigResponseFut {
5279        fn _decode(
5280            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5281        ) -> Result<RealmQueryGetStructuredConfigResult, fidl::Error> {
5282            let _response = fidl::client::decode_transaction_body::<
5283                fidl::encoding::ResultType<
5284                    RealmQueryGetStructuredConfigResponse,
5285                    GetStructuredConfigError,
5286                >,
5287                fidl::encoding::DefaultFuchsiaResourceDialect,
5288                0x16f88f6735bd204,
5289            >(_buf?)?;
5290            Ok(_response.map(|x| x.config))
5291        }
5292        self.client.send_query_and_decode::<
5293            RealmQueryGetStructuredConfigRequest,
5294            RealmQueryGetStructuredConfigResult,
5295        >(
5296            (moniker,),
5297            0x16f88f6735bd204,
5298            fidl::encoding::DynamicFlags::empty(),
5299            _decode,
5300        )
5301    }
5302
5303    type GetAllInstancesResponseFut = fidl::client::QueryResponseFut<
5304        RealmQueryGetAllInstancesResult,
5305        fidl::encoding::DefaultFuchsiaResourceDialect,
5306    >;
5307    fn r#get_all_instances(&self) -> Self::GetAllInstancesResponseFut {
5308        fn _decode(
5309            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5310        ) -> Result<RealmQueryGetAllInstancesResult, fidl::Error> {
5311            let _response = fidl::client::decode_transaction_body::<
5312                fidl::encoding::ResultType<RealmQueryGetAllInstancesResponse, GetAllInstancesError>,
5313                fidl::encoding::DefaultFuchsiaResourceDialect,
5314                0x7b5a8775d30cad47,
5315            >(_buf?)?;
5316            Ok(_response.map(|x| x.iterator))
5317        }
5318        self.client
5319            .send_query_and_decode::<fidl::encoding::EmptyPayload, RealmQueryGetAllInstancesResult>(
5320                (),
5321                0x7b5a8775d30cad47,
5322                fidl::encoding::DynamicFlags::empty(),
5323                _decode,
5324            )
5325    }
5326
5327    type ConstructNamespaceResponseFut = fidl::client::QueryResponseFut<
5328        RealmQueryConstructNamespaceResult,
5329        fidl::encoding::DefaultFuchsiaResourceDialect,
5330    >;
5331    fn r#construct_namespace(&self, mut moniker: &str) -> Self::ConstructNamespaceResponseFut {
5332        fn _decode(
5333            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5334        ) -> Result<RealmQueryConstructNamespaceResult, fidl::Error> {
5335            let _response = fidl::client::decode_transaction_body::<
5336                fidl::encoding::ResultType<
5337                    RealmQueryConstructNamespaceResponse,
5338                    ConstructNamespaceError,
5339                >,
5340                fidl::encoding::DefaultFuchsiaResourceDialect,
5341                0x5ecb29c02c488eeb,
5342            >(_buf?)?;
5343            Ok(_response.map(|x| x.namespace))
5344        }
5345        self.client.send_query_and_decode::<
5346            RealmQueryConstructNamespaceRequest,
5347            RealmQueryConstructNamespaceResult,
5348        >(
5349            (moniker,),
5350            0x5ecb29c02c488eeb,
5351            fidl::encoding::DynamicFlags::empty(),
5352            _decode,
5353        )
5354    }
5355
5356    type OpenDirectoryResponseFut = fidl::client::QueryResponseFut<
5357        RealmQueryOpenDirectoryResult,
5358        fidl::encoding::DefaultFuchsiaResourceDialect,
5359    >;
5360    fn r#open_directory(
5361        &self,
5362        mut moniker: &str,
5363        mut dir_type: OpenDirType,
5364        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5365    ) -> Self::OpenDirectoryResponseFut {
5366        fn _decode(
5367            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5368        ) -> Result<RealmQueryOpenDirectoryResult, fidl::Error> {
5369            let _response = fidl::client::decode_transaction_body::<
5370                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenError>,
5371                fidl::encoding::DefaultFuchsiaResourceDialect,
5372                0x333d68f1deecec85,
5373            >(_buf?)?;
5374            Ok(_response.map(|x| x))
5375        }
5376        self.client
5377            .send_query_and_decode::<RealmQueryOpenDirectoryRequest, RealmQueryOpenDirectoryResult>(
5378                (moniker, dir_type, object),
5379                0x333d68f1deecec85,
5380                fidl::encoding::DynamicFlags::empty(),
5381                _decode,
5382            )
5383    }
5384
5385    type ConnectToStorageAdminResponseFut = fidl::client::QueryResponseFut<
5386        RealmQueryConnectToStorageAdminResult,
5387        fidl::encoding::DefaultFuchsiaResourceDialect,
5388    >;
5389    fn r#connect_to_storage_admin(
5390        &self,
5391        mut moniker: &str,
5392        mut storage_name: &str,
5393        mut server_end: fidl::endpoints::ServerEnd<StorageAdminMarker>,
5394    ) -> Self::ConnectToStorageAdminResponseFut {
5395        fn _decode(
5396            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5397        ) -> Result<RealmQueryConnectToStorageAdminResult, fidl::Error> {
5398            let _response = fidl::client::decode_transaction_body::<
5399                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ConnectToStorageAdminError>,
5400                fidl::encoding::DefaultFuchsiaResourceDialect,
5401                0x7807e6b4f623ace,
5402            >(_buf?)?;
5403            Ok(_response.map(|x| x))
5404        }
5405        self.client.send_query_and_decode::<
5406            RealmQueryConnectToStorageAdminRequest,
5407            RealmQueryConnectToStorageAdminResult,
5408        >(
5409            (moniker, storage_name, server_end,),
5410            0x7807e6b4f623ace,
5411            fidl::encoding::DynamicFlags::empty(),
5412            _decode,
5413        )
5414    }
5415
5416    type OpenStorageAdminResponseFut = fidl::client::QueryResponseFut<
5417        RealmQueryOpenStorageAdminResult,
5418        fidl::encoding::DefaultFuchsiaResourceDialect,
5419    >;
5420    fn r#open_storage_admin(
5421        &self,
5422        mut moniker: &str,
5423        mut storage_name: &str,
5424        mut server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
5425    ) -> Self::OpenStorageAdminResponseFut {
5426        fn _decode(
5427            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5428        ) -> Result<RealmQueryOpenStorageAdminResult, fidl::Error> {
5429            let _response = fidl::client::decode_transaction_body::<
5430                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ConnectToStorageAdminError>,
5431                fidl::encoding::DefaultFuchsiaResourceDialect,
5432                0x54d6af83942b4069,
5433            >(_buf?)?;
5434            Ok(_response.map(|x| x))
5435        }
5436        self.client.send_query_and_decode::<
5437            RealmQueryOpenStorageAdminRequest,
5438            RealmQueryOpenStorageAdminResult,
5439        >(
5440            (moniker, storage_name, server_end,),
5441            0x54d6af83942b4069,
5442            fidl::encoding::DynamicFlags::empty(),
5443            _decode,
5444        )
5445    }
5446}
5447
5448pub struct RealmQueryEventStream {
5449    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5450}
5451
5452impl std::marker::Unpin for RealmQueryEventStream {}
5453
5454impl futures::stream::FusedStream for RealmQueryEventStream {
5455    fn is_terminated(&self) -> bool {
5456        self.event_receiver.is_terminated()
5457    }
5458}
5459
5460impl futures::Stream for RealmQueryEventStream {
5461    type Item = Result<RealmQueryEvent, fidl::Error>;
5462
5463    fn poll_next(
5464        mut self: std::pin::Pin<&mut Self>,
5465        cx: &mut std::task::Context<'_>,
5466    ) -> std::task::Poll<Option<Self::Item>> {
5467        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5468            &mut self.event_receiver,
5469            cx
5470        )?) {
5471            Some(buf) => std::task::Poll::Ready(Some(RealmQueryEvent::decode(buf))),
5472            None => std::task::Poll::Ready(None),
5473        }
5474    }
5475}
5476
5477#[derive(Debug)]
5478pub enum RealmQueryEvent {}
5479
5480impl RealmQueryEvent {
5481    /// Decodes a message buffer as a [`RealmQueryEvent`].
5482    fn decode(
5483        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5484    ) -> Result<RealmQueryEvent, fidl::Error> {
5485        let (bytes, _handles) = buf.split_mut();
5486        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5487        debug_assert_eq!(tx_header.tx_id, 0);
5488        match tx_header.ordinal {
5489            _ => Err(fidl::Error::UnknownOrdinal {
5490                ordinal: tx_header.ordinal,
5491                protocol_name: <RealmQueryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5492            }),
5493        }
5494    }
5495}
5496
5497/// A Stream of incoming requests for fuchsia.sys2/RealmQuery.
5498pub struct RealmQueryRequestStream {
5499    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5500    is_terminated: bool,
5501}
5502
5503impl std::marker::Unpin for RealmQueryRequestStream {}
5504
5505impl futures::stream::FusedStream for RealmQueryRequestStream {
5506    fn is_terminated(&self) -> bool {
5507        self.is_terminated
5508    }
5509}
5510
5511impl fidl::endpoints::RequestStream for RealmQueryRequestStream {
5512    type Protocol = RealmQueryMarker;
5513    type ControlHandle = RealmQueryControlHandle;
5514
5515    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5516        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5517    }
5518
5519    fn control_handle(&self) -> Self::ControlHandle {
5520        RealmQueryControlHandle { inner: self.inner.clone() }
5521    }
5522
5523    fn into_inner(
5524        self,
5525    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5526    {
5527        (self.inner, self.is_terminated)
5528    }
5529
5530    fn from_inner(
5531        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5532        is_terminated: bool,
5533    ) -> Self {
5534        Self { inner, is_terminated }
5535    }
5536}
5537
5538impl futures::Stream for RealmQueryRequestStream {
5539    type Item = Result<RealmQueryRequest, fidl::Error>;
5540
5541    fn poll_next(
5542        mut self: std::pin::Pin<&mut Self>,
5543        cx: &mut std::task::Context<'_>,
5544    ) -> std::task::Poll<Option<Self::Item>> {
5545        let this = &mut *self;
5546        if this.inner.check_shutdown(cx) {
5547            this.is_terminated = true;
5548            return std::task::Poll::Ready(None);
5549        }
5550        if this.is_terminated {
5551            panic!("polled RealmQueryRequestStream after completion");
5552        }
5553        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5554            |bytes, handles| {
5555                match this.inner.channel().read_etc(cx, bytes, handles) {
5556                    std::task::Poll::Ready(Ok(())) => {}
5557                    std::task::Poll::Pending => return std::task::Poll::Pending,
5558                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5559                        this.is_terminated = true;
5560                        return std::task::Poll::Ready(None);
5561                    }
5562                    std::task::Poll::Ready(Err(e)) => {
5563                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5564                            e.into(),
5565                        ))));
5566                    }
5567                }
5568
5569                // A message has been received from the channel
5570                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5571
5572                std::task::Poll::Ready(Some(match header.ordinal {
5573                    0x3496ca1e5a0c13a8 => {
5574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5575                        let mut req = fidl::new_empty!(
5576                            RealmQueryGetInstanceRequest,
5577                            fidl::encoding::DefaultFuchsiaResourceDialect
5578                        );
5579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryGetInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
5580                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5581                        Ok(RealmQueryRequest::GetInstance {
5582                            moniker: req.moniker,
5583
5584                            responder: RealmQueryGetInstanceResponder {
5585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5586                                tx_id: header.tx_id,
5587                            },
5588                        })
5589                    }
5590                    0x31a493d284a0bc1f => {
5591                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5592                        let mut req = fidl::new_empty!(
5593                            RealmQueryGetResolvedDeclarationRequest,
5594                            fidl::encoding::DefaultFuchsiaResourceDialect
5595                        );
5596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryGetResolvedDeclarationRequest>(&header, _body_bytes, handles, &mut req)?;
5597                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5598                        Ok(RealmQueryRequest::GetResolvedDeclaration {
5599                            moniker: req.moniker,
5600
5601                            responder: RealmQueryGetResolvedDeclarationResponder {
5602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5603                                tx_id: header.tx_id,
5604                            },
5605                        })
5606                    }
5607                    0x1ab1adf2a87d962d => {
5608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5609                        let mut req = fidl::new_empty!(
5610                            RealmQueryResolveDeclarationRequest,
5611                            fidl::encoding::DefaultFuchsiaResourceDialect
5612                        );
5613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryResolveDeclarationRequest>(&header, _body_bytes, handles, &mut req)?;
5614                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5615                        Ok(RealmQueryRequest::ResolveDeclaration {
5616                            parent: req.parent,
5617                            child_location: req.child_location,
5618                            url: req.url,
5619
5620                            responder: RealmQueryResolveDeclarationResponder {
5621                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5622                                tx_id: header.tx_id,
5623                            },
5624                        })
5625                    }
5626                    0x16f88f6735bd204 => {
5627                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5628                        let mut req = fidl::new_empty!(
5629                            RealmQueryGetStructuredConfigRequest,
5630                            fidl::encoding::DefaultFuchsiaResourceDialect
5631                        );
5632                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryGetStructuredConfigRequest>(&header, _body_bytes, handles, &mut req)?;
5633                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5634                        Ok(RealmQueryRequest::GetStructuredConfig {
5635                            moniker: req.moniker,
5636
5637                            responder: RealmQueryGetStructuredConfigResponder {
5638                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5639                                tx_id: header.tx_id,
5640                            },
5641                        })
5642                    }
5643                    0x7b5a8775d30cad47 => {
5644                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5645                        let mut req = fidl::new_empty!(
5646                            fidl::encoding::EmptyPayload,
5647                            fidl::encoding::DefaultFuchsiaResourceDialect
5648                        );
5649                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5650                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5651                        Ok(RealmQueryRequest::GetAllInstances {
5652                            responder: RealmQueryGetAllInstancesResponder {
5653                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5654                                tx_id: header.tx_id,
5655                            },
5656                        })
5657                    }
5658                    0x5ecb29c02c488eeb => {
5659                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5660                        let mut req = fidl::new_empty!(
5661                            RealmQueryConstructNamespaceRequest,
5662                            fidl::encoding::DefaultFuchsiaResourceDialect
5663                        );
5664                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryConstructNamespaceRequest>(&header, _body_bytes, handles, &mut req)?;
5665                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5666                        Ok(RealmQueryRequest::ConstructNamespace {
5667                            moniker: req.moniker,
5668
5669                            responder: RealmQueryConstructNamespaceResponder {
5670                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5671                                tx_id: header.tx_id,
5672                            },
5673                        })
5674                    }
5675                    0x333d68f1deecec85 => {
5676                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5677                        let mut req = fidl::new_empty!(
5678                            RealmQueryOpenDirectoryRequest,
5679                            fidl::encoding::DefaultFuchsiaResourceDialect
5680                        );
5681                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryOpenDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
5682                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5683                        Ok(RealmQueryRequest::OpenDirectory {
5684                            moniker: req.moniker,
5685                            dir_type: req.dir_type,
5686                            object: req.object,
5687
5688                            responder: RealmQueryOpenDirectoryResponder {
5689                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5690                                tx_id: header.tx_id,
5691                            },
5692                        })
5693                    }
5694                    0x7807e6b4f623ace => {
5695                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5696                        let mut req = fidl::new_empty!(
5697                            RealmQueryConnectToStorageAdminRequest,
5698                            fidl::encoding::DefaultFuchsiaResourceDialect
5699                        );
5700                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryConnectToStorageAdminRequest>(&header, _body_bytes, handles, &mut req)?;
5701                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5702                        Ok(RealmQueryRequest::ConnectToStorageAdmin {
5703                            moniker: req.moniker,
5704                            storage_name: req.storage_name,
5705                            server_end: req.server_end,
5706
5707                            responder: RealmQueryConnectToStorageAdminResponder {
5708                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5709                                tx_id: header.tx_id,
5710                            },
5711                        })
5712                    }
5713                    0x54d6af83942b4069 => {
5714                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5715                        let mut req = fidl::new_empty!(
5716                            RealmQueryOpenStorageAdminRequest,
5717                            fidl::encoding::DefaultFuchsiaResourceDialect
5718                        );
5719                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmQueryOpenStorageAdminRequest>(&header, _body_bytes, handles, &mut req)?;
5720                        let control_handle = RealmQueryControlHandle { inner: this.inner.clone() };
5721                        Ok(RealmQueryRequest::OpenStorageAdmin {
5722                            moniker: req.moniker,
5723                            storage_name: req.storage_name,
5724                            server_end: req.server_end,
5725
5726                            responder: RealmQueryOpenStorageAdminResponder {
5727                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5728                                tx_id: header.tx_id,
5729                            },
5730                        })
5731                    }
5732                    _ => Err(fidl::Error::UnknownOrdinal {
5733                        ordinal: header.ordinal,
5734                        protocol_name:
5735                            <RealmQueryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5736                    }),
5737                }))
5738            },
5739        )
5740    }
5741}
5742
5743/// Offers detailed introspection into component instances under a realm.
5744#[derive(Debug)]
5745pub enum RealmQueryRequest {
5746    /// Gets an instance identified by its moniker.
5747    GetInstance { moniker: String, responder: RealmQueryGetInstanceResponder },
5748    /// Gets the manifest of an instance identified by its moniker.
5749    ///
5750    /// The manifest is encoded in its standalone persistable format per RFC-0120 and
5751    /// is sent across using an iterator. Some manifests are too large to send over a
5752    /// Zircon channel and we can't use a VMO because we need an approach that is
5753    /// compatible with overnet.
5754    GetResolvedDeclaration { moniker: String, responder: RealmQueryGetResolvedDeclarationResponder },
5755    /// Gets the manifest of a component URL as if it were a child of the specified parent
5756    /// without actually creating or starting that component.
5757    ///
5758    /// The manifest is encoded in its standalone persistable format per RFC-0120 and
5759    /// is sent across using an iterator. Some manifests are too large to send over a
5760    /// Zircon channel and we can't use a VMO because we need an approach that is
5761    /// compatible with overnet.
5762    ResolveDeclaration {
5763        parent: String,
5764        child_location: ChildLocation,
5765        url: String,
5766        responder: RealmQueryResolveDeclarationResponder,
5767    },
5768    /// Gets the structured config of an instance identified by its moniker.
5769    GetStructuredConfig { moniker: String, responder: RealmQueryGetStructuredConfigResponder },
5770    /// Returns an iterator over all component instances in this realm and instances within resolved
5771    /// children, recursively. Unresolved child components will be included in this list, but
5772    /// children of unresolved children will not be.
5773    GetAllInstances { responder: RealmQueryGetAllInstancesResponder },
5774    /// Constructs the namespace of an instance as determined by its use declarations.
5775    /// This is usually identical to what would be given to the component's runner on
5776    /// component start time, unless extended by
5777    /// `fuchsia.component/StartChildArgs.namespace_entries`.
5778    ConstructNamespace { moniker: String, responder: RealmQueryConstructNamespaceResponder },
5779    /// Opens the specified directory in an instance.
5780    OpenDirectory {
5781        moniker: String,
5782        dir_type: OpenDirType,
5783        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5784        responder: RealmQueryOpenDirectoryResponder,
5785    },
5786    /// Connects to the StorageAdmin protocol of a storage declared by an instance.
5787    /// Deprecated, use OpenStorageAdmin instead.
5788    ConnectToStorageAdmin {
5789        moniker: String,
5790        storage_name: String,
5791        server_end: fidl::endpoints::ServerEnd<StorageAdminMarker>,
5792        responder: RealmQueryConnectToStorageAdminResponder,
5793    },
5794    /// Connects to the StorageAdmin protocol of a storage declared by an instance.
5795    OpenStorageAdmin {
5796        moniker: String,
5797        storage_name: String,
5798        server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
5799        responder: RealmQueryOpenStorageAdminResponder,
5800    },
5801}
5802
5803impl RealmQueryRequest {
5804    #[allow(irrefutable_let_patterns)]
5805    pub fn into_get_instance(self) -> Option<(String, RealmQueryGetInstanceResponder)> {
5806        if let RealmQueryRequest::GetInstance { moniker, responder } = self {
5807            Some((moniker, responder))
5808        } else {
5809            None
5810        }
5811    }
5812
5813    #[allow(irrefutable_let_patterns)]
5814    pub fn into_get_resolved_declaration(
5815        self,
5816    ) -> Option<(String, RealmQueryGetResolvedDeclarationResponder)> {
5817        if let RealmQueryRequest::GetResolvedDeclaration { moniker, responder } = self {
5818            Some((moniker, responder))
5819        } else {
5820            None
5821        }
5822    }
5823
5824    #[allow(irrefutable_let_patterns)]
5825    pub fn into_resolve_declaration(
5826        self,
5827    ) -> Option<(String, ChildLocation, String, RealmQueryResolveDeclarationResponder)> {
5828        if let RealmQueryRequest::ResolveDeclaration { parent, child_location, url, responder } =
5829            self
5830        {
5831            Some((parent, child_location, url, responder))
5832        } else {
5833            None
5834        }
5835    }
5836
5837    #[allow(irrefutable_let_patterns)]
5838    pub fn into_get_structured_config(
5839        self,
5840    ) -> Option<(String, RealmQueryGetStructuredConfigResponder)> {
5841        if let RealmQueryRequest::GetStructuredConfig { moniker, responder } = self {
5842            Some((moniker, responder))
5843        } else {
5844            None
5845        }
5846    }
5847
5848    #[allow(irrefutable_let_patterns)]
5849    pub fn into_get_all_instances(self) -> Option<(RealmQueryGetAllInstancesResponder)> {
5850        if let RealmQueryRequest::GetAllInstances { responder } = self {
5851            Some((responder))
5852        } else {
5853            None
5854        }
5855    }
5856
5857    #[allow(irrefutable_let_patterns)]
5858    pub fn into_construct_namespace(
5859        self,
5860    ) -> Option<(String, RealmQueryConstructNamespaceResponder)> {
5861        if let RealmQueryRequest::ConstructNamespace { moniker, responder } = self {
5862            Some((moniker, responder))
5863        } else {
5864            None
5865        }
5866    }
5867
5868    #[allow(irrefutable_let_patterns)]
5869    pub fn into_open_directory(
5870        self,
5871    ) -> Option<(
5872        String,
5873        OpenDirType,
5874        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5875        RealmQueryOpenDirectoryResponder,
5876    )> {
5877        if let RealmQueryRequest::OpenDirectory { moniker, dir_type, object, responder } = self {
5878            Some((moniker, dir_type, object, responder))
5879        } else {
5880            None
5881        }
5882    }
5883
5884    #[allow(irrefutable_let_patterns)]
5885    pub fn into_connect_to_storage_admin(
5886        self,
5887    ) -> Option<(
5888        String,
5889        String,
5890        fidl::endpoints::ServerEnd<StorageAdminMarker>,
5891        RealmQueryConnectToStorageAdminResponder,
5892    )> {
5893        if let RealmQueryRequest::ConnectToStorageAdmin {
5894            moniker,
5895            storage_name,
5896            server_end,
5897            responder,
5898        } = self
5899        {
5900            Some((moniker, storage_name, server_end, responder))
5901        } else {
5902            None
5903        }
5904    }
5905
5906    #[allow(irrefutable_let_patterns)]
5907    pub fn into_open_storage_admin(
5908        self,
5909    ) -> Option<(
5910        String,
5911        String,
5912        fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
5913        RealmQueryOpenStorageAdminResponder,
5914    )> {
5915        if let RealmQueryRequest::OpenStorageAdmin {
5916            moniker,
5917            storage_name,
5918            server_end,
5919            responder,
5920        } = self
5921        {
5922            Some((moniker, storage_name, server_end, responder))
5923        } else {
5924            None
5925        }
5926    }
5927
5928    /// Name of the method defined in FIDL
5929    pub fn method_name(&self) -> &'static str {
5930        match *self {
5931            RealmQueryRequest::GetInstance { .. } => "get_instance",
5932            RealmQueryRequest::GetResolvedDeclaration { .. } => "get_resolved_declaration",
5933            RealmQueryRequest::ResolveDeclaration { .. } => "resolve_declaration",
5934            RealmQueryRequest::GetStructuredConfig { .. } => "get_structured_config",
5935            RealmQueryRequest::GetAllInstances { .. } => "get_all_instances",
5936            RealmQueryRequest::ConstructNamespace { .. } => "construct_namespace",
5937            RealmQueryRequest::OpenDirectory { .. } => "open_directory",
5938            RealmQueryRequest::ConnectToStorageAdmin { .. } => "connect_to_storage_admin",
5939            RealmQueryRequest::OpenStorageAdmin { .. } => "open_storage_admin",
5940        }
5941    }
5942}
5943
5944#[derive(Debug, Clone)]
5945pub struct RealmQueryControlHandle {
5946    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5947}
5948
5949impl fidl::endpoints::ControlHandle for RealmQueryControlHandle {
5950    fn shutdown(&self) {
5951        self.inner.shutdown()
5952    }
5953
5954    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5955        self.inner.shutdown_with_epitaph(status)
5956    }
5957
5958    fn is_closed(&self) -> bool {
5959        self.inner.channel().is_closed()
5960    }
5961    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5962        self.inner.channel().on_closed()
5963    }
5964
5965    #[cfg(target_os = "fuchsia")]
5966    fn signal_peer(
5967        &self,
5968        clear_mask: zx::Signals,
5969        set_mask: zx::Signals,
5970    ) -> Result<(), zx_status::Status> {
5971        use fidl::Peered;
5972        self.inner.channel().signal_peer(clear_mask, set_mask)
5973    }
5974}
5975
5976impl RealmQueryControlHandle {}
5977
5978#[must_use = "FIDL methods require a response to be sent"]
5979#[derive(Debug)]
5980pub struct RealmQueryGetInstanceResponder {
5981    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
5982    tx_id: u32,
5983}
5984
5985/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
5986/// if the responder is dropped without sending a response, so that the client
5987/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5988impl std::ops::Drop for RealmQueryGetInstanceResponder {
5989    fn drop(&mut self) {
5990        self.control_handle.shutdown();
5991        // Safety: drops once, never accessed again
5992        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5993    }
5994}
5995
5996impl fidl::endpoints::Responder for RealmQueryGetInstanceResponder {
5997    type ControlHandle = RealmQueryControlHandle;
5998
5999    fn control_handle(&self) -> &RealmQueryControlHandle {
6000        &self.control_handle
6001    }
6002
6003    fn drop_without_shutdown(mut self) {
6004        // Safety: drops once, never accessed again due to mem::forget
6005        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6006        // Prevent Drop from running (which would shut down the channel)
6007        std::mem::forget(self);
6008    }
6009}
6010
6011impl RealmQueryGetInstanceResponder {
6012    /// Sends a response to the FIDL transaction.
6013    ///
6014    /// Sets the channel to shutdown if an error occurs.
6015    pub fn send(self, mut result: Result<&Instance, GetInstanceError>) -> Result<(), fidl::Error> {
6016        let _result = self.send_raw(result);
6017        if _result.is_err() {
6018            self.control_handle.shutdown();
6019        }
6020        self.drop_without_shutdown();
6021        _result
6022    }
6023
6024    /// Similar to "send" but does not shutdown the channel if an error occurs.
6025    pub fn send_no_shutdown_on_err(
6026        self,
6027        mut result: Result<&Instance, GetInstanceError>,
6028    ) -> Result<(), fidl::Error> {
6029        let _result = self.send_raw(result);
6030        self.drop_without_shutdown();
6031        _result
6032    }
6033
6034    fn send_raw(&self, mut result: Result<&Instance, GetInstanceError>) -> Result<(), fidl::Error> {
6035        self.control_handle.inner.send::<fidl::encoding::ResultType<
6036            RealmQueryGetInstanceResponse,
6037            GetInstanceError,
6038        >>(
6039            result.map(|instance| (instance,)),
6040            self.tx_id,
6041            0x3496ca1e5a0c13a8,
6042            fidl::encoding::DynamicFlags::empty(),
6043        )
6044    }
6045}
6046
6047#[must_use = "FIDL methods require a response to be sent"]
6048#[derive(Debug)]
6049pub struct RealmQueryGetResolvedDeclarationResponder {
6050    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6051    tx_id: u32,
6052}
6053
6054/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6055/// if the responder is dropped without sending a response, so that the client
6056/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6057impl std::ops::Drop for RealmQueryGetResolvedDeclarationResponder {
6058    fn drop(&mut self) {
6059        self.control_handle.shutdown();
6060        // Safety: drops once, never accessed again
6061        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6062    }
6063}
6064
6065impl fidl::endpoints::Responder for RealmQueryGetResolvedDeclarationResponder {
6066    type ControlHandle = RealmQueryControlHandle;
6067
6068    fn control_handle(&self) -> &RealmQueryControlHandle {
6069        &self.control_handle
6070    }
6071
6072    fn drop_without_shutdown(mut self) {
6073        // Safety: drops once, never accessed again due to mem::forget
6074        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6075        // Prevent Drop from running (which would shut down the channel)
6076        std::mem::forget(self);
6077    }
6078}
6079
6080impl RealmQueryGetResolvedDeclarationResponder {
6081    /// Sends a response to the FIDL transaction.
6082    ///
6083    /// Sets the channel to shutdown if an error occurs.
6084    pub fn send(
6085        self,
6086        mut result: Result<
6087            fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
6088            GetDeclarationError,
6089        >,
6090    ) -> Result<(), fidl::Error> {
6091        let _result = self.send_raw(result);
6092        if _result.is_err() {
6093            self.control_handle.shutdown();
6094        }
6095        self.drop_without_shutdown();
6096        _result
6097    }
6098
6099    /// Similar to "send" but does not shutdown the channel if an error occurs.
6100    pub fn send_no_shutdown_on_err(
6101        self,
6102        mut result: Result<
6103            fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
6104            GetDeclarationError,
6105        >,
6106    ) -> Result<(), fidl::Error> {
6107        let _result = self.send_raw(result);
6108        self.drop_without_shutdown();
6109        _result
6110    }
6111
6112    fn send_raw(
6113        &self,
6114        mut result: Result<
6115            fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
6116            GetDeclarationError,
6117        >,
6118    ) -> Result<(), fidl::Error> {
6119        self.control_handle.inner.send::<fidl::encoding::ResultType<
6120            RealmQueryGetResolvedDeclarationResponse,
6121            GetDeclarationError,
6122        >>(
6123            result.map(|iterator| (iterator,)),
6124            self.tx_id,
6125            0x31a493d284a0bc1f,
6126            fidl::encoding::DynamicFlags::empty(),
6127        )
6128    }
6129}
6130
6131#[must_use = "FIDL methods require a response to be sent"]
6132#[derive(Debug)]
6133pub struct RealmQueryResolveDeclarationResponder {
6134    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6135    tx_id: u32,
6136}
6137
6138/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6139/// if the responder is dropped without sending a response, so that the client
6140/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6141impl std::ops::Drop for RealmQueryResolveDeclarationResponder {
6142    fn drop(&mut self) {
6143        self.control_handle.shutdown();
6144        // Safety: drops once, never accessed again
6145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6146    }
6147}
6148
6149impl fidl::endpoints::Responder for RealmQueryResolveDeclarationResponder {
6150    type ControlHandle = RealmQueryControlHandle;
6151
6152    fn control_handle(&self) -> &RealmQueryControlHandle {
6153        &self.control_handle
6154    }
6155
6156    fn drop_without_shutdown(mut self) {
6157        // Safety: drops once, never accessed again due to mem::forget
6158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6159        // Prevent Drop from running (which would shut down the channel)
6160        std::mem::forget(self);
6161    }
6162}
6163
6164impl RealmQueryResolveDeclarationResponder {
6165    /// Sends a response to the FIDL transaction.
6166    ///
6167    /// Sets the channel to shutdown if an error occurs.
6168    pub fn send(
6169        self,
6170        mut result: Result<
6171            fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
6172            GetDeclarationError,
6173        >,
6174    ) -> Result<(), fidl::Error> {
6175        let _result = self.send_raw(result);
6176        if _result.is_err() {
6177            self.control_handle.shutdown();
6178        }
6179        self.drop_without_shutdown();
6180        _result
6181    }
6182
6183    /// Similar to "send" but does not shutdown the channel if an error occurs.
6184    pub fn send_no_shutdown_on_err(
6185        self,
6186        mut result: Result<
6187            fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
6188            GetDeclarationError,
6189        >,
6190    ) -> Result<(), fidl::Error> {
6191        let _result = self.send_raw(result);
6192        self.drop_without_shutdown();
6193        _result
6194    }
6195
6196    fn send_raw(
6197        &self,
6198        mut result: Result<
6199            fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
6200            GetDeclarationError,
6201        >,
6202    ) -> Result<(), fidl::Error> {
6203        self.control_handle.inner.send::<fidl::encoding::ResultType<
6204            RealmQueryResolveDeclarationResponse,
6205            GetDeclarationError,
6206        >>(
6207            result.map(|iterator| (iterator,)),
6208            self.tx_id,
6209            0x1ab1adf2a87d962d,
6210            fidl::encoding::DynamicFlags::empty(),
6211        )
6212    }
6213}
6214
6215#[must_use = "FIDL methods require a response to be sent"]
6216#[derive(Debug)]
6217pub struct RealmQueryGetStructuredConfigResponder {
6218    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6219    tx_id: u32,
6220}
6221
6222/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6223/// if the responder is dropped without sending a response, so that the client
6224/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6225impl std::ops::Drop for RealmQueryGetStructuredConfigResponder {
6226    fn drop(&mut self) {
6227        self.control_handle.shutdown();
6228        // Safety: drops once, never accessed again
6229        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6230    }
6231}
6232
6233impl fidl::endpoints::Responder for RealmQueryGetStructuredConfigResponder {
6234    type ControlHandle = RealmQueryControlHandle;
6235
6236    fn control_handle(&self) -> &RealmQueryControlHandle {
6237        &self.control_handle
6238    }
6239
6240    fn drop_without_shutdown(mut self) {
6241        // Safety: drops once, never accessed again due to mem::forget
6242        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6243        // Prevent Drop from running (which would shut down the channel)
6244        std::mem::forget(self);
6245    }
6246}
6247
6248impl RealmQueryGetStructuredConfigResponder {
6249    /// Sends a response to the FIDL transaction.
6250    ///
6251    /// Sets the channel to shutdown if an error occurs.
6252    pub fn send(
6253        self,
6254        mut result: Result<&fidl_fuchsia_component_decl::ResolvedConfig, GetStructuredConfigError>,
6255    ) -> Result<(), fidl::Error> {
6256        let _result = self.send_raw(result);
6257        if _result.is_err() {
6258            self.control_handle.shutdown();
6259        }
6260        self.drop_without_shutdown();
6261        _result
6262    }
6263
6264    /// Similar to "send" but does not shutdown the channel if an error occurs.
6265    pub fn send_no_shutdown_on_err(
6266        self,
6267        mut result: Result<&fidl_fuchsia_component_decl::ResolvedConfig, GetStructuredConfigError>,
6268    ) -> Result<(), fidl::Error> {
6269        let _result = self.send_raw(result);
6270        self.drop_without_shutdown();
6271        _result
6272    }
6273
6274    fn send_raw(
6275        &self,
6276        mut result: Result<&fidl_fuchsia_component_decl::ResolvedConfig, GetStructuredConfigError>,
6277    ) -> Result<(), fidl::Error> {
6278        self.control_handle.inner.send::<fidl::encoding::ResultType<
6279            RealmQueryGetStructuredConfigResponse,
6280            GetStructuredConfigError,
6281        >>(
6282            result.map(|config| (config,)),
6283            self.tx_id,
6284            0x16f88f6735bd204,
6285            fidl::encoding::DynamicFlags::empty(),
6286        )
6287    }
6288}
6289
6290#[must_use = "FIDL methods require a response to be sent"]
6291#[derive(Debug)]
6292pub struct RealmQueryGetAllInstancesResponder {
6293    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6294    tx_id: u32,
6295}
6296
6297/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6298/// if the responder is dropped without sending a response, so that the client
6299/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6300impl std::ops::Drop for RealmQueryGetAllInstancesResponder {
6301    fn drop(&mut self) {
6302        self.control_handle.shutdown();
6303        // Safety: drops once, never accessed again
6304        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6305    }
6306}
6307
6308impl fidl::endpoints::Responder for RealmQueryGetAllInstancesResponder {
6309    type ControlHandle = RealmQueryControlHandle;
6310
6311    fn control_handle(&self) -> &RealmQueryControlHandle {
6312        &self.control_handle
6313    }
6314
6315    fn drop_without_shutdown(mut self) {
6316        // Safety: drops once, never accessed again due to mem::forget
6317        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6318        // Prevent Drop from running (which would shut down the channel)
6319        std::mem::forget(self);
6320    }
6321}
6322
6323impl RealmQueryGetAllInstancesResponder {
6324    /// Sends a response to the FIDL transaction.
6325    ///
6326    /// Sets the channel to shutdown if an error occurs.
6327    pub fn send(
6328        self,
6329        mut result: Result<
6330            fidl::endpoints::ClientEnd<InstanceIteratorMarker>,
6331            GetAllInstancesError,
6332        >,
6333    ) -> Result<(), fidl::Error> {
6334        let _result = self.send_raw(result);
6335        if _result.is_err() {
6336            self.control_handle.shutdown();
6337        }
6338        self.drop_without_shutdown();
6339        _result
6340    }
6341
6342    /// Similar to "send" but does not shutdown the channel if an error occurs.
6343    pub fn send_no_shutdown_on_err(
6344        self,
6345        mut result: Result<
6346            fidl::endpoints::ClientEnd<InstanceIteratorMarker>,
6347            GetAllInstancesError,
6348        >,
6349    ) -> Result<(), fidl::Error> {
6350        let _result = self.send_raw(result);
6351        self.drop_without_shutdown();
6352        _result
6353    }
6354
6355    fn send_raw(
6356        &self,
6357        mut result: Result<
6358            fidl::endpoints::ClientEnd<InstanceIteratorMarker>,
6359            GetAllInstancesError,
6360        >,
6361    ) -> Result<(), fidl::Error> {
6362        self.control_handle.inner.send::<fidl::encoding::ResultType<
6363            RealmQueryGetAllInstancesResponse,
6364            GetAllInstancesError,
6365        >>(
6366            result.map(|iterator| (iterator,)),
6367            self.tx_id,
6368            0x7b5a8775d30cad47,
6369            fidl::encoding::DynamicFlags::empty(),
6370        )
6371    }
6372}
6373
6374#[must_use = "FIDL methods require a response to be sent"]
6375#[derive(Debug)]
6376pub struct RealmQueryConstructNamespaceResponder {
6377    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6378    tx_id: u32,
6379}
6380
6381/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6382/// if the responder is dropped without sending a response, so that the client
6383/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6384impl std::ops::Drop for RealmQueryConstructNamespaceResponder {
6385    fn drop(&mut self) {
6386        self.control_handle.shutdown();
6387        // Safety: drops once, never accessed again
6388        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6389    }
6390}
6391
6392impl fidl::endpoints::Responder for RealmQueryConstructNamespaceResponder {
6393    type ControlHandle = RealmQueryControlHandle;
6394
6395    fn control_handle(&self) -> &RealmQueryControlHandle {
6396        &self.control_handle
6397    }
6398
6399    fn drop_without_shutdown(mut self) {
6400        // Safety: drops once, never accessed again due to mem::forget
6401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6402        // Prevent Drop from running (which would shut down the channel)
6403        std::mem::forget(self);
6404    }
6405}
6406
6407impl RealmQueryConstructNamespaceResponder {
6408    /// Sends a response to the FIDL transaction.
6409    ///
6410    /// Sets the channel to shutdown if an error occurs.
6411    pub fn send(
6412        self,
6413        mut result: Result<
6414            Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>,
6415            ConstructNamespaceError,
6416        >,
6417    ) -> Result<(), fidl::Error> {
6418        let _result = self.send_raw(result);
6419        if _result.is_err() {
6420            self.control_handle.shutdown();
6421        }
6422        self.drop_without_shutdown();
6423        _result
6424    }
6425
6426    /// Similar to "send" but does not shutdown the channel if an error occurs.
6427    pub fn send_no_shutdown_on_err(
6428        self,
6429        mut result: Result<
6430            Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>,
6431            ConstructNamespaceError,
6432        >,
6433    ) -> Result<(), fidl::Error> {
6434        let _result = self.send_raw(result);
6435        self.drop_without_shutdown();
6436        _result
6437    }
6438
6439    fn send_raw(
6440        &self,
6441        mut result: Result<
6442            Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>,
6443            ConstructNamespaceError,
6444        >,
6445    ) -> Result<(), fidl::Error> {
6446        self.control_handle.inner.send::<fidl::encoding::ResultType<
6447            RealmQueryConstructNamespaceResponse,
6448            ConstructNamespaceError,
6449        >>(
6450            result.as_mut().map_err(|e| *e).map(|namespace| (namespace.as_mut_slice(),)),
6451            self.tx_id,
6452            0x5ecb29c02c488eeb,
6453            fidl::encoding::DynamicFlags::empty(),
6454        )
6455    }
6456}
6457
6458#[must_use = "FIDL methods require a response to be sent"]
6459#[derive(Debug)]
6460pub struct RealmQueryOpenDirectoryResponder {
6461    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6462    tx_id: u32,
6463}
6464
6465/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6466/// if the responder is dropped without sending a response, so that the client
6467/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6468impl std::ops::Drop for RealmQueryOpenDirectoryResponder {
6469    fn drop(&mut self) {
6470        self.control_handle.shutdown();
6471        // Safety: drops once, never accessed again
6472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6473    }
6474}
6475
6476impl fidl::endpoints::Responder for RealmQueryOpenDirectoryResponder {
6477    type ControlHandle = RealmQueryControlHandle;
6478
6479    fn control_handle(&self) -> &RealmQueryControlHandle {
6480        &self.control_handle
6481    }
6482
6483    fn drop_without_shutdown(mut self) {
6484        // Safety: drops once, never accessed again due to mem::forget
6485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6486        // Prevent Drop from running (which would shut down the channel)
6487        std::mem::forget(self);
6488    }
6489}
6490
6491impl RealmQueryOpenDirectoryResponder {
6492    /// Sends a response to the FIDL transaction.
6493    ///
6494    /// Sets the channel to shutdown if an error occurs.
6495    pub fn send(self, mut result: Result<(), OpenError>) -> Result<(), fidl::Error> {
6496        let _result = self.send_raw(result);
6497        if _result.is_err() {
6498            self.control_handle.shutdown();
6499        }
6500        self.drop_without_shutdown();
6501        _result
6502    }
6503
6504    /// Similar to "send" but does not shutdown the channel if an error occurs.
6505    pub fn send_no_shutdown_on_err(
6506        self,
6507        mut result: Result<(), OpenError>,
6508    ) -> Result<(), fidl::Error> {
6509        let _result = self.send_raw(result);
6510        self.drop_without_shutdown();
6511        _result
6512    }
6513
6514    fn send_raw(&self, mut result: Result<(), OpenError>) -> Result<(), fidl::Error> {
6515        self.control_handle
6516            .inner
6517            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenError>>(
6518                result,
6519                self.tx_id,
6520                0x333d68f1deecec85,
6521                fidl::encoding::DynamicFlags::empty(),
6522            )
6523    }
6524}
6525
6526#[must_use = "FIDL methods require a response to be sent"]
6527#[derive(Debug)]
6528pub struct RealmQueryConnectToStorageAdminResponder {
6529    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6530    tx_id: u32,
6531}
6532
6533/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6534/// if the responder is dropped without sending a response, so that the client
6535/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6536impl std::ops::Drop for RealmQueryConnectToStorageAdminResponder {
6537    fn drop(&mut self) {
6538        self.control_handle.shutdown();
6539        // Safety: drops once, never accessed again
6540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6541    }
6542}
6543
6544impl fidl::endpoints::Responder for RealmQueryConnectToStorageAdminResponder {
6545    type ControlHandle = RealmQueryControlHandle;
6546
6547    fn control_handle(&self) -> &RealmQueryControlHandle {
6548        &self.control_handle
6549    }
6550
6551    fn drop_without_shutdown(mut self) {
6552        // Safety: drops once, never accessed again due to mem::forget
6553        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6554        // Prevent Drop from running (which would shut down the channel)
6555        std::mem::forget(self);
6556    }
6557}
6558
6559impl RealmQueryConnectToStorageAdminResponder {
6560    /// Sends a response to the FIDL transaction.
6561    ///
6562    /// Sets the channel to shutdown if an error occurs.
6563    pub fn send(
6564        self,
6565        mut result: Result<(), ConnectToStorageAdminError>,
6566    ) -> Result<(), fidl::Error> {
6567        let _result = self.send_raw(result);
6568        if _result.is_err() {
6569            self.control_handle.shutdown();
6570        }
6571        self.drop_without_shutdown();
6572        _result
6573    }
6574
6575    /// Similar to "send" but does not shutdown the channel if an error occurs.
6576    pub fn send_no_shutdown_on_err(
6577        self,
6578        mut result: Result<(), ConnectToStorageAdminError>,
6579    ) -> Result<(), fidl::Error> {
6580        let _result = self.send_raw(result);
6581        self.drop_without_shutdown();
6582        _result
6583    }
6584
6585    fn send_raw(
6586        &self,
6587        mut result: Result<(), ConnectToStorageAdminError>,
6588    ) -> Result<(), fidl::Error> {
6589        self.control_handle.inner.send::<fidl::encoding::ResultType<
6590            fidl::encoding::EmptyStruct,
6591            ConnectToStorageAdminError,
6592        >>(
6593            result,
6594            self.tx_id,
6595            0x7807e6b4f623ace,
6596            fidl::encoding::DynamicFlags::empty(),
6597        )
6598    }
6599}
6600
6601#[must_use = "FIDL methods require a response to be sent"]
6602#[derive(Debug)]
6603pub struct RealmQueryOpenStorageAdminResponder {
6604    control_handle: std::mem::ManuallyDrop<RealmQueryControlHandle>,
6605    tx_id: u32,
6606}
6607
6608/// Set the the channel to be shutdown (see [`RealmQueryControlHandle::shutdown`])
6609/// if the responder is dropped without sending a response, so that the client
6610/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6611impl std::ops::Drop for RealmQueryOpenStorageAdminResponder {
6612    fn drop(&mut self) {
6613        self.control_handle.shutdown();
6614        // Safety: drops once, never accessed again
6615        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6616    }
6617}
6618
6619impl fidl::endpoints::Responder for RealmQueryOpenStorageAdminResponder {
6620    type ControlHandle = RealmQueryControlHandle;
6621
6622    fn control_handle(&self) -> &RealmQueryControlHandle {
6623        &self.control_handle
6624    }
6625
6626    fn drop_without_shutdown(mut self) {
6627        // Safety: drops once, never accessed again due to mem::forget
6628        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6629        // Prevent Drop from running (which would shut down the channel)
6630        std::mem::forget(self);
6631    }
6632}
6633
6634impl RealmQueryOpenStorageAdminResponder {
6635    /// Sends a response to the FIDL transaction.
6636    ///
6637    /// Sets the channel to shutdown if an error occurs.
6638    pub fn send(
6639        self,
6640        mut result: Result<(), ConnectToStorageAdminError>,
6641    ) -> Result<(), fidl::Error> {
6642        let _result = self.send_raw(result);
6643        if _result.is_err() {
6644            self.control_handle.shutdown();
6645        }
6646        self.drop_without_shutdown();
6647        _result
6648    }
6649
6650    /// Similar to "send" but does not shutdown the channel if an error occurs.
6651    pub fn send_no_shutdown_on_err(
6652        self,
6653        mut result: Result<(), ConnectToStorageAdminError>,
6654    ) -> Result<(), fidl::Error> {
6655        let _result = self.send_raw(result);
6656        self.drop_without_shutdown();
6657        _result
6658    }
6659
6660    fn send_raw(
6661        &self,
6662        mut result: Result<(), ConnectToStorageAdminError>,
6663    ) -> Result<(), fidl::Error> {
6664        self.control_handle.inner.send::<fidl::encoding::ResultType<
6665            fidl::encoding::EmptyStruct,
6666            ConnectToStorageAdminError,
6667        >>(
6668            result,
6669            self.tx_id,
6670            0x54d6af83942b4069,
6671            fidl::encoding::DynamicFlags::empty(),
6672        )
6673    }
6674}
6675
6676#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6677pub struct RouteValidatorMarker;
6678
6679impl fidl::endpoints::ProtocolMarker for RouteValidatorMarker {
6680    type Proxy = RouteValidatorProxy;
6681    type RequestStream = RouteValidatorRequestStream;
6682    #[cfg(target_os = "fuchsia")]
6683    type SynchronousProxy = RouteValidatorSynchronousProxy;
6684
6685    const DEBUG_NAME: &'static str = "fuchsia.sys2.RouteValidator";
6686}
6687impl fidl::endpoints::DiscoverableProtocolMarker for RouteValidatorMarker {}
6688pub type RouteValidatorValidateResult = Result<Vec<RouteReport>, fidl_fuchsia_component::Error>;
6689pub type RouteValidatorRouteResult = Result<Vec<RouteReport>, RouteValidatorError>;
6690
6691pub trait RouteValidatorProxyInterface: Send + Sync {
6692    type ValidateResponseFut: std::future::Future<Output = Result<RouteValidatorValidateResult, fidl::Error>>
6693        + Send;
6694    fn r#validate(&self, moniker: &str) -> Self::ValidateResponseFut;
6695    type RouteResponseFut: std::future::Future<Output = Result<RouteValidatorRouteResult, fidl::Error>>
6696        + Send;
6697    fn r#route(&self, moniker: &str, targets: &[RouteTarget]) -> Self::RouteResponseFut;
6698}
6699#[derive(Debug)]
6700#[cfg(target_os = "fuchsia")]
6701pub struct RouteValidatorSynchronousProxy {
6702    client: fidl::client::sync::Client,
6703}
6704
6705#[cfg(target_os = "fuchsia")]
6706impl fidl::endpoints::SynchronousProxy for RouteValidatorSynchronousProxy {
6707    type Proxy = RouteValidatorProxy;
6708    type Protocol = RouteValidatorMarker;
6709
6710    fn from_channel(inner: fidl::Channel) -> Self {
6711        Self::new(inner)
6712    }
6713
6714    fn into_channel(self) -> fidl::Channel {
6715        self.client.into_channel()
6716    }
6717
6718    fn as_channel(&self) -> &fidl::Channel {
6719        self.client.as_channel()
6720    }
6721}
6722
6723#[cfg(target_os = "fuchsia")]
6724impl RouteValidatorSynchronousProxy {
6725    pub fn new(channel: fidl::Channel) -> Self {
6726        let protocol_name = <RouteValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6727        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6728    }
6729
6730    pub fn into_channel(self) -> fidl::Channel {
6731        self.client.into_channel()
6732    }
6733
6734    /// Waits until an event arrives and returns it. It is safe for other
6735    /// threads to make concurrent requests while waiting for an event.
6736    pub fn wait_for_event(
6737        &self,
6738        deadline: zx::MonotonicInstant,
6739    ) -> Result<RouteValidatorEvent, fidl::Error> {
6740        RouteValidatorEvent::decode(self.client.wait_for_event(deadline)?)
6741    }
6742
6743    /// Routes all incoming and exposed capabilities of a component identified by the given
6744    /// moniker. If the routing failed, an error is returned in the response.
6745    /// This function may cause components to be resolved.
6746    ///
6747    /// Errors:
6748    /// * INVALID_ARGUMENTS: The given moniker is not valid.
6749    /// * INSTANCE_NOT_FOUND: No instance was found matching the given moniker.
6750    pub fn r#validate(
6751        &self,
6752        mut moniker: &str,
6753        ___deadline: zx::MonotonicInstant,
6754    ) -> Result<RouteValidatorValidateResult, fidl::Error> {
6755        let _response =
6756            self.client.send_query::<RouteValidatorValidateRequest, fidl::encoding::ResultType<
6757                RouteValidatorValidateResponse,
6758                fidl_fuchsia_component::Error,
6759            >>(
6760                (moniker,),
6761                0x3360b96d5f86cdf4,
6762                fidl::encoding::DynamicFlags::empty(),
6763                ___deadline,
6764            )?;
6765        Ok(_response.map(|x| x.reports))
6766    }
6767
6768    /// Routes a component's used or exposed capabilities, and returns
6769    /// information about them.
6770    ///
6771    /// If `targets` is empty, returns results for all the component's used and
6772    /// exposed capabilities. Otherwise, returns only results for capabilities
6773    /// specified in `targets`.
6774    ///
6775    /// This method only supports routing namespace capabilities (protocols,
6776    /// directories, services, and storage).
6777    ///
6778    /// Errors:
6779    /// * INVALID_ARGUMENTS: The given moniker or name is not valid, or `name`
6780    ///   is not a namespace capability.
6781    /// * INSTANCE_NOT_FOUND: No instance was found matching the given moniker.
6782    /// * RESOURCE_NOT_FOUND: No capability was found matching one of the given names.
6783    pub fn r#route(
6784        &self,
6785        mut moniker: &str,
6786        mut targets: &[RouteTarget],
6787        ___deadline: zx::MonotonicInstant,
6788    ) -> Result<RouteValidatorRouteResult, fidl::Error> {
6789        let _response =
6790            self.client.send_query::<RouteValidatorRouteRequest, fidl::encoding::ResultType<
6791                RouteValidatorRouteResponse,
6792                RouteValidatorError,
6793            >>(
6794                (moniker, targets),
6795                0x51c9b268216d8239,
6796                fidl::encoding::DynamicFlags::empty(),
6797                ___deadline,
6798            )?;
6799        Ok(_response.map(|x| x.reports))
6800    }
6801}
6802
6803#[cfg(target_os = "fuchsia")]
6804impl From<RouteValidatorSynchronousProxy> for zx::NullableHandle {
6805    fn from(value: RouteValidatorSynchronousProxy) -> Self {
6806        value.into_channel().into()
6807    }
6808}
6809
6810#[cfg(target_os = "fuchsia")]
6811impl From<fidl::Channel> for RouteValidatorSynchronousProxy {
6812    fn from(value: fidl::Channel) -> Self {
6813        Self::new(value)
6814    }
6815}
6816
6817#[cfg(target_os = "fuchsia")]
6818impl fidl::endpoints::FromClient for RouteValidatorSynchronousProxy {
6819    type Protocol = RouteValidatorMarker;
6820
6821    fn from_client(value: fidl::endpoints::ClientEnd<RouteValidatorMarker>) -> Self {
6822        Self::new(value.into_channel())
6823    }
6824}
6825
6826#[derive(Debug, Clone)]
6827pub struct RouteValidatorProxy {
6828    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6829}
6830
6831impl fidl::endpoints::Proxy for RouteValidatorProxy {
6832    type Protocol = RouteValidatorMarker;
6833
6834    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6835        Self::new(inner)
6836    }
6837
6838    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6839        self.client.into_channel().map_err(|client| Self { client })
6840    }
6841
6842    fn as_channel(&self) -> &::fidl::AsyncChannel {
6843        self.client.as_channel()
6844    }
6845}
6846
6847impl RouteValidatorProxy {
6848    /// Create a new Proxy for fuchsia.sys2/RouteValidator.
6849    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6850        let protocol_name = <RouteValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6851        Self { client: fidl::client::Client::new(channel, protocol_name) }
6852    }
6853
6854    /// Get a Stream of events from the remote end of the protocol.
6855    ///
6856    /// # Panics
6857    ///
6858    /// Panics if the event stream was already taken.
6859    pub fn take_event_stream(&self) -> RouteValidatorEventStream {
6860        RouteValidatorEventStream { event_receiver: self.client.take_event_receiver() }
6861    }
6862
6863    /// Routes all incoming and exposed capabilities of a component identified by the given
6864    /// moniker. If the routing failed, an error is returned in the response.
6865    /// This function may cause components to be resolved.
6866    ///
6867    /// Errors:
6868    /// * INVALID_ARGUMENTS: The given moniker is not valid.
6869    /// * INSTANCE_NOT_FOUND: No instance was found matching the given moniker.
6870    pub fn r#validate(
6871        &self,
6872        mut moniker: &str,
6873    ) -> fidl::client::QueryResponseFut<
6874        RouteValidatorValidateResult,
6875        fidl::encoding::DefaultFuchsiaResourceDialect,
6876    > {
6877        RouteValidatorProxyInterface::r#validate(self, moniker)
6878    }
6879
6880    /// Routes a component's used or exposed capabilities, and returns
6881    /// information about them.
6882    ///
6883    /// If `targets` is empty, returns results for all the component's used and
6884    /// exposed capabilities. Otherwise, returns only results for capabilities
6885    /// specified in `targets`.
6886    ///
6887    /// This method only supports routing namespace capabilities (protocols,
6888    /// directories, services, and storage).
6889    ///
6890    /// Errors:
6891    /// * INVALID_ARGUMENTS: The given moniker or name is not valid, or `name`
6892    ///   is not a namespace capability.
6893    /// * INSTANCE_NOT_FOUND: No instance was found matching the given moniker.
6894    /// * RESOURCE_NOT_FOUND: No capability was found matching one of the given names.
6895    pub fn r#route(
6896        &self,
6897        mut moniker: &str,
6898        mut targets: &[RouteTarget],
6899    ) -> fidl::client::QueryResponseFut<
6900        RouteValidatorRouteResult,
6901        fidl::encoding::DefaultFuchsiaResourceDialect,
6902    > {
6903        RouteValidatorProxyInterface::r#route(self, moniker, targets)
6904    }
6905}
6906
6907impl RouteValidatorProxyInterface for RouteValidatorProxy {
6908    type ValidateResponseFut = fidl::client::QueryResponseFut<
6909        RouteValidatorValidateResult,
6910        fidl::encoding::DefaultFuchsiaResourceDialect,
6911    >;
6912    fn r#validate(&self, mut moniker: &str) -> Self::ValidateResponseFut {
6913        fn _decode(
6914            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6915        ) -> Result<RouteValidatorValidateResult, fidl::Error> {
6916            let _response = fidl::client::decode_transaction_body::<
6917                fidl::encoding::ResultType<
6918                    RouteValidatorValidateResponse,
6919                    fidl_fuchsia_component::Error,
6920                >,
6921                fidl::encoding::DefaultFuchsiaResourceDialect,
6922                0x3360b96d5f86cdf4,
6923            >(_buf?)?;
6924            Ok(_response.map(|x| x.reports))
6925        }
6926        self.client
6927            .send_query_and_decode::<RouteValidatorValidateRequest, RouteValidatorValidateResult>(
6928                (moniker,),
6929                0x3360b96d5f86cdf4,
6930                fidl::encoding::DynamicFlags::empty(),
6931                _decode,
6932            )
6933    }
6934
6935    type RouteResponseFut = fidl::client::QueryResponseFut<
6936        RouteValidatorRouteResult,
6937        fidl::encoding::DefaultFuchsiaResourceDialect,
6938    >;
6939    fn r#route(&self, mut moniker: &str, mut targets: &[RouteTarget]) -> Self::RouteResponseFut {
6940        fn _decode(
6941            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6942        ) -> Result<RouteValidatorRouteResult, fidl::Error> {
6943            let _response = fidl::client::decode_transaction_body::<
6944                fidl::encoding::ResultType<RouteValidatorRouteResponse, RouteValidatorError>,
6945                fidl::encoding::DefaultFuchsiaResourceDialect,
6946                0x51c9b268216d8239,
6947            >(_buf?)?;
6948            Ok(_response.map(|x| x.reports))
6949        }
6950        self.client.send_query_and_decode::<RouteValidatorRouteRequest, RouteValidatorRouteResult>(
6951            (moniker, targets),
6952            0x51c9b268216d8239,
6953            fidl::encoding::DynamicFlags::empty(),
6954            _decode,
6955        )
6956    }
6957}
6958
6959pub struct RouteValidatorEventStream {
6960    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6961}
6962
6963impl std::marker::Unpin for RouteValidatorEventStream {}
6964
6965impl futures::stream::FusedStream for RouteValidatorEventStream {
6966    fn is_terminated(&self) -> bool {
6967        self.event_receiver.is_terminated()
6968    }
6969}
6970
6971impl futures::Stream for RouteValidatorEventStream {
6972    type Item = Result<RouteValidatorEvent, fidl::Error>;
6973
6974    fn poll_next(
6975        mut self: std::pin::Pin<&mut Self>,
6976        cx: &mut std::task::Context<'_>,
6977    ) -> std::task::Poll<Option<Self::Item>> {
6978        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6979            &mut self.event_receiver,
6980            cx
6981        )?) {
6982            Some(buf) => std::task::Poll::Ready(Some(RouteValidatorEvent::decode(buf))),
6983            None => std::task::Poll::Ready(None),
6984        }
6985    }
6986}
6987
6988#[derive(Debug)]
6989pub enum RouteValidatorEvent {}
6990
6991impl RouteValidatorEvent {
6992    /// Decodes a message buffer as a [`RouteValidatorEvent`].
6993    fn decode(
6994        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6995    ) -> Result<RouteValidatorEvent, fidl::Error> {
6996        let (bytes, _handles) = buf.split_mut();
6997        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6998        debug_assert_eq!(tx_header.tx_id, 0);
6999        match tx_header.ordinal {
7000            _ => Err(fidl::Error::UnknownOrdinal {
7001                ordinal: tx_header.ordinal,
7002                protocol_name:
7003                    <RouteValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7004            }),
7005        }
7006    }
7007}
7008
7009/// A Stream of incoming requests for fuchsia.sys2/RouteValidator.
7010pub struct RouteValidatorRequestStream {
7011    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7012    is_terminated: bool,
7013}
7014
7015impl std::marker::Unpin for RouteValidatorRequestStream {}
7016
7017impl futures::stream::FusedStream for RouteValidatorRequestStream {
7018    fn is_terminated(&self) -> bool {
7019        self.is_terminated
7020    }
7021}
7022
7023impl fidl::endpoints::RequestStream for RouteValidatorRequestStream {
7024    type Protocol = RouteValidatorMarker;
7025    type ControlHandle = RouteValidatorControlHandle;
7026
7027    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7028        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7029    }
7030
7031    fn control_handle(&self) -> Self::ControlHandle {
7032        RouteValidatorControlHandle { inner: self.inner.clone() }
7033    }
7034
7035    fn into_inner(
7036        self,
7037    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7038    {
7039        (self.inner, self.is_terminated)
7040    }
7041
7042    fn from_inner(
7043        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7044        is_terminated: bool,
7045    ) -> Self {
7046        Self { inner, is_terminated }
7047    }
7048}
7049
7050impl futures::Stream for RouteValidatorRequestStream {
7051    type Item = Result<RouteValidatorRequest, fidl::Error>;
7052
7053    fn poll_next(
7054        mut self: std::pin::Pin<&mut Self>,
7055        cx: &mut std::task::Context<'_>,
7056    ) -> std::task::Poll<Option<Self::Item>> {
7057        let this = &mut *self;
7058        if this.inner.check_shutdown(cx) {
7059            this.is_terminated = true;
7060            return std::task::Poll::Ready(None);
7061        }
7062        if this.is_terminated {
7063            panic!("polled RouteValidatorRequestStream after completion");
7064        }
7065        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7066            |bytes, handles| {
7067                match this.inner.channel().read_etc(cx, bytes, handles) {
7068                    std::task::Poll::Ready(Ok(())) => {}
7069                    std::task::Poll::Pending => return std::task::Poll::Pending,
7070                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7071                        this.is_terminated = true;
7072                        return std::task::Poll::Ready(None);
7073                    }
7074                    std::task::Poll::Ready(Err(e)) => {
7075                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7076                            e.into(),
7077                        ))));
7078                    }
7079                }
7080
7081                // A message has been received from the channel
7082                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7083
7084                std::task::Poll::Ready(Some(match header.ordinal {
7085                    0x3360b96d5f86cdf4 => {
7086                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7087                        let mut req = fidl::new_empty!(
7088                            RouteValidatorValidateRequest,
7089                            fidl::encoding::DefaultFuchsiaResourceDialect
7090                        );
7091                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteValidatorValidateRequest>(&header, _body_bytes, handles, &mut req)?;
7092                        let control_handle =
7093                            RouteValidatorControlHandle { inner: this.inner.clone() };
7094                        Ok(RouteValidatorRequest::Validate {
7095                            moniker: req.moniker,
7096
7097                            responder: RouteValidatorValidateResponder {
7098                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7099                                tx_id: header.tx_id,
7100                            },
7101                        })
7102                    }
7103                    0x51c9b268216d8239 => {
7104                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7105                        let mut req = fidl::new_empty!(
7106                            RouteValidatorRouteRequest,
7107                            fidl::encoding::DefaultFuchsiaResourceDialect
7108                        );
7109                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteValidatorRouteRequest>(&header, _body_bytes, handles, &mut req)?;
7110                        let control_handle =
7111                            RouteValidatorControlHandle { inner: this.inner.clone() };
7112                        Ok(RouteValidatorRequest::Route {
7113                            moniker: req.moniker,
7114                            targets: req.targets,
7115
7116                            responder: RouteValidatorRouteResponder {
7117                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7118                                tx_id: header.tx_id,
7119                            },
7120                        })
7121                    }
7122                    _ => Err(fidl::Error::UnknownOrdinal {
7123                        ordinal: header.ordinal,
7124                        protocol_name:
7125                            <RouteValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7126                    }),
7127                }))
7128            },
7129        )
7130    }
7131}
7132
7133#[derive(Debug)]
7134pub enum RouteValidatorRequest {
7135    /// Routes all incoming and exposed capabilities of a component identified by the given
7136    /// moniker. If the routing failed, an error is returned in the response.
7137    /// This function may cause components to be resolved.
7138    ///
7139    /// Errors:
7140    /// * INVALID_ARGUMENTS: The given moniker is not valid.
7141    /// * INSTANCE_NOT_FOUND: No instance was found matching the given moniker.
7142    Validate { moniker: String, responder: RouteValidatorValidateResponder },
7143    /// Routes a component's used or exposed capabilities, and returns
7144    /// information about them.
7145    ///
7146    /// If `targets` is empty, returns results for all the component's used and
7147    /// exposed capabilities. Otherwise, returns only results for capabilities
7148    /// specified in `targets`.
7149    ///
7150    /// This method only supports routing namespace capabilities (protocols,
7151    /// directories, services, and storage).
7152    ///
7153    /// Errors:
7154    /// * INVALID_ARGUMENTS: The given moniker or name is not valid, or `name`
7155    ///   is not a namespace capability.
7156    /// * INSTANCE_NOT_FOUND: No instance was found matching the given moniker.
7157    /// * RESOURCE_NOT_FOUND: No capability was found matching one of the given names.
7158    Route { moniker: String, targets: Vec<RouteTarget>, responder: RouteValidatorRouteResponder },
7159}
7160
7161impl RouteValidatorRequest {
7162    #[allow(irrefutable_let_patterns)]
7163    pub fn into_validate(self) -> Option<(String, RouteValidatorValidateResponder)> {
7164        if let RouteValidatorRequest::Validate { moniker, responder } = self {
7165            Some((moniker, responder))
7166        } else {
7167            None
7168        }
7169    }
7170
7171    #[allow(irrefutable_let_patterns)]
7172    pub fn into_route(self) -> Option<(String, Vec<RouteTarget>, RouteValidatorRouteResponder)> {
7173        if let RouteValidatorRequest::Route { moniker, targets, responder } = self {
7174            Some((moniker, targets, responder))
7175        } else {
7176            None
7177        }
7178    }
7179
7180    /// Name of the method defined in FIDL
7181    pub fn method_name(&self) -> &'static str {
7182        match *self {
7183            RouteValidatorRequest::Validate { .. } => "validate",
7184            RouteValidatorRequest::Route { .. } => "route",
7185        }
7186    }
7187}
7188
7189#[derive(Debug, Clone)]
7190pub struct RouteValidatorControlHandle {
7191    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7192}
7193
7194impl fidl::endpoints::ControlHandle for RouteValidatorControlHandle {
7195    fn shutdown(&self) {
7196        self.inner.shutdown()
7197    }
7198
7199    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7200        self.inner.shutdown_with_epitaph(status)
7201    }
7202
7203    fn is_closed(&self) -> bool {
7204        self.inner.channel().is_closed()
7205    }
7206    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7207        self.inner.channel().on_closed()
7208    }
7209
7210    #[cfg(target_os = "fuchsia")]
7211    fn signal_peer(
7212        &self,
7213        clear_mask: zx::Signals,
7214        set_mask: zx::Signals,
7215    ) -> Result<(), zx_status::Status> {
7216        use fidl::Peered;
7217        self.inner.channel().signal_peer(clear_mask, set_mask)
7218    }
7219}
7220
7221impl RouteValidatorControlHandle {}
7222
7223#[must_use = "FIDL methods require a response to be sent"]
7224#[derive(Debug)]
7225pub struct RouteValidatorValidateResponder {
7226    control_handle: std::mem::ManuallyDrop<RouteValidatorControlHandle>,
7227    tx_id: u32,
7228}
7229
7230/// Set the the channel to be shutdown (see [`RouteValidatorControlHandle::shutdown`])
7231/// if the responder is dropped without sending a response, so that the client
7232/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7233impl std::ops::Drop for RouteValidatorValidateResponder {
7234    fn drop(&mut self) {
7235        self.control_handle.shutdown();
7236        // Safety: drops once, never accessed again
7237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7238    }
7239}
7240
7241impl fidl::endpoints::Responder for RouteValidatorValidateResponder {
7242    type ControlHandle = RouteValidatorControlHandle;
7243
7244    fn control_handle(&self) -> &RouteValidatorControlHandle {
7245        &self.control_handle
7246    }
7247
7248    fn drop_without_shutdown(mut self) {
7249        // Safety: drops once, never accessed again due to mem::forget
7250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7251        // Prevent Drop from running (which would shut down the channel)
7252        std::mem::forget(self);
7253    }
7254}
7255
7256impl RouteValidatorValidateResponder {
7257    /// Sends a response to the FIDL transaction.
7258    ///
7259    /// Sets the channel to shutdown if an error occurs.
7260    pub fn send(
7261        self,
7262        mut result: Result<&[RouteReport], fidl_fuchsia_component::Error>,
7263    ) -> Result<(), fidl::Error> {
7264        let _result = self.send_raw(result);
7265        if _result.is_err() {
7266            self.control_handle.shutdown();
7267        }
7268        self.drop_without_shutdown();
7269        _result
7270    }
7271
7272    /// Similar to "send" but does not shutdown the channel if an error occurs.
7273    pub fn send_no_shutdown_on_err(
7274        self,
7275        mut result: Result<&[RouteReport], fidl_fuchsia_component::Error>,
7276    ) -> Result<(), fidl::Error> {
7277        let _result = self.send_raw(result);
7278        self.drop_without_shutdown();
7279        _result
7280    }
7281
7282    fn send_raw(
7283        &self,
7284        mut result: Result<&[RouteReport], fidl_fuchsia_component::Error>,
7285    ) -> Result<(), fidl::Error> {
7286        self.control_handle.inner.send::<fidl::encoding::ResultType<
7287            RouteValidatorValidateResponse,
7288            fidl_fuchsia_component::Error,
7289        >>(
7290            result.map(|reports| (reports,)),
7291            self.tx_id,
7292            0x3360b96d5f86cdf4,
7293            fidl::encoding::DynamicFlags::empty(),
7294        )
7295    }
7296}
7297
7298#[must_use = "FIDL methods require a response to be sent"]
7299#[derive(Debug)]
7300pub struct RouteValidatorRouteResponder {
7301    control_handle: std::mem::ManuallyDrop<RouteValidatorControlHandle>,
7302    tx_id: u32,
7303}
7304
7305/// Set the the channel to be shutdown (see [`RouteValidatorControlHandle::shutdown`])
7306/// if the responder is dropped without sending a response, so that the client
7307/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7308impl std::ops::Drop for RouteValidatorRouteResponder {
7309    fn drop(&mut self) {
7310        self.control_handle.shutdown();
7311        // Safety: drops once, never accessed again
7312        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7313    }
7314}
7315
7316impl fidl::endpoints::Responder for RouteValidatorRouteResponder {
7317    type ControlHandle = RouteValidatorControlHandle;
7318
7319    fn control_handle(&self) -> &RouteValidatorControlHandle {
7320        &self.control_handle
7321    }
7322
7323    fn drop_without_shutdown(mut self) {
7324        // Safety: drops once, never accessed again due to mem::forget
7325        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7326        // Prevent Drop from running (which would shut down the channel)
7327        std::mem::forget(self);
7328    }
7329}
7330
7331impl RouteValidatorRouteResponder {
7332    /// Sends a response to the FIDL transaction.
7333    ///
7334    /// Sets the channel to shutdown if an error occurs.
7335    pub fn send(
7336        self,
7337        mut result: Result<&[RouteReport], RouteValidatorError>,
7338    ) -> Result<(), fidl::Error> {
7339        let _result = self.send_raw(result);
7340        if _result.is_err() {
7341            self.control_handle.shutdown();
7342        }
7343        self.drop_without_shutdown();
7344        _result
7345    }
7346
7347    /// Similar to "send" but does not shutdown the channel if an error occurs.
7348    pub fn send_no_shutdown_on_err(
7349        self,
7350        mut result: Result<&[RouteReport], RouteValidatorError>,
7351    ) -> Result<(), fidl::Error> {
7352        let _result = self.send_raw(result);
7353        self.drop_without_shutdown();
7354        _result
7355    }
7356
7357    fn send_raw(
7358        &self,
7359        mut result: Result<&[RouteReport], RouteValidatorError>,
7360    ) -> Result<(), fidl::Error> {
7361        self.control_handle.inner.send::<fidl::encoding::ResultType<
7362            RouteValidatorRouteResponse,
7363            RouteValidatorError,
7364        >>(
7365            result.map(|reports| (reports,)),
7366            self.tx_id,
7367            0x51c9b268216d8239,
7368            fidl::encoding::DynamicFlags::empty(),
7369        )
7370    }
7371}
7372
7373#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7374pub struct StorageAdminMarker;
7375
7376impl fidl::endpoints::ProtocolMarker for StorageAdminMarker {
7377    type Proxy = StorageAdminProxy;
7378    type RequestStream = StorageAdminRequestStream;
7379    #[cfg(target_os = "fuchsia")]
7380    type SynchronousProxy = StorageAdminSynchronousProxy;
7381
7382    const DEBUG_NAME: &'static str = "fuchsia.sys2.StorageAdmin";
7383}
7384impl fidl::endpoints::DiscoverableProtocolMarker for StorageAdminMarker {}
7385pub type StorageAdminOpenStorageResult = Result<(), fidl_fuchsia_component::Error>;
7386pub type StorageAdminListStorageInRealmResult = Result<(), fidl_fuchsia_component::Error>;
7387pub type StorageAdminOpenComponentStorageByIdResult = Result<(), fidl_fuchsia_component::Error>;
7388pub type StorageAdminDeleteComponentStorageResult = Result<(), fidl_fuchsia_component::Error>;
7389pub type StorageAdminGetStatusResult = Result<StorageStatus, StatusError>;
7390pub type StorageAdminDeleteAllStorageContentsResult = Result<(), DeletionError>;
7391
7392pub trait StorageAdminProxyInterface: Send + Sync {
7393    type OpenStorageResponseFut: std::future::Future<Output = Result<StorageAdminOpenStorageResult, fidl::Error>>
7394        + Send;
7395    fn r#open_storage(
7396        &self,
7397        relative_moniker: &str,
7398        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7399    ) -> Self::OpenStorageResponseFut;
7400    type ListStorageInRealmResponseFut: std::future::Future<Output = Result<StorageAdminListStorageInRealmResult, fidl::Error>>
7401        + Send;
7402    fn r#list_storage_in_realm(
7403        &self,
7404        relative_moniker: &str,
7405        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7406    ) -> Self::ListStorageInRealmResponseFut;
7407    type OpenComponentStorageByIdResponseFut: std::future::Future<
7408            Output = Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error>,
7409        > + Send;
7410    fn r#open_component_storage_by_id(
7411        &self,
7412        id: &str,
7413        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7414    ) -> Self::OpenComponentStorageByIdResponseFut;
7415    type DeleteComponentStorageResponseFut: std::future::Future<Output = Result<StorageAdminDeleteComponentStorageResult, fidl::Error>>
7416        + Send;
7417    fn r#delete_component_storage(
7418        &self,
7419        relative_moniker: &str,
7420    ) -> Self::DeleteComponentStorageResponseFut;
7421    type GetStatusResponseFut: std::future::Future<Output = Result<StorageAdminGetStatusResult, fidl::Error>>
7422        + Send;
7423    fn r#get_status(&self) -> Self::GetStatusResponseFut;
7424    type DeleteAllStorageContentsResponseFut: std::future::Future<
7425            Output = Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error>,
7426        > + Send;
7427    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut;
7428}
7429#[derive(Debug)]
7430#[cfg(target_os = "fuchsia")]
7431pub struct StorageAdminSynchronousProxy {
7432    client: fidl::client::sync::Client,
7433}
7434
7435#[cfg(target_os = "fuchsia")]
7436impl fidl::endpoints::SynchronousProxy for StorageAdminSynchronousProxy {
7437    type Proxy = StorageAdminProxy;
7438    type Protocol = StorageAdminMarker;
7439
7440    fn from_channel(inner: fidl::Channel) -> Self {
7441        Self::new(inner)
7442    }
7443
7444    fn into_channel(self) -> fidl::Channel {
7445        self.client.into_channel()
7446    }
7447
7448    fn as_channel(&self) -> &fidl::Channel {
7449        self.client.as_channel()
7450    }
7451}
7452
7453#[cfg(target_os = "fuchsia")]
7454impl StorageAdminSynchronousProxy {
7455    pub fn new(channel: fidl::Channel) -> Self {
7456        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7457        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7458    }
7459
7460    pub fn into_channel(self) -> fidl::Channel {
7461        self.client.into_channel()
7462    }
7463
7464    /// Waits until an event arrives and returns it. It is safe for other
7465    /// threads to make concurrent requests while waiting for an event.
7466    pub fn wait_for_event(
7467        &self,
7468        deadline: zx::MonotonicInstant,
7469    ) -> Result<StorageAdminEvent, fidl::Error> {
7470        StorageAdminEvent::decode(self.client.wait_for_event(deadline)?)
7471    }
7472
7473    /// Opens the isolated directory for the given component. The open request will provision
7474    /// the storage if it hasn't been already.
7475    pub fn r#open_storage(
7476        &self,
7477        mut relative_moniker: &str,
7478        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7479        ___deadline: zx::MonotonicInstant,
7480    ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
7481        let _response =
7482            self.client.send_query::<StorageAdminOpenStorageRequest, fidl::encoding::ResultType<
7483                fidl::encoding::EmptyStruct,
7484                fidl_fuchsia_component::Error,
7485            >>(
7486                (relative_moniker, object),
7487                0x6ceaa5904cfe4377,
7488                fidl::encoding::DynamicFlags::empty(),
7489                ___deadline,
7490            )?;
7491        Ok(_response.map(|x| x))
7492    }
7493
7494    /// Lists the descendant components under the specified realm that use the storage
7495    /// capability.
7496    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS if
7497    /// |relative_moniker| is malformed.
7498    pub fn r#list_storage_in_realm(
7499        &self,
7500        mut relative_moniker: &str,
7501        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7502        ___deadline: zx::MonotonicInstant,
7503    ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
7504        let _response = self
7505            .client
7506            .send_query::<StorageAdminListStorageInRealmRequest, fidl::encoding::ResultType<
7507                fidl::encoding::EmptyStruct,
7508                fidl_fuchsia_component::Error,
7509            >>(
7510                (relative_moniker, iterator),
7511                0x764f6d1f083e8bfb,
7512                fidl::encoding::DynamicFlags::empty(),
7513                ___deadline,
7514            )?;
7515        Ok(_response.map(|x| x))
7516    }
7517
7518    /// Opens the isolated directory for the given storage ID. The open request will provision
7519    /// the storage if it hasn't been already.
7520    pub fn r#open_component_storage_by_id(
7521        &self,
7522        mut id: &str,
7523        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7524        ___deadline: zx::MonotonicInstant,
7525    ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
7526        let _response = self
7527            .client
7528            .send_query::<StorageAdminOpenComponentStorageByIdRequest, fidl::encoding::ResultType<
7529                fidl::encoding::EmptyStruct,
7530                fidl_fuchsia_component::Error,
7531            >>(
7532                (id, object),
7533                0x4802102cc55d5df1,
7534                fidl::encoding::DynamicFlags::empty(),
7535                ___deadline,
7536            )?;
7537        Ok(_response.map(|x| x))
7538    }
7539
7540    /// Deletes the contents of the storage for this component. The moniker can be a regular
7541    /// moniker (ie, "foo/bar") or a moniker with internal instance IDs (unusual, ie, "foo:0/bar:0").
7542    /// Preserves the component's subdirectory itself within the storage backing directory.
7543    pub fn r#delete_component_storage(
7544        &self,
7545        mut relative_moniker: &str,
7546        ___deadline: zx::MonotonicInstant,
7547    ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
7548        let _response = self
7549            .client
7550            .send_query::<StorageAdminDeleteComponentStorageRequest, fidl::encoding::ResultType<
7551                fidl::encoding::EmptyStruct,
7552                fidl_fuchsia_component::Error,
7553            >>(
7554                (relative_moniker,),
7555                0x1677c1cdfcdbf45a,
7556                fidl::encoding::DynamicFlags::empty(),
7557                ___deadline,
7558            )?;
7559        Ok(_response.map(|x| x))
7560    }
7561
7562    /// Get the current status of the storage.
7563    pub fn r#get_status(
7564        &self,
7565        ___deadline: zx::MonotonicInstant,
7566    ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
7567        let _response = self.client.send_query::<
7568            fidl::encoding::EmptyPayload,
7569            fidl::encoding::ResultType<StorageStatus, StatusError>,
7570        >(
7571            (),
7572            0x7729e325a6c526c8,
7573            fidl::encoding::DynamicFlags::empty(),
7574            ___deadline,
7575        )?;
7576        Ok(_response.map(|x| x))
7577    }
7578
7579    /// Deletes the contents of all the storage. Storage directories are retained so any components
7580    /// using storage will be able to continue using it to create new files and directories.
7581    /// Returns fuchsia.component.Error::INTERNAL only if no storage at all could be cleared.
7582    /// Returns successfully even if some errors happen during the deletion progress.
7583    pub fn r#delete_all_storage_contents(
7584        &self,
7585        ___deadline: zx::MonotonicInstant,
7586    ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
7587        let _response = self.client.send_query::<
7588            fidl::encoding::EmptyPayload,
7589            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
7590        >(
7591            (),
7592            0x2ee980b4b2d24adb,
7593            fidl::encoding::DynamicFlags::empty(),
7594            ___deadline,
7595        )?;
7596        Ok(_response.map(|x| x))
7597    }
7598}
7599
7600#[cfg(target_os = "fuchsia")]
7601impl From<StorageAdminSynchronousProxy> for zx::NullableHandle {
7602    fn from(value: StorageAdminSynchronousProxy) -> Self {
7603        value.into_channel().into()
7604    }
7605}
7606
7607#[cfg(target_os = "fuchsia")]
7608impl From<fidl::Channel> for StorageAdminSynchronousProxy {
7609    fn from(value: fidl::Channel) -> Self {
7610        Self::new(value)
7611    }
7612}
7613
7614#[cfg(target_os = "fuchsia")]
7615impl fidl::endpoints::FromClient for StorageAdminSynchronousProxy {
7616    type Protocol = StorageAdminMarker;
7617
7618    fn from_client(value: fidl::endpoints::ClientEnd<StorageAdminMarker>) -> Self {
7619        Self::new(value.into_channel())
7620    }
7621}
7622
7623#[derive(Debug, Clone)]
7624pub struct StorageAdminProxy {
7625    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7626}
7627
7628impl fidl::endpoints::Proxy for StorageAdminProxy {
7629    type Protocol = StorageAdminMarker;
7630
7631    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7632        Self::new(inner)
7633    }
7634
7635    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7636        self.client.into_channel().map_err(|client| Self { client })
7637    }
7638
7639    fn as_channel(&self) -> &::fidl::AsyncChannel {
7640        self.client.as_channel()
7641    }
7642}
7643
7644impl StorageAdminProxy {
7645    /// Create a new Proxy for fuchsia.sys2/StorageAdmin.
7646    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7647        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7648        Self { client: fidl::client::Client::new(channel, protocol_name) }
7649    }
7650
7651    /// Get a Stream of events from the remote end of the protocol.
7652    ///
7653    /// # Panics
7654    ///
7655    /// Panics if the event stream was already taken.
7656    pub fn take_event_stream(&self) -> StorageAdminEventStream {
7657        StorageAdminEventStream { event_receiver: self.client.take_event_receiver() }
7658    }
7659
7660    /// Opens the isolated directory for the given component. The open request will provision
7661    /// the storage if it hasn't been already.
7662    pub fn r#open_storage(
7663        &self,
7664        mut relative_moniker: &str,
7665        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7666    ) -> fidl::client::QueryResponseFut<
7667        StorageAdminOpenStorageResult,
7668        fidl::encoding::DefaultFuchsiaResourceDialect,
7669    > {
7670        StorageAdminProxyInterface::r#open_storage(self, relative_moniker, object)
7671    }
7672
7673    /// Lists the descendant components under the specified realm that use the storage
7674    /// capability.
7675    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS if
7676    /// |relative_moniker| is malformed.
7677    pub fn r#list_storage_in_realm(
7678        &self,
7679        mut relative_moniker: &str,
7680        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7681    ) -> fidl::client::QueryResponseFut<
7682        StorageAdminListStorageInRealmResult,
7683        fidl::encoding::DefaultFuchsiaResourceDialect,
7684    > {
7685        StorageAdminProxyInterface::r#list_storage_in_realm(self, relative_moniker, iterator)
7686    }
7687
7688    /// Opens the isolated directory for the given storage ID. The open request will provision
7689    /// the storage if it hasn't been already.
7690    pub fn r#open_component_storage_by_id(
7691        &self,
7692        mut id: &str,
7693        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7694    ) -> fidl::client::QueryResponseFut<
7695        StorageAdminOpenComponentStorageByIdResult,
7696        fidl::encoding::DefaultFuchsiaResourceDialect,
7697    > {
7698        StorageAdminProxyInterface::r#open_component_storage_by_id(self, id, object)
7699    }
7700
7701    /// Deletes the contents of the storage for this component. The moniker can be a regular
7702    /// moniker (ie, "foo/bar") or a moniker with internal instance IDs (unusual, ie, "foo:0/bar:0").
7703    /// Preserves the component's subdirectory itself within the storage backing directory.
7704    pub fn r#delete_component_storage(
7705        &self,
7706        mut relative_moniker: &str,
7707    ) -> fidl::client::QueryResponseFut<
7708        StorageAdminDeleteComponentStorageResult,
7709        fidl::encoding::DefaultFuchsiaResourceDialect,
7710    > {
7711        StorageAdminProxyInterface::r#delete_component_storage(self, relative_moniker)
7712    }
7713
7714    /// Get the current status of the storage.
7715    pub fn r#get_status(
7716        &self,
7717    ) -> fidl::client::QueryResponseFut<
7718        StorageAdminGetStatusResult,
7719        fidl::encoding::DefaultFuchsiaResourceDialect,
7720    > {
7721        StorageAdminProxyInterface::r#get_status(self)
7722    }
7723
7724    /// Deletes the contents of all the storage. Storage directories are retained so any components
7725    /// using storage will be able to continue using it to create new files and directories.
7726    /// Returns fuchsia.component.Error::INTERNAL only if no storage at all could be cleared.
7727    /// Returns successfully even if some errors happen during the deletion progress.
7728    pub fn r#delete_all_storage_contents(
7729        &self,
7730    ) -> fidl::client::QueryResponseFut<
7731        StorageAdminDeleteAllStorageContentsResult,
7732        fidl::encoding::DefaultFuchsiaResourceDialect,
7733    > {
7734        StorageAdminProxyInterface::r#delete_all_storage_contents(self)
7735    }
7736}
7737
7738impl StorageAdminProxyInterface for StorageAdminProxy {
7739    type OpenStorageResponseFut = fidl::client::QueryResponseFut<
7740        StorageAdminOpenStorageResult,
7741        fidl::encoding::DefaultFuchsiaResourceDialect,
7742    >;
7743    fn r#open_storage(
7744        &self,
7745        mut relative_moniker: &str,
7746        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7747    ) -> Self::OpenStorageResponseFut {
7748        fn _decode(
7749            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7750        ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
7751            let _response = fidl::client::decode_transaction_body::<
7752                fidl::encoding::ResultType<
7753                    fidl::encoding::EmptyStruct,
7754                    fidl_fuchsia_component::Error,
7755                >,
7756                fidl::encoding::DefaultFuchsiaResourceDialect,
7757                0x6ceaa5904cfe4377,
7758            >(_buf?)?;
7759            Ok(_response.map(|x| x))
7760        }
7761        self.client
7762            .send_query_and_decode::<StorageAdminOpenStorageRequest, StorageAdminOpenStorageResult>(
7763                (relative_moniker, object),
7764                0x6ceaa5904cfe4377,
7765                fidl::encoding::DynamicFlags::empty(),
7766                _decode,
7767            )
7768    }
7769
7770    type ListStorageInRealmResponseFut = fidl::client::QueryResponseFut<
7771        StorageAdminListStorageInRealmResult,
7772        fidl::encoding::DefaultFuchsiaResourceDialect,
7773    >;
7774    fn r#list_storage_in_realm(
7775        &self,
7776        mut relative_moniker: &str,
7777        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7778    ) -> Self::ListStorageInRealmResponseFut {
7779        fn _decode(
7780            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7781        ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
7782            let _response = fidl::client::decode_transaction_body::<
7783                fidl::encoding::ResultType<
7784                    fidl::encoding::EmptyStruct,
7785                    fidl_fuchsia_component::Error,
7786                >,
7787                fidl::encoding::DefaultFuchsiaResourceDialect,
7788                0x764f6d1f083e8bfb,
7789            >(_buf?)?;
7790            Ok(_response.map(|x| x))
7791        }
7792        self.client.send_query_and_decode::<
7793            StorageAdminListStorageInRealmRequest,
7794            StorageAdminListStorageInRealmResult,
7795        >(
7796            (relative_moniker, iterator,),
7797            0x764f6d1f083e8bfb,
7798            fidl::encoding::DynamicFlags::empty(),
7799            _decode,
7800        )
7801    }
7802
7803    type OpenComponentStorageByIdResponseFut = fidl::client::QueryResponseFut<
7804        StorageAdminOpenComponentStorageByIdResult,
7805        fidl::encoding::DefaultFuchsiaResourceDialect,
7806    >;
7807    fn r#open_component_storage_by_id(
7808        &self,
7809        mut id: &str,
7810        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7811    ) -> Self::OpenComponentStorageByIdResponseFut {
7812        fn _decode(
7813            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7814        ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
7815            let _response = fidl::client::decode_transaction_body::<
7816                fidl::encoding::ResultType<
7817                    fidl::encoding::EmptyStruct,
7818                    fidl_fuchsia_component::Error,
7819                >,
7820                fidl::encoding::DefaultFuchsiaResourceDialect,
7821                0x4802102cc55d5df1,
7822            >(_buf?)?;
7823            Ok(_response.map(|x| x))
7824        }
7825        self.client.send_query_and_decode::<
7826            StorageAdminOpenComponentStorageByIdRequest,
7827            StorageAdminOpenComponentStorageByIdResult,
7828        >(
7829            (id, object,),
7830            0x4802102cc55d5df1,
7831            fidl::encoding::DynamicFlags::empty(),
7832            _decode,
7833        )
7834    }
7835
7836    type DeleteComponentStorageResponseFut = fidl::client::QueryResponseFut<
7837        StorageAdminDeleteComponentStorageResult,
7838        fidl::encoding::DefaultFuchsiaResourceDialect,
7839    >;
7840    fn r#delete_component_storage(
7841        &self,
7842        mut relative_moniker: &str,
7843    ) -> Self::DeleteComponentStorageResponseFut {
7844        fn _decode(
7845            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7846        ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
7847            let _response = fidl::client::decode_transaction_body::<
7848                fidl::encoding::ResultType<
7849                    fidl::encoding::EmptyStruct,
7850                    fidl_fuchsia_component::Error,
7851                >,
7852                fidl::encoding::DefaultFuchsiaResourceDialect,
7853                0x1677c1cdfcdbf45a,
7854            >(_buf?)?;
7855            Ok(_response.map(|x| x))
7856        }
7857        self.client.send_query_and_decode::<
7858            StorageAdminDeleteComponentStorageRequest,
7859            StorageAdminDeleteComponentStorageResult,
7860        >(
7861            (relative_moniker,),
7862            0x1677c1cdfcdbf45a,
7863            fidl::encoding::DynamicFlags::empty(),
7864            _decode,
7865        )
7866    }
7867
7868    type GetStatusResponseFut = fidl::client::QueryResponseFut<
7869        StorageAdminGetStatusResult,
7870        fidl::encoding::DefaultFuchsiaResourceDialect,
7871    >;
7872    fn r#get_status(&self) -> Self::GetStatusResponseFut {
7873        fn _decode(
7874            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7875        ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
7876            let _response = fidl::client::decode_transaction_body::<
7877                fidl::encoding::ResultType<StorageStatus, StatusError>,
7878                fidl::encoding::DefaultFuchsiaResourceDialect,
7879                0x7729e325a6c526c8,
7880            >(_buf?)?;
7881            Ok(_response.map(|x| x))
7882        }
7883        self.client
7884            .send_query_and_decode::<fidl::encoding::EmptyPayload, StorageAdminGetStatusResult>(
7885                (),
7886                0x7729e325a6c526c8,
7887                fidl::encoding::DynamicFlags::empty(),
7888                _decode,
7889            )
7890    }
7891
7892    type DeleteAllStorageContentsResponseFut = fidl::client::QueryResponseFut<
7893        StorageAdminDeleteAllStorageContentsResult,
7894        fidl::encoding::DefaultFuchsiaResourceDialect,
7895    >;
7896    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut {
7897        fn _decode(
7898            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7899        ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
7900            let _response = fidl::client::decode_transaction_body::<
7901                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
7902                fidl::encoding::DefaultFuchsiaResourceDialect,
7903                0x2ee980b4b2d24adb,
7904            >(_buf?)?;
7905            Ok(_response.map(|x| x))
7906        }
7907        self.client.send_query_and_decode::<
7908            fidl::encoding::EmptyPayload,
7909            StorageAdminDeleteAllStorageContentsResult,
7910        >(
7911            (),
7912            0x2ee980b4b2d24adb,
7913            fidl::encoding::DynamicFlags::empty(),
7914            _decode,
7915        )
7916    }
7917}
7918
7919pub struct StorageAdminEventStream {
7920    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7921}
7922
7923impl std::marker::Unpin for StorageAdminEventStream {}
7924
7925impl futures::stream::FusedStream for StorageAdminEventStream {
7926    fn is_terminated(&self) -> bool {
7927        self.event_receiver.is_terminated()
7928    }
7929}
7930
7931impl futures::Stream for StorageAdminEventStream {
7932    type Item = Result<StorageAdminEvent, fidl::Error>;
7933
7934    fn poll_next(
7935        mut self: std::pin::Pin<&mut Self>,
7936        cx: &mut std::task::Context<'_>,
7937    ) -> std::task::Poll<Option<Self::Item>> {
7938        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7939            &mut self.event_receiver,
7940            cx
7941        )?) {
7942            Some(buf) => std::task::Poll::Ready(Some(StorageAdminEvent::decode(buf))),
7943            None => std::task::Poll::Ready(None),
7944        }
7945    }
7946}
7947
7948#[derive(Debug)]
7949pub enum StorageAdminEvent {}
7950
7951impl StorageAdminEvent {
7952    /// Decodes a message buffer as a [`StorageAdminEvent`].
7953    fn decode(
7954        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7955    ) -> Result<StorageAdminEvent, fidl::Error> {
7956        let (bytes, _handles) = buf.split_mut();
7957        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7958        debug_assert_eq!(tx_header.tx_id, 0);
7959        match tx_header.ordinal {
7960            _ => Err(fidl::Error::UnknownOrdinal {
7961                ordinal: tx_header.ordinal,
7962                protocol_name: <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7963            }),
7964        }
7965    }
7966}
7967
7968/// A Stream of incoming requests for fuchsia.sys2/StorageAdmin.
7969pub struct StorageAdminRequestStream {
7970    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7971    is_terminated: bool,
7972}
7973
7974impl std::marker::Unpin for StorageAdminRequestStream {}
7975
7976impl futures::stream::FusedStream for StorageAdminRequestStream {
7977    fn is_terminated(&self) -> bool {
7978        self.is_terminated
7979    }
7980}
7981
7982impl fidl::endpoints::RequestStream for StorageAdminRequestStream {
7983    type Protocol = StorageAdminMarker;
7984    type ControlHandle = StorageAdminControlHandle;
7985
7986    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7987        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7988    }
7989
7990    fn control_handle(&self) -> Self::ControlHandle {
7991        StorageAdminControlHandle { inner: self.inner.clone() }
7992    }
7993
7994    fn into_inner(
7995        self,
7996    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7997    {
7998        (self.inner, self.is_terminated)
7999    }
8000
8001    fn from_inner(
8002        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8003        is_terminated: bool,
8004    ) -> Self {
8005        Self { inner, is_terminated }
8006    }
8007}
8008
8009impl futures::Stream for StorageAdminRequestStream {
8010    type Item = Result<StorageAdminRequest, fidl::Error>;
8011
8012    fn poll_next(
8013        mut self: std::pin::Pin<&mut Self>,
8014        cx: &mut std::task::Context<'_>,
8015    ) -> std::task::Poll<Option<Self::Item>> {
8016        let this = &mut *self;
8017        if this.inner.check_shutdown(cx) {
8018            this.is_terminated = true;
8019            return std::task::Poll::Ready(None);
8020        }
8021        if this.is_terminated {
8022            panic!("polled StorageAdminRequestStream after completion");
8023        }
8024        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8025            |bytes, handles| {
8026                match this.inner.channel().read_etc(cx, bytes, handles) {
8027                    std::task::Poll::Ready(Ok(())) => {}
8028                    std::task::Poll::Pending => return std::task::Poll::Pending,
8029                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8030                        this.is_terminated = true;
8031                        return std::task::Poll::Ready(None);
8032                    }
8033                    std::task::Poll::Ready(Err(e)) => {
8034                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8035                            e.into(),
8036                        ))));
8037                    }
8038                }
8039
8040                // A message has been received from the channel
8041                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8042
8043                std::task::Poll::Ready(Some(match header.ordinal {
8044                    0x6ceaa5904cfe4377 => {
8045                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8046                        let mut req = fidl::new_empty!(
8047                            StorageAdminOpenStorageRequest,
8048                            fidl::encoding::DefaultFuchsiaResourceDialect
8049                        );
8050                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenStorageRequest>(&header, _body_bytes, handles, &mut req)?;
8051                        let control_handle =
8052                            StorageAdminControlHandle { inner: this.inner.clone() };
8053                        Ok(StorageAdminRequest::OpenStorage {
8054                            relative_moniker: req.relative_moniker,
8055                            object: req.object,
8056
8057                            responder: StorageAdminOpenStorageResponder {
8058                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8059                                tx_id: header.tx_id,
8060                            },
8061                        })
8062                    }
8063                    0x764f6d1f083e8bfb => {
8064                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8065                        let mut req = fidl::new_empty!(
8066                            StorageAdminListStorageInRealmRequest,
8067                            fidl::encoding::DefaultFuchsiaResourceDialect
8068                        );
8069                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminListStorageInRealmRequest>(&header, _body_bytes, handles, &mut req)?;
8070                        let control_handle =
8071                            StorageAdminControlHandle { inner: this.inner.clone() };
8072                        Ok(StorageAdminRequest::ListStorageInRealm {
8073                            relative_moniker: req.relative_moniker,
8074                            iterator: req.iterator,
8075
8076                            responder: StorageAdminListStorageInRealmResponder {
8077                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8078                                tx_id: header.tx_id,
8079                            },
8080                        })
8081                    }
8082                    0x4802102cc55d5df1 => {
8083                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8084                        let mut req = fidl::new_empty!(
8085                            StorageAdminOpenComponentStorageByIdRequest,
8086                            fidl::encoding::DefaultFuchsiaResourceDialect
8087                        );
8088                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenComponentStorageByIdRequest>(&header, _body_bytes, handles, &mut req)?;
8089                        let control_handle =
8090                            StorageAdminControlHandle { inner: this.inner.clone() };
8091                        Ok(StorageAdminRequest::OpenComponentStorageById {
8092                            id: req.id,
8093                            object: req.object,
8094
8095                            responder: StorageAdminOpenComponentStorageByIdResponder {
8096                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8097                                tx_id: header.tx_id,
8098                            },
8099                        })
8100                    }
8101                    0x1677c1cdfcdbf45a => {
8102                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8103                        let mut req = fidl::new_empty!(
8104                            StorageAdminDeleteComponentStorageRequest,
8105                            fidl::encoding::DefaultFuchsiaResourceDialect
8106                        );
8107                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminDeleteComponentStorageRequest>(&header, _body_bytes, handles, &mut req)?;
8108                        let control_handle =
8109                            StorageAdminControlHandle { inner: this.inner.clone() };
8110                        Ok(StorageAdminRequest::DeleteComponentStorage {
8111                            relative_moniker: req.relative_moniker,
8112
8113                            responder: StorageAdminDeleteComponentStorageResponder {
8114                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8115                                tx_id: header.tx_id,
8116                            },
8117                        })
8118                    }
8119                    0x7729e325a6c526c8 => {
8120                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8121                        let mut req = fidl::new_empty!(
8122                            fidl::encoding::EmptyPayload,
8123                            fidl::encoding::DefaultFuchsiaResourceDialect
8124                        );
8125                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8126                        let control_handle =
8127                            StorageAdminControlHandle { inner: this.inner.clone() };
8128                        Ok(StorageAdminRequest::GetStatus {
8129                            responder: StorageAdminGetStatusResponder {
8130                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8131                                tx_id: header.tx_id,
8132                            },
8133                        })
8134                    }
8135                    0x2ee980b4b2d24adb => {
8136                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8137                        let mut req = fidl::new_empty!(
8138                            fidl::encoding::EmptyPayload,
8139                            fidl::encoding::DefaultFuchsiaResourceDialect
8140                        );
8141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8142                        let control_handle =
8143                            StorageAdminControlHandle { inner: this.inner.clone() };
8144                        Ok(StorageAdminRequest::DeleteAllStorageContents {
8145                            responder: StorageAdminDeleteAllStorageContentsResponder {
8146                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8147                                tx_id: header.tx_id,
8148                            },
8149                        })
8150                    }
8151                    _ => Err(fidl::Error::UnknownOrdinal {
8152                        ordinal: header.ordinal,
8153                        protocol_name:
8154                            <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8155                    }),
8156                }))
8157            },
8158        )
8159    }
8160}
8161
8162#[derive(Debug)]
8163pub enum StorageAdminRequest {
8164    /// Opens the isolated directory for the given component. The open request will provision
8165    /// the storage if it hasn't been already.
8166    OpenStorage {
8167        relative_moniker: String,
8168        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
8169        responder: StorageAdminOpenStorageResponder,
8170    },
8171    /// Lists the descendant components under the specified realm that use the storage
8172    /// capability.
8173    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS if
8174    /// |relative_moniker| is malformed.
8175    ListStorageInRealm {
8176        relative_moniker: String,
8177        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
8178        responder: StorageAdminListStorageInRealmResponder,
8179    },
8180    /// Opens the isolated directory for the given storage ID. The open request will provision
8181    /// the storage if it hasn't been already.
8182    OpenComponentStorageById {
8183        id: String,
8184        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
8185        responder: StorageAdminOpenComponentStorageByIdResponder,
8186    },
8187    /// Deletes the contents of the storage for this component. The moniker can be a regular
8188    /// moniker (ie, "foo/bar") or a moniker with internal instance IDs (unusual, ie, "foo:0/bar:0").
8189    /// Preserves the component's subdirectory itself within the storage backing directory.
8190    DeleteComponentStorage {
8191        relative_moniker: String,
8192        responder: StorageAdminDeleteComponentStorageResponder,
8193    },
8194    /// Get the current status of the storage.
8195    GetStatus { responder: StorageAdminGetStatusResponder },
8196    /// Deletes the contents of all the storage. Storage directories are retained so any components
8197    /// using storage will be able to continue using it to create new files and directories.
8198    /// Returns fuchsia.component.Error::INTERNAL only if no storage at all could be cleared.
8199    /// Returns successfully even if some errors happen during the deletion progress.
8200    DeleteAllStorageContents { responder: StorageAdminDeleteAllStorageContentsResponder },
8201}
8202
8203impl StorageAdminRequest {
8204    #[allow(irrefutable_let_patterns)]
8205    pub fn into_open_storage(
8206        self,
8207    ) -> Option<(
8208        String,
8209        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
8210        StorageAdminOpenStorageResponder,
8211    )> {
8212        if let StorageAdminRequest::OpenStorage { relative_moniker, object, responder } = self {
8213            Some((relative_moniker, object, responder))
8214        } else {
8215            None
8216        }
8217    }
8218
8219    #[allow(irrefutable_let_patterns)]
8220    pub fn into_list_storage_in_realm(
8221        self,
8222    ) -> Option<(
8223        String,
8224        fidl::endpoints::ServerEnd<StorageIteratorMarker>,
8225        StorageAdminListStorageInRealmResponder,
8226    )> {
8227        if let StorageAdminRequest::ListStorageInRealm { relative_moniker, iterator, responder } =
8228            self
8229        {
8230            Some((relative_moniker, iterator, responder))
8231        } else {
8232            None
8233        }
8234    }
8235
8236    #[allow(irrefutable_let_patterns)]
8237    pub fn into_open_component_storage_by_id(
8238        self,
8239    ) -> Option<(
8240        String,
8241        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
8242        StorageAdminOpenComponentStorageByIdResponder,
8243    )> {
8244        if let StorageAdminRequest::OpenComponentStorageById { id, object, responder } = self {
8245            Some((id, object, responder))
8246        } else {
8247            None
8248        }
8249    }
8250
8251    #[allow(irrefutable_let_patterns)]
8252    pub fn into_delete_component_storage(
8253        self,
8254    ) -> Option<(String, StorageAdminDeleteComponentStorageResponder)> {
8255        if let StorageAdminRequest::DeleteComponentStorage { relative_moniker, responder } = self {
8256            Some((relative_moniker, responder))
8257        } else {
8258            None
8259        }
8260    }
8261
8262    #[allow(irrefutable_let_patterns)]
8263    pub fn into_get_status(self) -> Option<(StorageAdminGetStatusResponder)> {
8264        if let StorageAdminRequest::GetStatus { responder } = self {
8265            Some((responder))
8266        } else {
8267            None
8268        }
8269    }
8270
8271    #[allow(irrefutable_let_patterns)]
8272    pub fn into_delete_all_storage_contents(
8273        self,
8274    ) -> Option<(StorageAdminDeleteAllStorageContentsResponder)> {
8275        if let StorageAdminRequest::DeleteAllStorageContents { responder } = self {
8276            Some((responder))
8277        } else {
8278            None
8279        }
8280    }
8281
8282    /// Name of the method defined in FIDL
8283    pub fn method_name(&self) -> &'static str {
8284        match *self {
8285            StorageAdminRequest::OpenStorage { .. } => "open_storage",
8286            StorageAdminRequest::ListStorageInRealm { .. } => "list_storage_in_realm",
8287            StorageAdminRequest::OpenComponentStorageById { .. } => "open_component_storage_by_id",
8288            StorageAdminRequest::DeleteComponentStorage { .. } => "delete_component_storage",
8289            StorageAdminRequest::GetStatus { .. } => "get_status",
8290            StorageAdminRequest::DeleteAllStorageContents { .. } => "delete_all_storage_contents",
8291        }
8292    }
8293}
8294
8295#[derive(Debug, Clone)]
8296pub struct StorageAdminControlHandle {
8297    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8298}
8299
8300impl fidl::endpoints::ControlHandle for StorageAdminControlHandle {
8301    fn shutdown(&self) {
8302        self.inner.shutdown()
8303    }
8304
8305    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8306        self.inner.shutdown_with_epitaph(status)
8307    }
8308
8309    fn is_closed(&self) -> bool {
8310        self.inner.channel().is_closed()
8311    }
8312    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8313        self.inner.channel().on_closed()
8314    }
8315
8316    #[cfg(target_os = "fuchsia")]
8317    fn signal_peer(
8318        &self,
8319        clear_mask: zx::Signals,
8320        set_mask: zx::Signals,
8321    ) -> Result<(), zx_status::Status> {
8322        use fidl::Peered;
8323        self.inner.channel().signal_peer(clear_mask, set_mask)
8324    }
8325}
8326
8327impl StorageAdminControlHandle {}
8328
8329#[must_use = "FIDL methods require a response to be sent"]
8330#[derive(Debug)]
8331pub struct StorageAdminOpenStorageResponder {
8332    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8333    tx_id: u32,
8334}
8335
8336/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8337/// if the responder is dropped without sending a response, so that the client
8338/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8339impl std::ops::Drop for StorageAdminOpenStorageResponder {
8340    fn drop(&mut self) {
8341        self.control_handle.shutdown();
8342        // Safety: drops once, never accessed again
8343        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8344    }
8345}
8346
8347impl fidl::endpoints::Responder for StorageAdminOpenStorageResponder {
8348    type ControlHandle = StorageAdminControlHandle;
8349
8350    fn control_handle(&self) -> &StorageAdminControlHandle {
8351        &self.control_handle
8352    }
8353
8354    fn drop_without_shutdown(mut self) {
8355        // Safety: drops once, never accessed again due to mem::forget
8356        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8357        // Prevent Drop from running (which would shut down the channel)
8358        std::mem::forget(self);
8359    }
8360}
8361
8362impl StorageAdminOpenStorageResponder {
8363    /// Sends a response to the FIDL transaction.
8364    ///
8365    /// Sets the channel to shutdown if an error occurs.
8366    pub fn send(
8367        self,
8368        mut result: Result<(), fidl_fuchsia_component::Error>,
8369    ) -> Result<(), fidl::Error> {
8370        let _result = self.send_raw(result);
8371        if _result.is_err() {
8372            self.control_handle.shutdown();
8373        }
8374        self.drop_without_shutdown();
8375        _result
8376    }
8377
8378    /// Similar to "send" but does not shutdown the channel if an error occurs.
8379    pub fn send_no_shutdown_on_err(
8380        self,
8381        mut result: Result<(), fidl_fuchsia_component::Error>,
8382    ) -> Result<(), fidl::Error> {
8383        let _result = self.send_raw(result);
8384        self.drop_without_shutdown();
8385        _result
8386    }
8387
8388    fn send_raw(
8389        &self,
8390        mut result: Result<(), fidl_fuchsia_component::Error>,
8391    ) -> Result<(), fidl::Error> {
8392        self.control_handle.inner.send::<fidl::encoding::ResultType<
8393            fidl::encoding::EmptyStruct,
8394            fidl_fuchsia_component::Error,
8395        >>(
8396            result,
8397            self.tx_id,
8398            0x6ceaa5904cfe4377,
8399            fidl::encoding::DynamicFlags::empty(),
8400        )
8401    }
8402}
8403
8404#[must_use = "FIDL methods require a response to be sent"]
8405#[derive(Debug)]
8406pub struct StorageAdminListStorageInRealmResponder {
8407    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8408    tx_id: u32,
8409}
8410
8411/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8412/// if the responder is dropped without sending a response, so that the client
8413/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8414impl std::ops::Drop for StorageAdminListStorageInRealmResponder {
8415    fn drop(&mut self) {
8416        self.control_handle.shutdown();
8417        // Safety: drops once, never accessed again
8418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8419    }
8420}
8421
8422impl fidl::endpoints::Responder for StorageAdminListStorageInRealmResponder {
8423    type ControlHandle = StorageAdminControlHandle;
8424
8425    fn control_handle(&self) -> &StorageAdminControlHandle {
8426        &self.control_handle
8427    }
8428
8429    fn drop_without_shutdown(mut self) {
8430        // Safety: drops once, never accessed again due to mem::forget
8431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8432        // Prevent Drop from running (which would shut down the channel)
8433        std::mem::forget(self);
8434    }
8435}
8436
8437impl StorageAdminListStorageInRealmResponder {
8438    /// Sends a response to the FIDL transaction.
8439    ///
8440    /// Sets the channel to shutdown if an error occurs.
8441    pub fn send(
8442        self,
8443        mut result: Result<(), fidl_fuchsia_component::Error>,
8444    ) -> Result<(), fidl::Error> {
8445        let _result = self.send_raw(result);
8446        if _result.is_err() {
8447            self.control_handle.shutdown();
8448        }
8449        self.drop_without_shutdown();
8450        _result
8451    }
8452
8453    /// Similar to "send" but does not shutdown the channel if an error occurs.
8454    pub fn send_no_shutdown_on_err(
8455        self,
8456        mut result: Result<(), fidl_fuchsia_component::Error>,
8457    ) -> Result<(), fidl::Error> {
8458        let _result = self.send_raw(result);
8459        self.drop_without_shutdown();
8460        _result
8461    }
8462
8463    fn send_raw(
8464        &self,
8465        mut result: Result<(), fidl_fuchsia_component::Error>,
8466    ) -> Result<(), fidl::Error> {
8467        self.control_handle.inner.send::<fidl::encoding::ResultType<
8468            fidl::encoding::EmptyStruct,
8469            fidl_fuchsia_component::Error,
8470        >>(
8471            result,
8472            self.tx_id,
8473            0x764f6d1f083e8bfb,
8474            fidl::encoding::DynamicFlags::empty(),
8475        )
8476    }
8477}
8478
8479#[must_use = "FIDL methods require a response to be sent"]
8480#[derive(Debug)]
8481pub struct StorageAdminOpenComponentStorageByIdResponder {
8482    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8483    tx_id: u32,
8484}
8485
8486/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8487/// if the responder is dropped without sending a response, so that the client
8488/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8489impl std::ops::Drop for StorageAdminOpenComponentStorageByIdResponder {
8490    fn drop(&mut self) {
8491        self.control_handle.shutdown();
8492        // Safety: drops once, never accessed again
8493        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8494    }
8495}
8496
8497impl fidl::endpoints::Responder for StorageAdminOpenComponentStorageByIdResponder {
8498    type ControlHandle = StorageAdminControlHandle;
8499
8500    fn control_handle(&self) -> &StorageAdminControlHandle {
8501        &self.control_handle
8502    }
8503
8504    fn drop_without_shutdown(mut self) {
8505        // Safety: drops once, never accessed again due to mem::forget
8506        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8507        // Prevent Drop from running (which would shut down the channel)
8508        std::mem::forget(self);
8509    }
8510}
8511
8512impl StorageAdminOpenComponentStorageByIdResponder {
8513    /// Sends a response to the FIDL transaction.
8514    ///
8515    /// Sets the channel to shutdown if an error occurs.
8516    pub fn send(
8517        self,
8518        mut result: Result<(), fidl_fuchsia_component::Error>,
8519    ) -> Result<(), fidl::Error> {
8520        let _result = self.send_raw(result);
8521        if _result.is_err() {
8522            self.control_handle.shutdown();
8523        }
8524        self.drop_without_shutdown();
8525        _result
8526    }
8527
8528    /// Similar to "send" but does not shutdown the channel if an error occurs.
8529    pub fn send_no_shutdown_on_err(
8530        self,
8531        mut result: Result<(), fidl_fuchsia_component::Error>,
8532    ) -> Result<(), fidl::Error> {
8533        let _result = self.send_raw(result);
8534        self.drop_without_shutdown();
8535        _result
8536    }
8537
8538    fn send_raw(
8539        &self,
8540        mut result: Result<(), fidl_fuchsia_component::Error>,
8541    ) -> Result<(), fidl::Error> {
8542        self.control_handle.inner.send::<fidl::encoding::ResultType<
8543            fidl::encoding::EmptyStruct,
8544            fidl_fuchsia_component::Error,
8545        >>(
8546            result,
8547            self.tx_id,
8548            0x4802102cc55d5df1,
8549            fidl::encoding::DynamicFlags::empty(),
8550        )
8551    }
8552}
8553
8554#[must_use = "FIDL methods require a response to be sent"]
8555#[derive(Debug)]
8556pub struct StorageAdminDeleteComponentStorageResponder {
8557    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8558    tx_id: u32,
8559}
8560
8561/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8562/// if the responder is dropped without sending a response, so that the client
8563/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8564impl std::ops::Drop for StorageAdminDeleteComponentStorageResponder {
8565    fn drop(&mut self) {
8566        self.control_handle.shutdown();
8567        // Safety: drops once, never accessed again
8568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8569    }
8570}
8571
8572impl fidl::endpoints::Responder for StorageAdminDeleteComponentStorageResponder {
8573    type ControlHandle = StorageAdminControlHandle;
8574
8575    fn control_handle(&self) -> &StorageAdminControlHandle {
8576        &self.control_handle
8577    }
8578
8579    fn drop_without_shutdown(mut self) {
8580        // Safety: drops once, never accessed again due to mem::forget
8581        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8582        // Prevent Drop from running (which would shut down the channel)
8583        std::mem::forget(self);
8584    }
8585}
8586
8587impl StorageAdminDeleteComponentStorageResponder {
8588    /// Sends a response to the FIDL transaction.
8589    ///
8590    /// Sets the channel to shutdown if an error occurs.
8591    pub fn send(
8592        self,
8593        mut result: Result<(), fidl_fuchsia_component::Error>,
8594    ) -> Result<(), fidl::Error> {
8595        let _result = self.send_raw(result);
8596        if _result.is_err() {
8597            self.control_handle.shutdown();
8598        }
8599        self.drop_without_shutdown();
8600        _result
8601    }
8602
8603    /// Similar to "send" but does not shutdown the channel if an error occurs.
8604    pub fn send_no_shutdown_on_err(
8605        self,
8606        mut result: Result<(), fidl_fuchsia_component::Error>,
8607    ) -> Result<(), fidl::Error> {
8608        let _result = self.send_raw(result);
8609        self.drop_without_shutdown();
8610        _result
8611    }
8612
8613    fn send_raw(
8614        &self,
8615        mut result: Result<(), fidl_fuchsia_component::Error>,
8616    ) -> Result<(), fidl::Error> {
8617        self.control_handle.inner.send::<fidl::encoding::ResultType<
8618            fidl::encoding::EmptyStruct,
8619            fidl_fuchsia_component::Error,
8620        >>(
8621            result,
8622            self.tx_id,
8623            0x1677c1cdfcdbf45a,
8624            fidl::encoding::DynamicFlags::empty(),
8625        )
8626    }
8627}
8628
8629#[must_use = "FIDL methods require a response to be sent"]
8630#[derive(Debug)]
8631pub struct StorageAdminGetStatusResponder {
8632    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8633    tx_id: u32,
8634}
8635
8636/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8637/// if the responder is dropped without sending a response, so that the client
8638/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8639impl std::ops::Drop for StorageAdminGetStatusResponder {
8640    fn drop(&mut self) {
8641        self.control_handle.shutdown();
8642        // Safety: drops once, never accessed again
8643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8644    }
8645}
8646
8647impl fidl::endpoints::Responder for StorageAdminGetStatusResponder {
8648    type ControlHandle = StorageAdminControlHandle;
8649
8650    fn control_handle(&self) -> &StorageAdminControlHandle {
8651        &self.control_handle
8652    }
8653
8654    fn drop_without_shutdown(mut self) {
8655        // Safety: drops once, never accessed again due to mem::forget
8656        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8657        // Prevent Drop from running (which would shut down the channel)
8658        std::mem::forget(self);
8659    }
8660}
8661
8662impl StorageAdminGetStatusResponder {
8663    /// Sends a response to the FIDL transaction.
8664    ///
8665    /// Sets the channel to shutdown if an error occurs.
8666    pub fn send(self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
8667        let _result = self.send_raw(result);
8668        if _result.is_err() {
8669            self.control_handle.shutdown();
8670        }
8671        self.drop_without_shutdown();
8672        _result
8673    }
8674
8675    /// Similar to "send" but does not shutdown the channel if an error occurs.
8676    pub fn send_no_shutdown_on_err(
8677        self,
8678        mut result: Result<&StorageStatus, StatusError>,
8679    ) -> Result<(), fidl::Error> {
8680        let _result = self.send_raw(result);
8681        self.drop_without_shutdown();
8682        _result
8683    }
8684
8685    fn send_raw(&self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
8686        self.control_handle.inner.send::<fidl::encoding::ResultType<StorageStatus, StatusError>>(
8687            result,
8688            self.tx_id,
8689            0x7729e325a6c526c8,
8690            fidl::encoding::DynamicFlags::empty(),
8691        )
8692    }
8693}
8694
8695#[must_use = "FIDL methods require a response to be sent"]
8696#[derive(Debug)]
8697pub struct StorageAdminDeleteAllStorageContentsResponder {
8698    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8699    tx_id: u32,
8700}
8701
8702/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8703/// if the responder is dropped without sending a response, so that the client
8704/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8705impl std::ops::Drop for StorageAdminDeleteAllStorageContentsResponder {
8706    fn drop(&mut self) {
8707        self.control_handle.shutdown();
8708        // Safety: drops once, never accessed again
8709        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8710    }
8711}
8712
8713impl fidl::endpoints::Responder for StorageAdminDeleteAllStorageContentsResponder {
8714    type ControlHandle = StorageAdminControlHandle;
8715
8716    fn control_handle(&self) -> &StorageAdminControlHandle {
8717        &self.control_handle
8718    }
8719
8720    fn drop_without_shutdown(mut self) {
8721        // Safety: drops once, never accessed again due to mem::forget
8722        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8723        // Prevent Drop from running (which would shut down the channel)
8724        std::mem::forget(self);
8725    }
8726}
8727
8728impl StorageAdminDeleteAllStorageContentsResponder {
8729    /// Sends a response to the FIDL transaction.
8730    ///
8731    /// Sets the channel to shutdown if an error occurs.
8732    pub fn send(self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
8733        let _result = self.send_raw(result);
8734        if _result.is_err() {
8735            self.control_handle.shutdown();
8736        }
8737        self.drop_without_shutdown();
8738        _result
8739    }
8740
8741    /// Similar to "send" but does not shutdown the channel if an error occurs.
8742    pub fn send_no_shutdown_on_err(
8743        self,
8744        mut result: Result<(), DeletionError>,
8745    ) -> Result<(), fidl::Error> {
8746        let _result = self.send_raw(result);
8747        self.drop_without_shutdown();
8748        _result
8749    }
8750
8751    fn send_raw(&self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
8752        self.control_handle.inner.send::<fidl::encoding::ResultType<
8753            fidl::encoding::EmptyStruct,
8754            DeletionError,
8755        >>(
8756            result,
8757            self.tx_id,
8758            0x2ee980b4b2d24adb,
8759            fidl::encoding::DynamicFlags::empty(),
8760        )
8761    }
8762}
8763
8764#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8765pub struct StorageIteratorMarker;
8766
8767impl fidl::endpoints::ProtocolMarker for StorageIteratorMarker {
8768    type Proxy = StorageIteratorProxy;
8769    type RequestStream = StorageIteratorRequestStream;
8770    #[cfg(target_os = "fuchsia")]
8771    type SynchronousProxy = StorageIteratorSynchronousProxy;
8772
8773    const DEBUG_NAME: &'static str = "(anonymous) StorageIterator";
8774}
8775
8776pub trait StorageIteratorProxyInterface: Send + Sync {
8777    type NextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
8778    fn r#next(&self) -> Self::NextResponseFut;
8779}
8780#[derive(Debug)]
8781#[cfg(target_os = "fuchsia")]
8782pub struct StorageIteratorSynchronousProxy {
8783    client: fidl::client::sync::Client,
8784}
8785
8786#[cfg(target_os = "fuchsia")]
8787impl fidl::endpoints::SynchronousProxy for StorageIteratorSynchronousProxy {
8788    type Proxy = StorageIteratorProxy;
8789    type Protocol = StorageIteratorMarker;
8790
8791    fn from_channel(inner: fidl::Channel) -> Self {
8792        Self::new(inner)
8793    }
8794
8795    fn into_channel(self) -> fidl::Channel {
8796        self.client.into_channel()
8797    }
8798
8799    fn as_channel(&self) -> &fidl::Channel {
8800        self.client.as_channel()
8801    }
8802}
8803
8804#[cfg(target_os = "fuchsia")]
8805impl StorageIteratorSynchronousProxy {
8806    pub fn new(channel: fidl::Channel) -> Self {
8807        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8808        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8809    }
8810
8811    pub fn into_channel(self) -> fidl::Channel {
8812        self.client.into_channel()
8813    }
8814
8815    /// Waits until an event arrives and returns it. It is safe for other
8816    /// threads to make concurrent requests while waiting for an event.
8817    pub fn wait_for_event(
8818        &self,
8819        deadline: zx::MonotonicInstant,
8820    ) -> Result<StorageIteratorEvent, fidl::Error> {
8821        StorageIteratorEvent::decode(self.client.wait_for_event(deadline)?)
8822    }
8823
8824    /// Retrieve the next set of components using the storage capability. The returned monikers
8825    /// are relative to the component that declares the storage capability. Returns an empty
8826    /// vector after all components have been returned.
8827    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
8828        let _response =
8829            self.client.send_query::<fidl::encoding::EmptyPayload, StorageIteratorNextResponse>(
8830                (),
8831                0x7a6b21f15fd01b72,
8832                fidl::encoding::DynamicFlags::empty(),
8833                ___deadline,
8834            )?;
8835        Ok(_response.relative_monikers)
8836    }
8837}
8838
8839#[cfg(target_os = "fuchsia")]
8840impl From<StorageIteratorSynchronousProxy> for zx::NullableHandle {
8841    fn from(value: StorageIteratorSynchronousProxy) -> Self {
8842        value.into_channel().into()
8843    }
8844}
8845
8846#[cfg(target_os = "fuchsia")]
8847impl From<fidl::Channel> for StorageIteratorSynchronousProxy {
8848    fn from(value: fidl::Channel) -> Self {
8849        Self::new(value)
8850    }
8851}
8852
8853#[cfg(target_os = "fuchsia")]
8854impl fidl::endpoints::FromClient for StorageIteratorSynchronousProxy {
8855    type Protocol = StorageIteratorMarker;
8856
8857    fn from_client(value: fidl::endpoints::ClientEnd<StorageIteratorMarker>) -> Self {
8858        Self::new(value.into_channel())
8859    }
8860}
8861
8862#[derive(Debug, Clone)]
8863pub struct StorageIteratorProxy {
8864    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8865}
8866
8867impl fidl::endpoints::Proxy for StorageIteratorProxy {
8868    type Protocol = StorageIteratorMarker;
8869
8870    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8871        Self::new(inner)
8872    }
8873
8874    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8875        self.client.into_channel().map_err(|client| Self { client })
8876    }
8877
8878    fn as_channel(&self) -> &::fidl::AsyncChannel {
8879        self.client.as_channel()
8880    }
8881}
8882
8883impl StorageIteratorProxy {
8884    /// Create a new Proxy for fuchsia.sys2/StorageIterator.
8885    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8886        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8887        Self { client: fidl::client::Client::new(channel, protocol_name) }
8888    }
8889
8890    /// Get a Stream of events from the remote end of the protocol.
8891    ///
8892    /// # Panics
8893    ///
8894    /// Panics if the event stream was already taken.
8895    pub fn take_event_stream(&self) -> StorageIteratorEventStream {
8896        StorageIteratorEventStream { event_receiver: self.client.take_event_receiver() }
8897    }
8898
8899    /// Retrieve the next set of components using the storage capability. The returned monikers
8900    /// are relative to the component that declares the storage capability. Returns an empty
8901    /// vector after all components have been returned.
8902    pub fn r#next(
8903        &self,
8904    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
8905    {
8906        StorageIteratorProxyInterface::r#next(self)
8907    }
8908}
8909
8910impl StorageIteratorProxyInterface for StorageIteratorProxy {
8911    type NextResponseFut =
8912        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
8913    fn r#next(&self) -> Self::NextResponseFut {
8914        fn _decode(
8915            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8916        ) -> Result<Vec<String>, fidl::Error> {
8917            let _response = fidl::client::decode_transaction_body::<
8918                StorageIteratorNextResponse,
8919                fidl::encoding::DefaultFuchsiaResourceDialect,
8920                0x7a6b21f15fd01b72,
8921            >(_buf?)?;
8922            Ok(_response.relative_monikers)
8923        }
8924        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
8925            (),
8926            0x7a6b21f15fd01b72,
8927            fidl::encoding::DynamicFlags::empty(),
8928            _decode,
8929        )
8930    }
8931}
8932
8933pub struct StorageIteratorEventStream {
8934    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8935}
8936
8937impl std::marker::Unpin for StorageIteratorEventStream {}
8938
8939impl futures::stream::FusedStream for StorageIteratorEventStream {
8940    fn is_terminated(&self) -> bool {
8941        self.event_receiver.is_terminated()
8942    }
8943}
8944
8945impl futures::Stream for StorageIteratorEventStream {
8946    type Item = Result<StorageIteratorEvent, fidl::Error>;
8947
8948    fn poll_next(
8949        mut self: std::pin::Pin<&mut Self>,
8950        cx: &mut std::task::Context<'_>,
8951    ) -> std::task::Poll<Option<Self::Item>> {
8952        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8953            &mut self.event_receiver,
8954            cx
8955        )?) {
8956            Some(buf) => std::task::Poll::Ready(Some(StorageIteratorEvent::decode(buf))),
8957            None => std::task::Poll::Ready(None),
8958        }
8959    }
8960}
8961
8962#[derive(Debug)]
8963pub enum StorageIteratorEvent {}
8964
8965impl StorageIteratorEvent {
8966    /// Decodes a message buffer as a [`StorageIteratorEvent`].
8967    fn decode(
8968        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8969    ) -> Result<StorageIteratorEvent, fidl::Error> {
8970        let (bytes, _handles) = buf.split_mut();
8971        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8972        debug_assert_eq!(tx_header.tx_id, 0);
8973        match tx_header.ordinal {
8974            _ => Err(fidl::Error::UnknownOrdinal {
8975                ordinal: tx_header.ordinal,
8976                protocol_name:
8977                    <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8978            }),
8979        }
8980    }
8981}
8982
8983/// A Stream of incoming requests for fuchsia.sys2/StorageIterator.
8984pub struct StorageIteratorRequestStream {
8985    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8986    is_terminated: bool,
8987}
8988
8989impl std::marker::Unpin for StorageIteratorRequestStream {}
8990
8991impl futures::stream::FusedStream for StorageIteratorRequestStream {
8992    fn is_terminated(&self) -> bool {
8993        self.is_terminated
8994    }
8995}
8996
8997impl fidl::endpoints::RequestStream for StorageIteratorRequestStream {
8998    type Protocol = StorageIteratorMarker;
8999    type ControlHandle = StorageIteratorControlHandle;
9000
9001    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9002        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9003    }
9004
9005    fn control_handle(&self) -> Self::ControlHandle {
9006        StorageIteratorControlHandle { inner: self.inner.clone() }
9007    }
9008
9009    fn into_inner(
9010        self,
9011    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9012    {
9013        (self.inner, self.is_terminated)
9014    }
9015
9016    fn from_inner(
9017        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9018        is_terminated: bool,
9019    ) -> Self {
9020        Self { inner, is_terminated }
9021    }
9022}
9023
9024impl futures::Stream for StorageIteratorRequestStream {
9025    type Item = Result<StorageIteratorRequest, fidl::Error>;
9026
9027    fn poll_next(
9028        mut self: std::pin::Pin<&mut Self>,
9029        cx: &mut std::task::Context<'_>,
9030    ) -> std::task::Poll<Option<Self::Item>> {
9031        let this = &mut *self;
9032        if this.inner.check_shutdown(cx) {
9033            this.is_terminated = true;
9034            return std::task::Poll::Ready(None);
9035        }
9036        if this.is_terminated {
9037            panic!("polled StorageIteratorRequestStream after completion");
9038        }
9039        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9040            |bytes, handles| {
9041                match this.inner.channel().read_etc(cx, bytes, handles) {
9042                    std::task::Poll::Ready(Ok(())) => {}
9043                    std::task::Poll::Pending => return std::task::Poll::Pending,
9044                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9045                        this.is_terminated = true;
9046                        return std::task::Poll::Ready(None);
9047                    }
9048                    std::task::Poll::Ready(Err(e)) => {
9049                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9050                            e.into(),
9051                        ))));
9052                    }
9053                }
9054
9055                // A message has been received from the channel
9056                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9057
9058                std::task::Poll::Ready(Some(match header.ordinal {
9059                    0x7a6b21f15fd01b72 => {
9060                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9061                        let mut req = fidl::new_empty!(
9062                            fidl::encoding::EmptyPayload,
9063                            fidl::encoding::DefaultFuchsiaResourceDialect
9064                        );
9065                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9066                        let control_handle =
9067                            StorageIteratorControlHandle { inner: this.inner.clone() };
9068                        Ok(StorageIteratorRequest::Next {
9069                            responder: StorageIteratorNextResponder {
9070                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9071                                tx_id: header.tx_id,
9072                            },
9073                        })
9074                    }
9075                    _ => Err(fidl::Error::UnknownOrdinal {
9076                        ordinal: header.ordinal,
9077                        protocol_name:
9078                            <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9079                    }),
9080                }))
9081            },
9082        )
9083    }
9084}
9085
9086/// An iterator protocol for returning a set of components using a storage capability. See
9087/// |StorageAdmin.ListStorageInRealm| for more information.
9088#[derive(Debug)]
9089pub enum StorageIteratorRequest {
9090    /// Retrieve the next set of components using the storage capability. The returned monikers
9091    /// are relative to the component that declares the storage capability. Returns an empty
9092    /// vector after all components have been returned.
9093    Next { responder: StorageIteratorNextResponder },
9094}
9095
9096impl StorageIteratorRequest {
9097    #[allow(irrefutable_let_patterns)]
9098    pub fn into_next(self) -> Option<(StorageIteratorNextResponder)> {
9099        if let StorageIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
9100    }
9101
9102    /// Name of the method defined in FIDL
9103    pub fn method_name(&self) -> &'static str {
9104        match *self {
9105            StorageIteratorRequest::Next { .. } => "next",
9106        }
9107    }
9108}
9109
9110#[derive(Debug, Clone)]
9111pub struct StorageIteratorControlHandle {
9112    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9113}
9114
9115impl fidl::endpoints::ControlHandle for StorageIteratorControlHandle {
9116    fn shutdown(&self) {
9117        self.inner.shutdown()
9118    }
9119
9120    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9121        self.inner.shutdown_with_epitaph(status)
9122    }
9123
9124    fn is_closed(&self) -> bool {
9125        self.inner.channel().is_closed()
9126    }
9127    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9128        self.inner.channel().on_closed()
9129    }
9130
9131    #[cfg(target_os = "fuchsia")]
9132    fn signal_peer(
9133        &self,
9134        clear_mask: zx::Signals,
9135        set_mask: zx::Signals,
9136    ) -> Result<(), zx_status::Status> {
9137        use fidl::Peered;
9138        self.inner.channel().signal_peer(clear_mask, set_mask)
9139    }
9140}
9141
9142impl StorageIteratorControlHandle {}
9143
9144#[must_use = "FIDL methods require a response to be sent"]
9145#[derive(Debug)]
9146pub struct StorageIteratorNextResponder {
9147    control_handle: std::mem::ManuallyDrop<StorageIteratorControlHandle>,
9148    tx_id: u32,
9149}
9150
9151/// Set the the channel to be shutdown (see [`StorageIteratorControlHandle::shutdown`])
9152/// if the responder is dropped without sending a response, so that the client
9153/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9154impl std::ops::Drop for StorageIteratorNextResponder {
9155    fn drop(&mut self) {
9156        self.control_handle.shutdown();
9157        // Safety: drops once, never accessed again
9158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9159    }
9160}
9161
9162impl fidl::endpoints::Responder for StorageIteratorNextResponder {
9163    type ControlHandle = StorageIteratorControlHandle;
9164
9165    fn control_handle(&self) -> &StorageIteratorControlHandle {
9166        &self.control_handle
9167    }
9168
9169    fn drop_without_shutdown(mut self) {
9170        // Safety: drops once, never accessed again due to mem::forget
9171        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9172        // Prevent Drop from running (which would shut down the channel)
9173        std::mem::forget(self);
9174    }
9175}
9176
9177impl StorageIteratorNextResponder {
9178    /// Sends a response to the FIDL transaction.
9179    ///
9180    /// Sets the channel to shutdown if an error occurs.
9181    pub fn send(self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
9182        let _result = self.send_raw(relative_monikers);
9183        if _result.is_err() {
9184            self.control_handle.shutdown();
9185        }
9186        self.drop_without_shutdown();
9187        _result
9188    }
9189
9190    /// Similar to "send" but does not shutdown the channel if an error occurs.
9191    pub fn send_no_shutdown_on_err(
9192        self,
9193        mut relative_monikers: &[String],
9194    ) -> Result<(), fidl::Error> {
9195        let _result = self.send_raw(relative_monikers);
9196        self.drop_without_shutdown();
9197        _result
9198    }
9199
9200    fn send_raw(&self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
9201        self.control_handle.inner.send::<StorageIteratorNextResponse>(
9202            (relative_monikers,),
9203            self.tx_id,
9204            0x7a6b21f15fd01b72,
9205            fidl::encoding::DynamicFlags::empty(),
9206        )
9207    }
9208}
9209
9210#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9211pub struct SystemControllerMarker;
9212
9213impl fidl::endpoints::ProtocolMarker for SystemControllerMarker {
9214    type Proxy = SystemControllerProxy;
9215    type RequestStream = SystemControllerRequestStream;
9216    #[cfg(target_os = "fuchsia")]
9217    type SynchronousProxy = SystemControllerSynchronousProxy;
9218
9219    const DEBUG_NAME: &'static str = "fuchsia.sys2.SystemController";
9220}
9221impl fidl::endpoints::DiscoverableProtocolMarker for SystemControllerMarker {}
9222
9223pub trait SystemControllerProxyInterface: Send + Sync {
9224    type ShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9225    fn r#shutdown(&self) -> Self::ShutdownResponseFut;
9226}
9227#[derive(Debug)]
9228#[cfg(target_os = "fuchsia")]
9229pub struct SystemControllerSynchronousProxy {
9230    client: fidl::client::sync::Client,
9231}
9232
9233#[cfg(target_os = "fuchsia")]
9234impl fidl::endpoints::SynchronousProxy for SystemControllerSynchronousProxy {
9235    type Proxy = SystemControllerProxy;
9236    type Protocol = SystemControllerMarker;
9237
9238    fn from_channel(inner: fidl::Channel) -> Self {
9239        Self::new(inner)
9240    }
9241
9242    fn into_channel(self) -> fidl::Channel {
9243        self.client.into_channel()
9244    }
9245
9246    fn as_channel(&self) -> &fidl::Channel {
9247        self.client.as_channel()
9248    }
9249}
9250
9251#[cfg(target_os = "fuchsia")]
9252impl SystemControllerSynchronousProxy {
9253    pub fn new(channel: fidl::Channel) -> Self {
9254        let protocol_name = <SystemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9255        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9256    }
9257
9258    pub fn into_channel(self) -> fidl::Channel {
9259        self.client.into_channel()
9260    }
9261
9262    /// Waits until an event arrives and returns it. It is safe for other
9263    /// threads to make concurrent requests while waiting for an event.
9264    pub fn wait_for_event(
9265        &self,
9266        deadline: zx::MonotonicInstant,
9267    ) -> Result<SystemControllerEvent, fidl::Error> {
9268        SystemControllerEvent::decode(self.client.wait_for_event(deadline)?)
9269    }
9270
9271    /// Stop all components, return an empty result, close this protocol's
9272    /// channel, and exit ComponentManager. If this is the root ComponentManager
9273    /// is exited we expect the system will reboot.
9274    pub fn r#shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9275        let _response =
9276            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
9277                (),
9278                0x25f56c938344e549,
9279                fidl::encoding::DynamicFlags::empty(),
9280                ___deadline,
9281            )?;
9282        Ok(_response)
9283    }
9284}
9285
9286#[cfg(target_os = "fuchsia")]
9287impl From<SystemControllerSynchronousProxy> for zx::NullableHandle {
9288    fn from(value: SystemControllerSynchronousProxy) -> Self {
9289        value.into_channel().into()
9290    }
9291}
9292
9293#[cfg(target_os = "fuchsia")]
9294impl From<fidl::Channel> for SystemControllerSynchronousProxy {
9295    fn from(value: fidl::Channel) -> Self {
9296        Self::new(value)
9297    }
9298}
9299
9300#[cfg(target_os = "fuchsia")]
9301impl fidl::endpoints::FromClient for SystemControllerSynchronousProxy {
9302    type Protocol = SystemControllerMarker;
9303
9304    fn from_client(value: fidl::endpoints::ClientEnd<SystemControllerMarker>) -> Self {
9305        Self::new(value.into_channel())
9306    }
9307}
9308
9309#[derive(Debug, Clone)]
9310pub struct SystemControllerProxy {
9311    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9312}
9313
9314impl fidl::endpoints::Proxy for SystemControllerProxy {
9315    type Protocol = SystemControllerMarker;
9316
9317    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9318        Self::new(inner)
9319    }
9320
9321    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9322        self.client.into_channel().map_err(|client| Self { client })
9323    }
9324
9325    fn as_channel(&self) -> &::fidl::AsyncChannel {
9326        self.client.as_channel()
9327    }
9328}
9329
9330impl SystemControllerProxy {
9331    /// Create a new Proxy for fuchsia.sys2/SystemController.
9332    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9333        let protocol_name = <SystemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9334        Self { client: fidl::client::Client::new(channel, protocol_name) }
9335    }
9336
9337    /// Get a Stream of events from the remote end of the protocol.
9338    ///
9339    /// # Panics
9340    ///
9341    /// Panics if the event stream was already taken.
9342    pub fn take_event_stream(&self) -> SystemControllerEventStream {
9343        SystemControllerEventStream { event_receiver: self.client.take_event_receiver() }
9344    }
9345
9346    /// Stop all components, return an empty result, close this protocol's
9347    /// channel, and exit ComponentManager. If this is the root ComponentManager
9348    /// is exited we expect the system will reboot.
9349    pub fn r#shutdown(
9350        &self,
9351    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9352        SystemControllerProxyInterface::r#shutdown(self)
9353    }
9354}
9355
9356impl SystemControllerProxyInterface for SystemControllerProxy {
9357    type ShutdownResponseFut =
9358        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9359    fn r#shutdown(&self) -> Self::ShutdownResponseFut {
9360        fn _decode(
9361            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9362        ) -> Result<(), fidl::Error> {
9363            let _response = fidl::client::decode_transaction_body::<
9364                fidl::encoding::EmptyPayload,
9365                fidl::encoding::DefaultFuchsiaResourceDialect,
9366                0x25f56c938344e549,
9367            >(_buf?)?;
9368            Ok(_response)
9369        }
9370        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
9371            (),
9372            0x25f56c938344e549,
9373            fidl::encoding::DynamicFlags::empty(),
9374            _decode,
9375        )
9376    }
9377}
9378
9379pub struct SystemControllerEventStream {
9380    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9381}
9382
9383impl std::marker::Unpin for SystemControllerEventStream {}
9384
9385impl futures::stream::FusedStream for SystemControllerEventStream {
9386    fn is_terminated(&self) -> bool {
9387        self.event_receiver.is_terminated()
9388    }
9389}
9390
9391impl futures::Stream for SystemControllerEventStream {
9392    type Item = Result<SystemControllerEvent, fidl::Error>;
9393
9394    fn poll_next(
9395        mut self: std::pin::Pin<&mut Self>,
9396        cx: &mut std::task::Context<'_>,
9397    ) -> std::task::Poll<Option<Self::Item>> {
9398        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9399            &mut self.event_receiver,
9400            cx
9401        )?) {
9402            Some(buf) => std::task::Poll::Ready(Some(SystemControllerEvent::decode(buf))),
9403            None => std::task::Poll::Ready(None),
9404        }
9405    }
9406}
9407
9408#[derive(Debug)]
9409pub enum SystemControllerEvent {}
9410
9411impl SystemControllerEvent {
9412    /// Decodes a message buffer as a [`SystemControllerEvent`].
9413    fn decode(
9414        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9415    ) -> Result<SystemControllerEvent, fidl::Error> {
9416        let (bytes, _handles) = buf.split_mut();
9417        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9418        debug_assert_eq!(tx_header.tx_id, 0);
9419        match tx_header.ordinal {
9420            _ => Err(fidl::Error::UnknownOrdinal {
9421                ordinal: tx_header.ordinal,
9422                protocol_name:
9423                    <SystemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9424            }),
9425        }
9426    }
9427}
9428
9429/// A Stream of incoming requests for fuchsia.sys2/SystemController.
9430pub struct SystemControllerRequestStream {
9431    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9432    is_terminated: bool,
9433}
9434
9435impl std::marker::Unpin for SystemControllerRequestStream {}
9436
9437impl futures::stream::FusedStream for SystemControllerRequestStream {
9438    fn is_terminated(&self) -> bool {
9439        self.is_terminated
9440    }
9441}
9442
9443impl fidl::endpoints::RequestStream for SystemControllerRequestStream {
9444    type Protocol = SystemControllerMarker;
9445    type ControlHandle = SystemControllerControlHandle;
9446
9447    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9448        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9449    }
9450
9451    fn control_handle(&self) -> Self::ControlHandle {
9452        SystemControllerControlHandle { inner: self.inner.clone() }
9453    }
9454
9455    fn into_inner(
9456        self,
9457    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9458    {
9459        (self.inner, self.is_terminated)
9460    }
9461
9462    fn from_inner(
9463        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9464        is_terminated: bool,
9465    ) -> Self {
9466        Self { inner, is_terminated }
9467    }
9468}
9469
9470impl futures::Stream for SystemControllerRequestStream {
9471    type Item = Result<SystemControllerRequest, fidl::Error>;
9472
9473    fn poll_next(
9474        mut self: std::pin::Pin<&mut Self>,
9475        cx: &mut std::task::Context<'_>,
9476    ) -> std::task::Poll<Option<Self::Item>> {
9477        let this = &mut *self;
9478        if this.inner.check_shutdown(cx) {
9479            this.is_terminated = true;
9480            return std::task::Poll::Ready(None);
9481        }
9482        if this.is_terminated {
9483            panic!("polled SystemControllerRequestStream after completion");
9484        }
9485        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9486            |bytes, handles| {
9487                match this.inner.channel().read_etc(cx, bytes, handles) {
9488                    std::task::Poll::Ready(Ok(())) => {}
9489                    std::task::Poll::Pending => return std::task::Poll::Pending,
9490                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9491                        this.is_terminated = true;
9492                        return std::task::Poll::Ready(None);
9493                    }
9494                    std::task::Poll::Ready(Err(e)) => {
9495                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9496                            e.into(),
9497                        ))));
9498                    }
9499                }
9500
9501                // A message has been received from the channel
9502                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9503
9504                std::task::Poll::Ready(Some(match header.ordinal {
9505                    0x25f56c938344e549 => {
9506                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9507                        let mut req = fidl::new_empty!(
9508                            fidl::encoding::EmptyPayload,
9509                            fidl::encoding::DefaultFuchsiaResourceDialect
9510                        );
9511                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9512                        let control_handle =
9513                            SystemControllerControlHandle { inner: this.inner.clone() };
9514                        Ok(SystemControllerRequest::Shutdown {
9515                            responder: SystemControllerShutdownResponder {
9516                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9517                                tx_id: header.tx_id,
9518                            },
9519                        })
9520                    }
9521                    _ => Err(fidl::Error::UnknownOrdinal {
9522                        ordinal: header.ordinal,
9523                        protocol_name:
9524                            <SystemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9525                    }),
9526                }))
9527            },
9528        )
9529    }
9530}
9531
9532/// An interface implemented by ComponentManager that requests the
9533/// ComponentManager stop all components and exit.
9534#[derive(Debug)]
9535pub enum SystemControllerRequest {
9536    /// Stop all components, return an empty result, close this protocol's
9537    /// channel, and exit ComponentManager. If this is the root ComponentManager
9538    /// is exited we expect the system will reboot.
9539    Shutdown { responder: SystemControllerShutdownResponder },
9540}
9541
9542impl SystemControllerRequest {
9543    #[allow(irrefutable_let_patterns)]
9544    pub fn into_shutdown(self) -> Option<(SystemControllerShutdownResponder)> {
9545        if let SystemControllerRequest::Shutdown { responder } = self {
9546            Some((responder))
9547        } else {
9548            None
9549        }
9550    }
9551
9552    /// Name of the method defined in FIDL
9553    pub fn method_name(&self) -> &'static str {
9554        match *self {
9555            SystemControllerRequest::Shutdown { .. } => "shutdown",
9556        }
9557    }
9558}
9559
9560#[derive(Debug, Clone)]
9561pub struct SystemControllerControlHandle {
9562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9563}
9564
9565impl fidl::endpoints::ControlHandle for SystemControllerControlHandle {
9566    fn shutdown(&self) {
9567        self.inner.shutdown()
9568    }
9569
9570    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9571        self.inner.shutdown_with_epitaph(status)
9572    }
9573
9574    fn is_closed(&self) -> bool {
9575        self.inner.channel().is_closed()
9576    }
9577    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9578        self.inner.channel().on_closed()
9579    }
9580
9581    #[cfg(target_os = "fuchsia")]
9582    fn signal_peer(
9583        &self,
9584        clear_mask: zx::Signals,
9585        set_mask: zx::Signals,
9586    ) -> Result<(), zx_status::Status> {
9587        use fidl::Peered;
9588        self.inner.channel().signal_peer(clear_mask, set_mask)
9589    }
9590}
9591
9592impl SystemControllerControlHandle {}
9593
9594#[must_use = "FIDL methods require a response to be sent"]
9595#[derive(Debug)]
9596pub struct SystemControllerShutdownResponder {
9597    control_handle: std::mem::ManuallyDrop<SystemControllerControlHandle>,
9598    tx_id: u32,
9599}
9600
9601/// Set the the channel to be shutdown (see [`SystemControllerControlHandle::shutdown`])
9602/// if the responder is dropped without sending a response, so that the client
9603/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9604impl std::ops::Drop for SystemControllerShutdownResponder {
9605    fn drop(&mut self) {
9606        self.control_handle.shutdown();
9607        // Safety: drops once, never accessed again
9608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9609    }
9610}
9611
9612impl fidl::endpoints::Responder for SystemControllerShutdownResponder {
9613    type ControlHandle = SystemControllerControlHandle;
9614
9615    fn control_handle(&self) -> &SystemControllerControlHandle {
9616        &self.control_handle
9617    }
9618
9619    fn drop_without_shutdown(mut self) {
9620        // Safety: drops once, never accessed again due to mem::forget
9621        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9622        // Prevent Drop from running (which would shut down the channel)
9623        std::mem::forget(self);
9624    }
9625}
9626
9627impl SystemControllerShutdownResponder {
9628    /// Sends a response to the FIDL transaction.
9629    ///
9630    /// Sets the channel to shutdown if an error occurs.
9631    pub fn send(self) -> Result<(), fidl::Error> {
9632        let _result = self.send_raw();
9633        if _result.is_err() {
9634            self.control_handle.shutdown();
9635        }
9636        self.drop_without_shutdown();
9637        _result
9638    }
9639
9640    /// Similar to "send" but does not shutdown the channel if an error occurs.
9641    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9642        let _result = self.send_raw();
9643        self.drop_without_shutdown();
9644        _result
9645    }
9646
9647    fn send_raw(&self) -> Result<(), fidl::Error> {
9648        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9649            (),
9650            self.tx_id,
9651            0x25f56c938344e549,
9652            fidl::encoding::DynamicFlags::empty(),
9653        )
9654    }
9655}
9656
9657mod internal {
9658    use super::*;
9659
9660    impl fidl::encoding::ResourceTypeMarker for CrashIntrospectFindComponentByThreadKoidRequest {
9661        type Borrowed<'a> = &'a mut Self;
9662        fn take_or_borrow<'a>(
9663            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9664        ) -> Self::Borrowed<'a> {
9665            value
9666        }
9667    }
9668
9669    unsafe impl fidl::encoding::TypeMarker for CrashIntrospectFindComponentByThreadKoidRequest {
9670        type Owned = Self;
9671
9672        #[inline(always)]
9673        fn inline_align(_context: fidl::encoding::Context) -> usize {
9674            8
9675        }
9676
9677        #[inline(always)]
9678        fn inline_size(_context: fidl::encoding::Context) -> usize {
9679            8
9680        }
9681        #[inline(always)]
9682        fn encode_is_copy() -> bool {
9683            true
9684        }
9685
9686        #[inline(always)]
9687        fn decode_is_copy() -> bool {
9688            true
9689        }
9690    }
9691
9692    unsafe impl
9693        fidl::encoding::Encode<
9694            CrashIntrospectFindComponentByThreadKoidRequest,
9695            fidl::encoding::DefaultFuchsiaResourceDialect,
9696        > for &mut CrashIntrospectFindComponentByThreadKoidRequest
9697    {
9698        #[inline]
9699        unsafe fn encode(
9700            self,
9701            encoder: &mut fidl::encoding::Encoder<
9702                '_,
9703                fidl::encoding::DefaultFuchsiaResourceDialect,
9704            >,
9705            offset: usize,
9706            _depth: fidl::encoding::Depth,
9707        ) -> fidl::Result<()> {
9708            encoder.debug_check_bounds::<CrashIntrospectFindComponentByThreadKoidRequest>(offset);
9709            unsafe {
9710                // Copy the object into the buffer.
9711                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9712                (buf_ptr as *mut CrashIntrospectFindComponentByThreadKoidRequest).write_unaligned(
9713                    (self as *const CrashIntrospectFindComponentByThreadKoidRequest).read(),
9714                );
9715                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9716                // done second because the memcpy will write garbage to these bytes.
9717            }
9718            Ok(())
9719        }
9720    }
9721    unsafe impl<T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>>
9722        fidl::encoding::Encode<
9723            CrashIntrospectFindComponentByThreadKoidRequest,
9724            fidl::encoding::DefaultFuchsiaResourceDialect,
9725        > for (T0,)
9726    {
9727        #[inline]
9728        unsafe fn encode(
9729            self,
9730            encoder: &mut fidl::encoding::Encoder<
9731                '_,
9732                fidl::encoding::DefaultFuchsiaResourceDialect,
9733            >,
9734            offset: usize,
9735            depth: fidl::encoding::Depth,
9736        ) -> fidl::Result<()> {
9737            encoder.debug_check_bounds::<CrashIntrospectFindComponentByThreadKoidRequest>(offset);
9738            // Zero out padding regions. There's no need to apply masks
9739            // because the unmasked parts will be overwritten by fields.
9740            // Write the fields.
9741            self.0.encode(encoder, offset + 0, depth)?;
9742            Ok(())
9743        }
9744    }
9745
9746    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9747        for CrashIntrospectFindComponentByThreadKoidRequest
9748    {
9749        #[inline(always)]
9750        fn new_empty() -> Self {
9751            Self {
9752                thread_koid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
9753            }
9754        }
9755
9756        #[inline]
9757        unsafe fn decode(
9758            &mut self,
9759            decoder: &mut fidl::encoding::Decoder<
9760                '_,
9761                fidl::encoding::DefaultFuchsiaResourceDialect,
9762            >,
9763            offset: usize,
9764            _depth: fidl::encoding::Depth,
9765        ) -> fidl::Result<()> {
9766            decoder.debug_check_bounds::<Self>(offset);
9767            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9768            // Verify that padding bytes are zero.
9769            // Copy from the buffer into the object.
9770            unsafe {
9771                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9772            }
9773            Ok(())
9774        }
9775    }
9776
9777    impl fidl::encoding::ResourceTypeMarker for LifecycleControllerCreateInstanceRequest {
9778        type Borrowed<'a> = &'a mut Self;
9779        fn take_or_borrow<'a>(
9780            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9781        ) -> Self::Borrowed<'a> {
9782            value
9783        }
9784    }
9785
9786    unsafe impl fidl::encoding::TypeMarker for LifecycleControllerCreateInstanceRequest {
9787        type Owned = Self;
9788
9789        #[inline(always)]
9790        fn inline_align(_context: fidl::encoding::Context) -> usize {
9791            8
9792        }
9793
9794        #[inline(always)]
9795        fn inline_size(_context: fidl::encoding::Context) -> usize {
9796            64
9797        }
9798    }
9799
9800    unsafe impl
9801        fidl::encoding::Encode<
9802            LifecycleControllerCreateInstanceRequest,
9803            fidl::encoding::DefaultFuchsiaResourceDialect,
9804        > for &mut LifecycleControllerCreateInstanceRequest
9805    {
9806        #[inline]
9807        unsafe fn encode(
9808            self,
9809            encoder: &mut fidl::encoding::Encoder<
9810                '_,
9811                fidl::encoding::DefaultFuchsiaResourceDialect,
9812            >,
9813            offset: usize,
9814            _depth: fidl::encoding::Depth,
9815        ) -> fidl::Result<()> {
9816            encoder.debug_check_bounds::<LifecycleControllerCreateInstanceRequest>(offset);
9817            // Delegate to tuple encoding.
9818            fidl::encoding::Encode::<LifecycleControllerCreateInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9819                (
9820                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.parent_moniker),
9821                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
9822                    <fidl_fuchsia_component_decl::Child as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
9823                    <fidl_fuchsia_component::CreateChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9824                ),
9825                encoder, offset, _depth
9826            )
9827        }
9828    }
9829    unsafe impl<
9830        T0: fidl::encoding::Encode<
9831                fidl::encoding::BoundedString<4096>,
9832                fidl::encoding::DefaultFuchsiaResourceDialect,
9833            >,
9834        T1: fidl::encoding::Encode<
9835                fidl_fuchsia_component_decl::CollectionRef,
9836                fidl::encoding::DefaultFuchsiaResourceDialect,
9837            >,
9838        T2: fidl::encoding::Encode<
9839                fidl_fuchsia_component_decl::Child,
9840                fidl::encoding::DefaultFuchsiaResourceDialect,
9841            >,
9842        T3: fidl::encoding::Encode<
9843                fidl_fuchsia_component::CreateChildArgs,
9844                fidl::encoding::DefaultFuchsiaResourceDialect,
9845            >,
9846    >
9847        fidl::encoding::Encode<
9848            LifecycleControllerCreateInstanceRequest,
9849            fidl::encoding::DefaultFuchsiaResourceDialect,
9850        > for (T0, T1, T2, T3)
9851    {
9852        #[inline]
9853        unsafe fn encode(
9854            self,
9855            encoder: &mut fidl::encoding::Encoder<
9856                '_,
9857                fidl::encoding::DefaultFuchsiaResourceDialect,
9858            >,
9859            offset: usize,
9860            depth: fidl::encoding::Depth,
9861        ) -> fidl::Result<()> {
9862            encoder.debug_check_bounds::<LifecycleControllerCreateInstanceRequest>(offset);
9863            // Zero out padding regions. There's no need to apply masks
9864            // because the unmasked parts will be overwritten by fields.
9865            // Write the fields.
9866            self.0.encode(encoder, offset + 0, depth)?;
9867            self.1.encode(encoder, offset + 16, depth)?;
9868            self.2.encode(encoder, offset + 32, depth)?;
9869            self.3.encode(encoder, offset + 48, depth)?;
9870            Ok(())
9871        }
9872    }
9873
9874    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9875        for LifecycleControllerCreateInstanceRequest
9876    {
9877        #[inline(always)]
9878        fn new_empty() -> Self {
9879            Self {
9880                parent_moniker: fidl::new_empty!(
9881                    fidl::encoding::BoundedString<4096>,
9882                    fidl::encoding::DefaultFuchsiaResourceDialect
9883                ),
9884                collection: fidl::new_empty!(
9885                    fidl_fuchsia_component_decl::CollectionRef,
9886                    fidl::encoding::DefaultFuchsiaResourceDialect
9887                ),
9888                decl: fidl::new_empty!(
9889                    fidl_fuchsia_component_decl::Child,
9890                    fidl::encoding::DefaultFuchsiaResourceDialect
9891                ),
9892                args: fidl::new_empty!(
9893                    fidl_fuchsia_component::CreateChildArgs,
9894                    fidl::encoding::DefaultFuchsiaResourceDialect
9895                ),
9896            }
9897        }
9898
9899        #[inline]
9900        unsafe fn decode(
9901            &mut self,
9902            decoder: &mut fidl::encoding::Decoder<
9903                '_,
9904                fidl::encoding::DefaultFuchsiaResourceDialect,
9905            >,
9906            offset: usize,
9907            _depth: fidl::encoding::Depth,
9908        ) -> fidl::Result<()> {
9909            decoder.debug_check_bounds::<Self>(offset);
9910            // Verify that padding bytes are zero.
9911            fidl::decode!(
9912                fidl::encoding::BoundedString<4096>,
9913                fidl::encoding::DefaultFuchsiaResourceDialect,
9914                &mut self.parent_moniker,
9915                decoder,
9916                offset + 0,
9917                _depth
9918            )?;
9919            fidl::decode!(
9920                fidl_fuchsia_component_decl::CollectionRef,
9921                fidl::encoding::DefaultFuchsiaResourceDialect,
9922                &mut self.collection,
9923                decoder,
9924                offset + 16,
9925                _depth
9926            )?;
9927            fidl::decode!(
9928                fidl_fuchsia_component_decl::Child,
9929                fidl::encoding::DefaultFuchsiaResourceDialect,
9930                &mut self.decl,
9931                decoder,
9932                offset + 32,
9933                _depth
9934            )?;
9935            fidl::decode!(
9936                fidl_fuchsia_component::CreateChildArgs,
9937                fidl::encoding::DefaultFuchsiaResourceDialect,
9938                &mut self.args,
9939                decoder,
9940                offset + 48,
9941                _depth
9942            )?;
9943            Ok(())
9944        }
9945    }
9946
9947    impl fidl::encoding::ResourceTypeMarker for LifecycleControllerStartInstanceRequest {
9948        type Borrowed<'a> = &'a mut Self;
9949        fn take_or_borrow<'a>(
9950            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9951        ) -> Self::Borrowed<'a> {
9952            value
9953        }
9954    }
9955
9956    unsafe impl fidl::encoding::TypeMarker for LifecycleControllerStartInstanceRequest {
9957        type Owned = Self;
9958
9959        #[inline(always)]
9960        fn inline_align(_context: fidl::encoding::Context) -> usize {
9961            8
9962        }
9963
9964        #[inline(always)]
9965        fn inline_size(_context: fidl::encoding::Context) -> usize {
9966            24
9967        }
9968    }
9969
9970    unsafe impl
9971        fidl::encoding::Encode<
9972            LifecycleControllerStartInstanceRequest,
9973            fidl::encoding::DefaultFuchsiaResourceDialect,
9974        > for &mut LifecycleControllerStartInstanceRequest
9975    {
9976        #[inline]
9977        unsafe fn encode(
9978            self,
9979            encoder: &mut fidl::encoding::Encoder<
9980                '_,
9981                fidl::encoding::DefaultFuchsiaResourceDialect,
9982            >,
9983            offset: usize,
9984            _depth: fidl::encoding::Depth,
9985        ) -> fidl::Result<()> {
9986            encoder.debug_check_bounds::<LifecycleControllerStartInstanceRequest>(offset);
9987            // Delegate to tuple encoding.
9988            fidl::encoding::Encode::<LifecycleControllerStartInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9989                (
9990                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
9991                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.binder),
9992                ),
9993                encoder, offset, _depth
9994            )
9995        }
9996    }
9997    unsafe impl<
9998        T0: fidl::encoding::Encode<
9999                fidl::encoding::BoundedString<4096>,
10000                fidl::encoding::DefaultFuchsiaResourceDialect,
10001            >,
10002        T1: fidl::encoding::Encode<
10003                fidl::encoding::Endpoint<
10004                    fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
10005                >,
10006                fidl::encoding::DefaultFuchsiaResourceDialect,
10007            >,
10008    >
10009        fidl::encoding::Encode<
10010            LifecycleControllerStartInstanceRequest,
10011            fidl::encoding::DefaultFuchsiaResourceDialect,
10012        > for (T0, T1)
10013    {
10014        #[inline]
10015        unsafe fn encode(
10016            self,
10017            encoder: &mut fidl::encoding::Encoder<
10018                '_,
10019                fidl::encoding::DefaultFuchsiaResourceDialect,
10020            >,
10021            offset: usize,
10022            depth: fidl::encoding::Depth,
10023        ) -> fidl::Result<()> {
10024            encoder.debug_check_bounds::<LifecycleControllerStartInstanceRequest>(offset);
10025            // Zero out padding regions. There's no need to apply masks
10026            // because the unmasked parts will be overwritten by fields.
10027            unsafe {
10028                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10029                (ptr as *mut u64).write_unaligned(0);
10030            }
10031            // Write the fields.
10032            self.0.encode(encoder, offset + 0, depth)?;
10033            self.1.encode(encoder, offset + 16, depth)?;
10034            Ok(())
10035        }
10036    }
10037
10038    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10039        for LifecycleControllerStartInstanceRequest
10040    {
10041        #[inline(always)]
10042        fn new_empty() -> Self {
10043            Self {
10044                moniker: fidl::new_empty!(
10045                    fidl::encoding::BoundedString<4096>,
10046                    fidl::encoding::DefaultFuchsiaResourceDialect
10047                ),
10048                binder: fidl::new_empty!(
10049                    fidl::encoding::Endpoint<
10050                        fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
10051                    >,
10052                    fidl::encoding::DefaultFuchsiaResourceDialect
10053                ),
10054            }
10055        }
10056
10057        #[inline]
10058        unsafe fn decode(
10059            &mut self,
10060            decoder: &mut fidl::encoding::Decoder<
10061                '_,
10062                fidl::encoding::DefaultFuchsiaResourceDialect,
10063            >,
10064            offset: usize,
10065            _depth: fidl::encoding::Depth,
10066        ) -> fidl::Result<()> {
10067            decoder.debug_check_bounds::<Self>(offset);
10068            // Verify that padding bytes are zero.
10069            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10070            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10071            let mask = 0xffffffff00000000u64;
10072            let maskedval = padval & mask;
10073            if maskedval != 0 {
10074                return Err(fidl::Error::NonZeroPadding {
10075                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10076                });
10077            }
10078            fidl::decode!(
10079                fidl::encoding::BoundedString<4096>,
10080                fidl::encoding::DefaultFuchsiaResourceDialect,
10081                &mut self.moniker,
10082                decoder,
10083                offset + 0,
10084                _depth
10085            )?;
10086            fidl::decode!(
10087                fidl::encoding::Endpoint<
10088                    fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
10089                >,
10090                fidl::encoding::DefaultFuchsiaResourceDialect,
10091                &mut self.binder,
10092                decoder,
10093                offset + 16,
10094                _depth
10095            )?;
10096            Ok(())
10097        }
10098    }
10099
10100    impl fidl::encoding::ResourceTypeMarker for LifecycleControllerStartInstanceWithArgsRequest {
10101        type Borrowed<'a> = &'a mut Self;
10102        fn take_or_borrow<'a>(
10103            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10104        ) -> Self::Borrowed<'a> {
10105            value
10106        }
10107    }
10108
10109    unsafe impl fidl::encoding::TypeMarker for LifecycleControllerStartInstanceWithArgsRequest {
10110        type Owned = Self;
10111
10112        #[inline(always)]
10113        fn inline_align(_context: fidl::encoding::Context) -> usize {
10114            8
10115        }
10116
10117        #[inline(always)]
10118        fn inline_size(_context: fidl::encoding::Context) -> usize {
10119            40
10120        }
10121    }
10122
10123    unsafe impl
10124        fidl::encoding::Encode<
10125            LifecycleControllerStartInstanceWithArgsRequest,
10126            fidl::encoding::DefaultFuchsiaResourceDialect,
10127        > for &mut LifecycleControllerStartInstanceWithArgsRequest
10128    {
10129        #[inline]
10130        unsafe fn encode(
10131            self,
10132            encoder: &mut fidl::encoding::Encoder<
10133                '_,
10134                fidl::encoding::DefaultFuchsiaResourceDialect,
10135            >,
10136            offset: usize,
10137            _depth: fidl::encoding::Depth,
10138        ) -> fidl::Result<()> {
10139            encoder.debug_check_bounds::<LifecycleControllerStartInstanceWithArgsRequest>(offset);
10140            // Delegate to tuple encoding.
10141            fidl::encoding::Encode::<LifecycleControllerStartInstanceWithArgsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10142                (
10143                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
10144                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.binder),
10145                    <fidl_fuchsia_component::StartChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
10146                ),
10147                encoder, offset, _depth
10148            )
10149        }
10150    }
10151    unsafe impl<
10152        T0: fidl::encoding::Encode<
10153                fidl::encoding::BoundedString<4096>,
10154                fidl::encoding::DefaultFuchsiaResourceDialect,
10155            >,
10156        T1: fidl::encoding::Encode<
10157                fidl::encoding::Endpoint<
10158                    fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
10159                >,
10160                fidl::encoding::DefaultFuchsiaResourceDialect,
10161            >,
10162        T2: fidl::encoding::Encode<
10163                fidl_fuchsia_component::StartChildArgs,
10164                fidl::encoding::DefaultFuchsiaResourceDialect,
10165            >,
10166    >
10167        fidl::encoding::Encode<
10168            LifecycleControllerStartInstanceWithArgsRequest,
10169            fidl::encoding::DefaultFuchsiaResourceDialect,
10170        > for (T0, T1, T2)
10171    {
10172        #[inline]
10173        unsafe fn encode(
10174            self,
10175            encoder: &mut fidl::encoding::Encoder<
10176                '_,
10177                fidl::encoding::DefaultFuchsiaResourceDialect,
10178            >,
10179            offset: usize,
10180            depth: fidl::encoding::Depth,
10181        ) -> fidl::Result<()> {
10182            encoder.debug_check_bounds::<LifecycleControllerStartInstanceWithArgsRequest>(offset);
10183            // Zero out padding regions. There's no need to apply masks
10184            // because the unmasked parts will be overwritten by fields.
10185            unsafe {
10186                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10187                (ptr as *mut u64).write_unaligned(0);
10188            }
10189            // Write the fields.
10190            self.0.encode(encoder, offset + 0, depth)?;
10191            self.1.encode(encoder, offset + 16, depth)?;
10192            self.2.encode(encoder, offset + 24, depth)?;
10193            Ok(())
10194        }
10195    }
10196
10197    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10198        for LifecycleControllerStartInstanceWithArgsRequest
10199    {
10200        #[inline(always)]
10201        fn new_empty() -> Self {
10202            Self {
10203                moniker: fidl::new_empty!(
10204                    fidl::encoding::BoundedString<4096>,
10205                    fidl::encoding::DefaultFuchsiaResourceDialect
10206                ),
10207                binder: fidl::new_empty!(
10208                    fidl::encoding::Endpoint<
10209                        fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
10210                    >,
10211                    fidl::encoding::DefaultFuchsiaResourceDialect
10212                ),
10213                args: fidl::new_empty!(
10214                    fidl_fuchsia_component::StartChildArgs,
10215                    fidl::encoding::DefaultFuchsiaResourceDialect
10216                ),
10217            }
10218        }
10219
10220        #[inline]
10221        unsafe fn decode(
10222            &mut self,
10223            decoder: &mut fidl::encoding::Decoder<
10224                '_,
10225                fidl::encoding::DefaultFuchsiaResourceDialect,
10226            >,
10227            offset: usize,
10228            _depth: fidl::encoding::Depth,
10229        ) -> fidl::Result<()> {
10230            decoder.debug_check_bounds::<Self>(offset);
10231            // Verify that padding bytes are zero.
10232            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10233            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10234            let mask = 0xffffffff00000000u64;
10235            let maskedval = padval & mask;
10236            if maskedval != 0 {
10237                return Err(fidl::Error::NonZeroPadding {
10238                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10239                });
10240            }
10241            fidl::decode!(
10242                fidl::encoding::BoundedString<4096>,
10243                fidl::encoding::DefaultFuchsiaResourceDialect,
10244                &mut self.moniker,
10245                decoder,
10246                offset + 0,
10247                _depth
10248            )?;
10249            fidl::decode!(
10250                fidl::encoding::Endpoint<
10251                    fidl::endpoints::ServerEnd<fidl_fuchsia_component::BinderMarker>,
10252                >,
10253                fidl::encoding::DefaultFuchsiaResourceDialect,
10254                &mut self.binder,
10255                decoder,
10256                offset + 16,
10257                _depth
10258            )?;
10259            fidl::decode!(
10260                fidl_fuchsia_component::StartChildArgs,
10261                fidl::encoding::DefaultFuchsiaResourceDialect,
10262                &mut self.args,
10263                decoder,
10264                offset + 24,
10265                _depth
10266            )?;
10267            Ok(())
10268        }
10269    }
10270
10271    impl fidl::encoding::ResourceTypeMarker for RealmQueryConnectToStorageAdminRequest {
10272        type Borrowed<'a> = &'a mut Self;
10273        fn take_or_borrow<'a>(
10274            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10275        ) -> Self::Borrowed<'a> {
10276            value
10277        }
10278    }
10279
10280    unsafe impl fidl::encoding::TypeMarker for RealmQueryConnectToStorageAdminRequest {
10281        type Owned = Self;
10282
10283        #[inline(always)]
10284        fn inline_align(_context: fidl::encoding::Context) -> usize {
10285            8
10286        }
10287
10288        #[inline(always)]
10289        fn inline_size(_context: fidl::encoding::Context) -> usize {
10290            40
10291        }
10292    }
10293
10294    unsafe impl
10295        fidl::encoding::Encode<
10296            RealmQueryConnectToStorageAdminRequest,
10297            fidl::encoding::DefaultFuchsiaResourceDialect,
10298        > for &mut RealmQueryConnectToStorageAdminRequest
10299    {
10300        #[inline]
10301        unsafe fn encode(
10302            self,
10303            encoder: &mut fidl::encoding::Encoder<
10304                '_,
10305                fidl::encoding::DefaultFuchsiaResourceDialect,
10306            >,
10307            offset: usize,
10308            _depth: fidl::encoding::Depth,
10309        ) -> fidl::Result<()> {
10310            encoder.debug_check_bounds::<RealmQueryConnectToStorageAdminRequest>(offset);
10311            // Delegate to tuple encoding.
10312            fidl::encoding::Encode::<RealmQueryConnectToStorageAdminRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10313                (
10314                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
10315                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.storage_name),
10316                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageAdminMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10317                ),
10318                encoder, offset, _depth
10319            )
10320        }
10321    }
10322    unsafe impl<
10323        T0: fidl::encoding::Encode<
10324                fidl::encoding::BoundedString<4096>,
10325                fidl::encoding::DefaultFuchsiaResourceDialect,
10326            >,
10327        T1: fidl::encoding::Encode<
10328                fidl::encoding::BoundedString<100>,
10329                fidl::encoding::DefaultFuchsiaResourceDialect,
10330            >,
10331        T2: fidl::encoding::Encode<
10332                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageAdminMarker>>,
10333                fidl::encoding::DefaultFuchsiaResourceDialect,
10334            >,
10335    >
10336        fidl::encoding::Encode<
10337            RealmQueryConnectToStorageAdminRequest,
10338            fidl::encoding::DefaultFuchsiaResourceDialect,
10339        > for (T0, T1, T2)
10340    {
10341        #[inline]
10342        unsafe fn encode(
10343            self,
10344            encoder: &mut fidl::encoding::Encoder<
10345                '_,
10346                fidl::encoding::DefaultFuchsiaResourceDialect,
10347            >,
10348            offset: usize,
10349            depth: fidl::encoding::Depth,
10350        ) -> fidl::Result<()> {
10351            encoder.debug_check_bounds::<RealmQueryConnectToStorageAdminRequest>(offset);
10352            // Zero out padding regions. There's no need to apply masks
10353            // because the unmasked parts will be overwritten by fields.
10354            unsafe {
10355                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10356                (ptr as *mut u64).write_unaligned(0);
10357            }
10358            // Write the fields.
10359            self.0.encode(encoder, offset + 0, depth)?;
10360            self.1.encode(encoder, offset + 16, depth)?;
10361            self.2.encode(encoder, offset + 32, depth)?;
10362            Ok(())
10363        }
10364    }
10365
10366    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10367        for RealmQueryConnectToStorageAdminRequest
10368    {
10369        #[inline(always)]
10370        fn new_empty() -> Self {
10371            Self {
10372                moniker: fidl::new_empty!(
10373                    fidl::encoding::BoundedString<4096>,
10374                    fidl::encoding::DefaultFuchsiaResourceDialect
10375                ),
10376                storage_name: fidl::new_empty!(
10377                    fidl::encoding::BoundedString<100>,
10378                    fidl::encoding::DefaultFuchsiaResourceDialect
10379                ),
10380                server_end: fidl::new_empty!(
10381                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageAdminMarker>>,
10382                    fidl::encoding::DefaultFuchsiaResourceDialect
10383                ),
10384            }
10385        }
10386
10387        #[inline]
10388        unsafe fn decode(
10389            &mut self,
10390            decoder: &mut fidl::encoding::Decoder<
10391                '_,
10392                fidl::encoding::DefaultFuchsiaResourceDialect,
10393            >,
10394            offset: usize,
10395            _depth: fidl::encoding::Depth,
10396        ) -> fidl::Result<()> {
10397            decoder.debug_check_bounds::<Self>(offset);
10398            // Verify that padding bytes are zero.
10399            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10400            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10401            let mask = 0xffffffff00000000u64;
10402            let maskedval = padval & mask;
10403            if maskedval != 0 {
10404                return Err(fidl::Error::NonZeroPadding {
10405                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10406                });
10407            }
10408            fidl::decode!(
10409                fidl::encoding::BoundedString<4096>,
10410                fidl::encoding::DefaultFuchsiaResourceDialect,
10411                &mut self.moniker,
10412                decoder,
10413                offset + 0,
10414                _depth
10415            )?;
10416            fidl::decode!(
10417                fidl::encoding::BoundedString<100>,
10418                fidl::encoding::DefaultFuchsiaResourceDialect,
10419                &mut self.storage_name,
10420                decoder,
10421                offset + 16,
10422                _depth
10423            )?;
10424            fidl::decode!(
10425                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageAdminMarker>>,
10426                fidl::encoding::DefaultFuchsiaResourceDialect,
10427                &mut self.server_end,
10428                decoder,
10429                offset + 32,
10430                _depth
10431            )?;
10432            Ok(())
10433        }
10434    }
10435
10436    impl fidl::encoding::ResourceTypeMarker for RealmQueryOpenDirectoryRequest {
10437        type Borrowed<'a> = &'a mut Self;
10438        fn take_or_borrow<'a>(
10439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10440        ) -> Self::Borrowed<'a> {
10441            value
10442        }
10443    }
10444
10445    unsafe impl fidl::encoding::TypeMarker for RealmQueryOpenDirectoryRequest {
10446        type Owned = Self;
10447
10448        #[inline(always)]
10449        fn inline_align(_context: fidl::encoding::Context) -> usize {
10450            8
10451        }
10452
10453        #[inline(always)]
10454        fn inline_size(_context: fidl::encoding::Context) -> usize {
10455            24
10456        }
10457    }
10458
10459    unsafe impl
10460        fidl::encoding::Encode<
10461            RealmQueryOpenDirectoryRequest,
10462            fidl::encoding::DefaultFuchsiaResourceDialect,
10463        > for &mut RealmQueryOpenDirectoryRequest
10464    {
10465        #[inline]
10466        unsafe fn encode(
10467            self,
10468            encoder: &mut fidl::encoding::Encoder<
10469                '_,
10470                fidl::encoding::DefaultFuchsiaResourceDialect,
10471            >,
10472            offset: usize,
10473            _depth: fidl::encoding::Depth,
10474        ) -> fidl::Result<()> {
10475            encoder.debug_check_bounds::<RealmQueryOpenDirectoryRequest>(offset);
10476            // Delegate to tuple encoding.
10477            fidl::encoding::Encode::<RealmQueryOpenDirectoryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10478                (
10479                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
10480                    <OpenDirType as fidl::encoding::ValueTypeMarker>::borrow(&self.dir_type),
10481                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object),
10482                ),
10483                encoder, offset, _depth
10484            )
10485        }
10486    }
10487    unsafe impl<
10488        T0: fidl::encoding::Encode<
10489                fidl::encoding::BoundedString<4096>,
10490                fidl::encoding::DefaultFuchsiaResourceDialect,
10491            >,
10492        T1: fidl::encoding::Encode<OpenDirType, fidl::encoding::DefaultFuchsiaResourceDialect>,
10493        T2: fidl::encoding::Encode<
10494                fidl::encoding::Endpoint<
10495                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10496                >,
10497                fidl::encoding::DefaultFuchsiaResourceDialect,
10498            >,
10499    >
10500        fidl::encoding::Encode<
10501            RealmQueryOpenDirectoryRequest,
10502            fidl::encoding::DefaultFuchsiaResourceDialect,
10503        > for (T0, T1, T2)
10504    {
10505        #[inline]
10506        unsafe fn encode(
10507            self,
10508            encoder: &mut fidl::encoding::Encoder<
10509                '_,
10510                fidl::encoding::DefaultFuchsiaResourceDialect,
10511            >,
10512            offset: usize,
10513            depth: fidl::encoding::Depth,
10514        ) -> fidl::Result<()> {
10515            encoder.debug_check_bounds::<RealmQueryOpenDirectoryRequest>(offset);
10516            // Zero out padding regions. There's no need to apply masks
10517            // because the unmasked parts will be overwritten by fields.
10518            // Write the fields.
10519            self.0.encode(encoder, offset + 0, depth)?;
10520            self.1.encode(encoder, offset + 16, depth)?;
10521            self.2.encode(encoder, offset + 20, depth)?;
10522            Ok(())
10523        }
10524    }
10525
10526    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10527        for RealmQueryOpenDirectoryRequest
10528    {
10529        #[inline(always)]
10530        fn new_empty() -> Self {
10531            Self {
10532                moniker: fidl::new_empty!(
10533                    fidl::encoding::BoundedString<4096>,
10534                    fidl::encoding::DefaultFuchsiaResourceDialect
10535                ),
10536                dir_type: fidl::new_empty!(
10537                    OpenDirType,
10538                    fidl::encoding::DefaultFuchsiaResourceDialect
10539                ),
10540                object: fidl::new_empty!(
10541                    fidl::encoding::Endpoint<
10542                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10543                    >,
10544                    fidl::encoding::DefaultFuchsiaResourceDialect
10545                ),
10546            }
10547        }
10548
10549        #[inline]
10550        unsafe fn decode(
10551            &mut self,
10552            decoder: &mut fidl::encoding::Decoder<
10553                '_,
10554                fidl::encoding::DefaultFuchsiaResourceDialect,
10555            >,
10556            offset: usize,
10557            _depth: fidl::encoding::Depth,
10558        ) -> fidl::Result<()> {
10559            decoder.debug_check_bounds::<Self>(offset);
10560            // Verify that padding bytes are zero.
10561            fidl::decode!(
10562                fidl::encoding::BoundedString<4096>,
10563                fidl::encoding::DefaultFuchsiaResourceDialect,
10564                &mut self.moniker,
10565                decoder,
10566                offset + 0,
10567                _depth
10568            )?;
10569            fidl::decode!(
10570                OpenDirType,
10571                fidl::encoding::DefaultFuchsiaResourceDialect,
10572                &mut self.dir_type,
10573                decoder,
10574                offset + 16,
10575                _depth
10576            )?;
10577            fidl::decode!(
10578                fidl::encoding::Endpoint<
10579                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10580                >,
10581                fidl::encoding::DefaultFuchsiaResourceDialect,
10582                &mut self.object,
10583                decoder,
10584                offset + 20,
10585                _depth
10586            )?;
10587            Ok(())
10588        }
10589    }
10590
10591    impl fidl::encoding::ResourceTypeMarker for RealmQueryOpenStorageAdminRequest {
10592        type Borrowed<'a> = &'a mut Self;
10593        fn take_or_borrow<'a>(
10594            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10595        ) -> Self::Borrowed<'a> {
10596            value
10597        }
10598    }
10599
10600    unsafe impl fidl::encoding::TypeMarker for RealmQueryOpenStorageAdminRequest {
10601        type Owned = Self;
10602
10603        #[inline(always)]
10604        fn inline_align(_context: fidl::encoding::Context) -> usize {
10605            8
10606        }
10607
10608        #[inline(always)]
10609        fn inline_size(_context: fidl::encoding::Context) -> usize {
10610            40
10611        }
10612    }
10613
10614    unsafe impl
10615        fidl::encoding::Encode<
10616            RealmQueryOpenStorageAdminRequest,
10617            fidl::encoding::DefaultFuchsiaResourceDialect,
10618        > for &mut RealmQueryOpenStorageAdminRequest
10619    {
10620        #[inline]
10621        unsafe fn encode(
10622            self,
10623            encoder: &mut fidl::encoding::Encoder<
10624                '_,
10625                fidl::encoding::DefaultFuchsiaResourceDialect,
10626            >,
10627            offset: usize,
10628            _depth: fidl::encoding::Depth,
10629        ) -> fidl::Result<()> {
10630            encoder.debug_check_bounds::<RealmQueryOpenStorageAdminRequest>(offset);
10631            // Delegate to tuple encoding.
10632            fidl::encoding::Encode::<RealmQueryOpenStorageAdminRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10633                (
10634                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
10635                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.storage_name),
10636                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10637                ),
10638                encoder, offset, _depth
10639            )
10640        }
10641    }
10642    unsafe impl<
10643        T0: fidl::encoding::Encode<
10644                fidl::encoding::BoundedString<4096>,
10645                fidl::encoding::DefaultFuchsiaResourceDialect,
10646            >,
10647        T1: fidl::encoding::Encode<
10648                fidl::encoding::BoundedString<100>,
10649                fidl::encoding::DefaultFuchsiaResourceDialect,
10650            >,
10651        T2: fidl::encoding::Encode<
10652                fidl::encoding::Endpoint<
10653                    fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
10654                >,
10655                fidl::encoding::DefaultFuchsiaResourceDialect,
10656            >,
10657    >
10658        fidl::encoding::Encode<
10659            RealmQueryOpenStorageAdminRequest,
10660            fidl::encoding::DefaultFuchsiaResourceDialect,
10661        > for (T0, T1, T2)
10662    {
10663        #[inline]
10664        unsafe fn encode(
10665            self,
10666            encoder: &mut fidl::encoding::Encoder<
10667                '_,
10668                fidl::encoding::DefaultFuchsiaResourceDialect,
10669            >,
10670            offset: usize,
10671            depth: fidl::encoding::Depth,
10672        ) -> fidl::Result<()> {
10673            encoder.debug_check_bounds::<RealmQueryOpenStorageAdminRequest>(offset);
10674            // Zero out padding regions. There's no need to apply masks
10675            // because the unmasked parts will be overwritten by fields.
10676            unsafe {
10677                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10678                (ptr as *mut u64).write_unaligned(0);
10679            }
10680            // Write the fields.
10681            self.0.encode(encoder, offset + 0, depth)?;
10682            self.1.encode(encoder, offset + 16, depth)?;
10683            self.2.encode(encoder, offset + 32, depth)?;
10684            Ok(())
10685        }
10686    }
10687
10688    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10689        for RealmQueryOpenStorageAdminRequest
10690    {
10691        #[inline(always)]
10692        fn new_empty() -> Self {
10693            Self {
10694                moniker: fidl::new_empty!(
10695                    fidl::encoding::BoundedString<4096>,
10696                    fidl::encoding::DefaultFuchsiaResourceDialect
10697                ),
10698                storage_name: fidl::new_empty!(
10699                    fidl::encoding::BoundedString<100>,
10700                    fidl::encoding::DefaultFuchsiaResourceDialect
10701                ),
10702                server_end: fidl::new_empty!(
10703                    fidl::encoding::Endpoint<
10704                        fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
10705                    >,
10706                    fidl::encoding::DefaultFuchsiaResourceDialect
10707                ),
10708            }
10709        }
10710
10711        #[inline]
10712        unsafe fn decode(
10713            &mut self,
10714            decoder: &mut fidl::encoding::Decoder<
10715                '_,
10716                fidl::encoding::DefaultFuchsiaResourceDialect,
10717            >,
10718            offset: usize,
10719            _depth: fidl::encoding::Depth,
10720        ) -> fidl::Result<()> {
10721            decoder.debug_check_bounds::<Self>(offset);
10722            // Verify that padding bytes are zero.
10723            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10724            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10725            let mask = 0xffffffff00000000u64;
10726            let maskedval = padval & mask;
10727            if maskedval != 0 {
10728                return Err(fidl::Error::NonZeroPadding {
10729                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10730                });
10731            }
10732            fidl::decode!(
10733                fidl::encoding::BoundedString<4096>,
10734                fidl::encoding::DefaultFuchsiaResourceDialect,
10735                &mut self.moniker,
10736                decoder,
10737                offset + 0,
10738                _depth
10739            )?;
10740            fidl::decode!(
10741                fidl::encoding::BoundedString<100>,
10742                fidl::encoding::DefaultFuchsiaResourceDialect,
10743                &mut self.storage_name,
10744                decoder,
10745                offset + 16,
10746                _depth
10747            )?;
10748            fidl::decode!(
10749                fidl::encoding::Endpoint<
10750                    fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
10751                >,
10752                fidl::encoding::DefaultFuchsiaResourceDialect,
10753                &mut self.server_end,
10754                decoder,
10755                offset + 32,
10756                _depth
10757            )?;
10758            Ok(())
10759        }
10760    }
10761
10762    impl fidl::encoding::ResourceTypeMarker for RealmQueryConstructNamespaceResponse {
10763        type Borrowed<'a> = &'a mut Self;
10764        fn take_or_borrow<'a>(
10765            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10766        ) -> Self::Borrowed<'a> {
10767            value
10768        }
10769    }
10770
10771    unsafe impl fidl::encoding::TypeMarker for RealmQueryConstructNamespaceResponse {
10772        type Owned = Self;
10773
10774        #[inline(always)]
10775        fn inline_align(_context: fidl::encoding::Context) -> usize {
10776            8
10777        }
10778
10779        #[inline(always)]
10780        fn inline_size(_context: fidl::encoding::Context) -> usize {
10781            16
10782        }
10783    }
10784
10785    unsafe impl
10786        fidl::encoding::Encode<
10787            RealmQueryConstructNamespaceResponse,
10788            fidl::encoding::DefaultFuchsiaResourceDialect,
10789        > for &mut RealmQueryConstructNamespaceResponse
10790    {
10791        #[inline]
10792        unsafe fn encode(
10793            self,
10794            encoder: &mut fidl::encoding::Encoder<
10795                '_,
10796                fidl::encoding::DefaultFuchsiaResourceDialect,
10797            >,
10798            offset: usize,
10799            _depth: fidl::encoding::Depth,
10800        ) -> fidl::Result<()> {
10801            encoder.debug_check_bounds::<RealmQueryConstructNamespaceResponse>(offset);
10802            // Delegate to tuple encoding.
10803            fidl::encoding::Encode::<
10804                RealmQueryConstructNamespaceResponse,
10805                fidl::encoding::DefaultFuchsiaResourceDialect,
10806            >::encode(
10807                (<fidl::encoding::UnboundedVector<
10808                    fidl_fuchsia_component_runner::ComponentNamespaceEntry,
10809                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10810                    &mut self.namespace
10811                ),),
10812                encoder,
10813                offset,
10814                _depth,
10815            )
10816        }
10817    }
10818    unsafe impl<
10819        T0: fidl::encoding::Encode<
10820                fidl::encoding::UnboundedVector<
10821                    fidl_fuchsia_component_runner::ComponentNamespaceEntry,
10822                >,
10823                fidl::encoding::DefaultFuchsiaResourceDialect,
10824            >,
10825    >
10826        fidl::encoding::Encode<
10827            RealmQueryConstructNamespaceResponse,
10828            fidl::encoding::DefaultFuchsiaResourceDialect,
10829        > for (T0,)
10830    {
10831        #[inline]
10832        unsafe fn encode(
10833            self,
10834            encoder: &mut fidl::encoding::Encoder<
10835                '_,
10836                fidl::encoding::DefaultFuchsiaResourceDialect,
10837            >,
10838            offset: usize,
10839            depth: fidl::encoding::Depth,
10840        ) -> fidl::Result<()> {
10841            encoder.debug_check_bounds::<RealmQueryConstructNamespaceResponse>(offset);
10842            // Zero out padding regions. There's no need to apply masks
10843            // because the unmasked parts will be overwritten by fields.
10844            // Write the fields.
10845            self.0.encode(encoder, offset + 0, depth)?;
10846            Ok(())
10847        }
10848    }
10849
10850    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10851        for RealmQueryConstructNamespaceResponse
10852    {
10853        #[inline(always)]
10854        fn new_empty() -> Self {
10855            Self {
10856                namespace: fidl::new_empty!(
10857                    fidl::encoding::UnboundedVector<
10858                        fidl_fuchsia_component_runner::ComponentNamespaceEntry,
10859                    >,
10860                    fidl::encoding::DefaultFuchsiaResourceDialect
10861                ),
10862            }
10863        }
10864
10865        #[inline]
10866        unsafe fn decode(
10867            &mut self,
10868            decoder: &mut fidl::encoding::Decoder<
10869                '_,
10870                fidl::encoding::DefaultFuchsiaResourceDialect,
10871            >,
10872            offset: usize,
10873            _depth: fidl::encoding::Depth,
10874        ) -> fidl::Result<()> {
10875            decoder.debug_check_bounds::<Self>(offset);
10876            // Verify that padding bytes are zero.
10877            fidl::decode!(
10878                fidl::encoding::UnboundedVector<
10879                    fidl_fuchsia_component_runner::ComponentNamespaceEntry,
10880                >,
10881                fidl::encoding::DefaultFuchsiaResourceDialect,
10882                &mut self.namespace,
10883                decoder,
10884                offset + 0,
10885                _depth
10886            )?;
10887            Ok(())
10888        }
10889    }
10890
10891    impl fidl::encoding::ResourceTypeMarker for RealmQueryGetAllInstancesResponse {
10892        type Borrowed<'a> = &'a mut Self;
10893        fn take_or_borrow<'a>(
10894            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10895        ) -> Self::Borrowed<'a> {
10896            value
10897        }
10898    }
10899
10900    unsafe impl fidl::encoding::TypeMarker for RealmQueryGetAllInstancesResponse {
10901        type Owned = Self;
10902
10903        #[inline(always)]
10904        fn inline_align(_context: fidl::encoding::Context) -> usize {
10905            4
10906        }
10907
10908        #[inline(always)]
10909        fn inline_size(_context: fidl::encoding::Context) -> usize {
10910            4
10911        }
10912    }
10913
10914    unsafe impl
10915        fidl::encoding::Encode<
10916            RealmQueryGetAllInstancesResponse,
10917            fidl::encoding::DefaultFuchsiaResourceDialect,
10918        > for &mut RealmQueryGetAllInstancesResponse
10919    {
10920        #[inline]
10921        unsafe fn encode(
10922            self,
10923            encoder: &mut fidl::encoding::Encoder<
10924                '_,
10925                fidl::encoding::DefaultFuchsiaResourceDialect,
10926            >,
10927            offset: usize,
10928            _depth: fidl::encoding::Depth,
10929        ) -> fidl::Result<()> {
10930            encoder.debug_check_bounds::<RealmQueryGetAllInstancesResponse>(offset);
10931            // Delegate to tuple encoding.
10932            fidl::encoding::Encode::<RealmQueryGetAllInstancesResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10933                (
10934                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InstanceIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
10935                ),
10936                encoder, offset, _depth
10937            )
10938        }
10939    }
10940    unsafe impl<
10941        T0: fidl::encoding::Encode<
10942                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InstanceIteratorMarker>>,
10943                fidl::encoding::DefaultFuchsiaResourceDialect,
10944            >,
10945    >
10946        fidl::encoding::Encode<
10947            RealmQueryGetAllInstancesResponse,
10948            fidl::encoding::DefaultFuchsiaResourceDialect,
10949        > for (T0,)
10950    {
10951        #[inline]
10952        unsafe fn encode(
10953            self,
10954            encoder: &mut fidl::encoding::Encoder<
10955                '_,
10956                fidl::encoding::DefaultFuchsiaResourceDialect,
10957            >,
10958            offset: usize,
10959            depth: fidl::encoding::Depth,
10960        ) -> fidl::Result<()> {
10961            encoder.debug_check_bounds::<RealmQueryGetAllInstancesResponse>(offset);
10962            // Zero out padding regions. There's no need to apply masks
10963            // because the unmasked parts will be overwritten by fields.
10964            // Write the fields.
10965            self.0.encode(encoder, offset + 0, depth)?;
10966            Ok(())
10967        }
10968    }
10969
10970    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10971        for RealmQueryGetAllInstancesResponse
10972    {
10973        #[inline(always)]
10974        fn new_empty() -> Self {
10975            Self {
10976                iterator: fidl::new_empty!(
10977                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InstanceIteratorMarker>>,
10978                    fidl::encoding::DefaultFuchsiaResourceDialect
10979                ),
10980            }
10981        }
10982
10983        #[inline]
10984        unsafe fn decode(
10985            &mut self,
10986            decoder: &mut fidl::encoding::Decoder<
10987                '_,
10988                fidl::encoding::DefaultFuchsiaResourceDialect,
10989            >,
10990            offset: usize,
10991            _depth: fidl::encoding::Depth,
10992        ) -> fidl::Result<()> {
10993            decoder.debug_check_bounds::<Self>(offset);
10994            // Verify that padding bytes are zero.
10995            fidl::decode!(
10996                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InstanceIteratorMarker>>,
10997                fidl::encoding::DefaultFuchsiaResourceDialect,
10998                &mut self.iterator,
10999                decoder,
11000                offset + 0,
11001                _depth
11002            )?;
11003            Ok(())
11004        }
11005    }
11006
11007    impl fidl::encoding::ResourceTypeMarker for RealmQueryGetResolvedDeclarationResponse {
11008        type Borrowed<'a> = &'a mut Self;
11009        fn take_or_borrow<'a>(
11010            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11011        ) -> Self::Borrowed<'a> {
11012            value
11013        }
11014    }
11015
11016    unsafe impl fidl::encoding::TypeMarker for RealmQueryGetResolvedDeclarationResponse {
11017        type Owned = Self;
11018
11019        #[inline(always)]
11020        fn inline_align(_context: fidl::encoding::Context) -> usize {
11021            4
11022        }
11023
11024        #[inline(always)]
11025        fn inline_size(_context: fidl::encoding::Context) -> usize {
11026            4
11027        }
11028    }
11029
11030    unsafe impl
11031        fidl::encoding::Encode<
11032            RealmQueryGetResolvedDeclarationResponse,
11033            fidl::encoding::DefaultFuchsiaResourceDialect,
11034        > for &mut RealmQueryGetResolvedDeclarationResponse
11035    {
11036        #[inline]
11037        unsafe fn encode(
11038            self,
11039            encoder: &mut fidl::encoding::Encoder<
11040                '_,
11041                fidl::encoding::DefaultFuchsiaResourceDialect,
11042            >,
11043            offset: usize,
11044            _depth: fidl::encoding::Depth,
11045        ) -> fidl::Result<()> {
11046            encoder.debug_check_bounds::<RealmQueryGetResolvedDeclarationResponse>(offset);
11047            // Delegate to tuple encoding.
11048            fidl::encoding::Encode::<
11049                RealmQueryGetResolvedDeclarationResponse,
11050                fidl::encoding::DefaultFuchsiaResourceDialect,
11051            >::encode(
11052                (
11053                    <fidl::encoding::Endpoint<
11054                        fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
11055                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11056                        &mut self.iterator
11057                    ),
11058                ),
11059                encoder,
11060                offset,
11061                _depth,
11062            )
11063        }
11064    }
11065    unsafe impl<
11066        T0: fidl::encoding::Encode<
11067                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>>,
11068                fidl::encoding::DefaultFuchsiaResourceDialect,
11069            >,
11070    >
11071        fidl::encoding::Encode<
11072            RealmQueryGetResolvedDeclarationResponse,
11073            fidl::encoding::DefaultFuchsiaResourceDialect,
11074        > for (T0,)
11075    {
11076        #[inline]
11077        unsafe fn encode(
11078            self,
11079            encoder: &mut fidl::encoding::Encoder<
11080                '_,
11081                fidl::encoding::DefaultFuchsiaResourceDialect,
11082            >,
11083            offset: usize,
11084            depth: fidl::encoding::Depth,
11085        ) -> fidl::Result<()> {
11086            encoder.debug_check_bounds::<RealmQueryGetResolvedDeclarationResponse>(offset);
11087            // Zero out padding regions. There's no need to apply masks
11088            // because the unmasked parts will be overwritten by fields.
11089            // Write the fields.
11090            self.0.encode(encoder, offset + 0, depth)?;
11091            Ok(())
11092        }
11093    }
11094
11095    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11096        for RealmQueryGetResolvedDeclarationResponse
11097    {
11098        #[inline(always)]
11099        fn new_empty() -> Self {
11100            Self {
11101                iterator: fidl::new_empty!(
11102                    fidl::encoding::Endpoint<
11103                        fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
11104                    >,
11105                    fidl::encoding::DefaultFuchsiaResourceDialect
11106                ),
11107            }
11108        }
11109
11110        #[inline]
11111        unsafe fn decode(
11112            &mut self,
11113            decoder: &mut fidl::encoding::Decoder<
11114                '_,
11115                fidl::encoding::DefaultFuchsiaResourceDialect,
11116            >,
11117            offset: usize,
11118            _depth: fidl::encoding::Depth,
11119        ) -> fidl::Result<()> {
11120            decoder.debug_check_bounds::<Self>(offset);
11121            // Verify that padding bytes are zero.
11122            fidl::decode!(
11123                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>>,
11124                fidl::encoding::DefaultFuchsiaResourceDialect,
11125                &mut self.iterator,
11126                decoder,
11127                offset + 0,
11128                _depth
11129            )?;
11130            Ok(())
11131        }
11132    }
11133
11134    impl fidl::encoding::ResourceTypeMarker for RealmQueryResolveDeclarationResponse {
11135        type Borrowed<'a> = &'a mut Self;
11136        fn take_or_borrow<'a>(
11137            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11138        ) -> Self::Borrowed<'a> {
11139            value
11140        }
11141    }
11142
11143    unsafe impl fidl::encoding::TypeMarker for RealmQueryResolveDeclarationResponse {
11144        type Owned = Self;
11145
11146        #[inline(always)]
11147        fn inline_align(_context: fidl::encoding::Context) -> usize {
11148            4
11149        }
11150
11151        #[inline(always)]
11152        fn inline_size(_context: fidl::encoding::Context) -> usize {
11153            4
11154        }
11155    }
11156
11157    unsafe impl
11158        fidl::encoding::Encode<
11159            RealmQueryResolveDeclarationResponse,
11160            fidl::encoding::DefaultFuchsiaResourceDialect,
11161        > for &mut RealmQueryResolveDeclarationResponse
11162    {
11163        #[inline]
11164        unsafe fn encode(
11165            self,
11166            encoder: &mut fidl::encoding::Encoder<
11167                '_,
11168                fidl::encoding::DefaultFuchsiaResourceDialect,
11169            >,
11170            offset: usize,
11171            _depth: fidl::encoding::Depth,
11172        ) -> fidl::Result<()> {
11173            encoder.debug_check_bounds::<RealmQueryResolveDeclarationResponse>(offset);
11174            // Delegate to tuple encoding.
11175            fidl::encoding::Encode::<
11176                RealmQueryResolveDeclarationResponse,
11177                fidl::encoding::DefaultFuchsiaResourceDialect,
11178            >::encode(
11179                (
11180                    <fidl::encoding::Endpoint<
11181                        fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
11182                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11183                        &mut self.iterator
11184                    ),
11185                ),
11186                encoder,
11187                offset,
11188                _depth,
11189            )
11190        }
11191    }
11192    unsafe impl<
11193        T0: fidl::encoding::Encode<
11194                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>>,
11195                fidl::encoding::DefaultFuchsiaResourceDialect,
11196            >,
11197    >
11198        fidl::encoding::Encode<
11199            RealmQueryResolveDeclarationResponse,
11200            fidl::encoding::DefaultFuchsiaResourceDialect,
11201        > for (T0,)
11202    {
11203        #[inline]
11204        unsafe fn encode(
11205            self,
11206            encoder: &mut fidl::encoding::Encoder<
11207                '_,
11208                fidl::encoding::DefaultFuchsiaResourceDialect,
11209            >,
11210            offset: usize,
11211            depth: fidl::encoding::Depth,
11212        ) -> fidl::Result<()> {
11213            encoder.debug_check_bounds::<RealmQueryResolveDeclarationResponse>(offset);
11214            // Zero out padding regions. There's no need to apply masks
11215            // because the unmasked parts will be overwritten by fields.
11216            // Write the fields.
11217            self.0.encode(encoder, offset + 0, depth)?;
11218            Ok(())
11219        }
11220    }
11221
11222    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11223        for RealmQueryResolveDeclarationResponse
11224    {
11225        #[inline(always)]
11226        fn new_empty() -> Self {
11227            Self {
11228                iterator: fidl::new_empty!(
11229                    fidl::encoding::Endpoint<
11230                        fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>,
11231                    >,
11232                    fidl::encoding::DefaultFuchsiaResourceDialect
11233                ),
11234            }
11235        }
11236
11237        #[inline]
11238        unsafe fn decode(
11239            &mut self,
11240            decoder: &mut fidl::encoding::Decoder<
11241                '_,
11242                fidl::encoding::DefaultFuchsiaResourceDialect,
11243            >,
11244            offset: usize,
11245            _depth: fidl::encoding::Depth,
11246        ) -> fidl::Result<()> {
11247            decoder.debug_check_bounds::<Self>(offset);
11248            // Verify that padding bytes are zero.
11249            fidl::decode!(
11250                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ManifestBytesIteratorMarker>>,
11251                fidl::encoding::DefaultFuchsiaResourceDialect,
11252                &mut self.iterator,
11253                decoder,
11254                offset + 0,
11255                _depth
11256            )?;
11257            Ok(())
11258        }
11259    }
11260
11261    impl fidl::encoding::ResourceTypeMarker for StorageAdminListStorageInRealmRequest {
11262        type Borrowed<'a> = &'a mut Self;
11263        fn take_or_borrow<'a>(
11264            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11265        ) -> Self::Borrowed<'a> {
11266            value
11267        }
11268    }
11269
11270    unsafe impl fidl::encoding::TypeMarker for StorageAdminListStorageInRealmRequest {
11271        type Owned = Self;
11272
11273        #[inline(always)]
11274        fn inline_align(_context: fidl::encoding::Context) -> usize {
11275            8
11276        }
11277
11278        #[inline(always)]
11279        fn inline_size(_context: fidl::encoding::Context) -> usize {
11280            24
11281        }
11282    }
11283
11284    unsafe impl
11285        fidl::encoding::Encode<
11286            StorageAdminListStorageInRealmRequest,
11287            fidl::encoding::DefaultFuchsiaResourceDialect,
11288        > for &mut StorageAdminListStorageInRealmRequest
11289    {
11290        #[inline]
11291        unsafe fn encode(
11292            self,
11293            encoder: &mut fidl::encoding::Encoder<
11294                '_,
11295                fidl::encoding::DefaultFuchsiaResourceDialect,
11296            >,
11297            offset: usize,
11298            _depth: fidl::encoding::Depth,
11299        ) -> fidl::Result<()> {
11300            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
11301            // Delegate to tuple encoding.
11302            fidl::encoding::Encode::<StorageAdminListStorageInRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11303                (
11304                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
11305                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
11306                ),
11307                encoder, offset, _depth
11308            )
11309        }
11310    }
11311    unsafe impl<
11312        T0: fidl::encoding::Encode<
11313                fidl::encoding::BoundedString<4096>,
11314                fidl::encoding::DefaultFuchsiaResourceDialect,
11315            >,
11316        T1: fidl::encoding::Encode<
11317                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11318                fidl::encoding::DefaultFuchsiaResourceDialect,
11319            >,
11320    >
11321        fidl::encoding::Encode<
11322            StorageAdminListStorageInRealmRequest,
11323            fidl::encoding::DefaultFuchsiaResourceDialect,
11324        > for (T0, T1)
11325    {
11326        #[inline]
11327        unsafe fn encode(
11328            self,
11329            encoder: &mut fidl::encoding::Encoder<
11330                '_,
11331                fidl::encoding::DefaultFuchsiaResourceDialect,
11332            >,
11333            offset: usize,
11334            depth: fidl::encoding::Depth,
11335        ) -> fidl::Result<()> {
11336            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
11337            // Zero out padding regions. There's no need to apply masks
11338            // because the unmasked parts will be overwritten by fields.
11339            unsafe {
11340                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11341                (ptr as *mut u64).write_unaligned(0);
11342            }
11343            // Write the fields.
11344            self.0.encode(encoder, offset + 0, depth)?;
11345            self.1.encode(encoder, offset + 16, depth)?;
11346            Ok(())
11347        }
11348    }
11349
11350    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11351        for StorageAdminListStorageInRealmRequest
11352    {
11353        #[inline(always)]
11354        fn new_empty() -> Self {
11355            Self {
11356                relative_moniker: fidl::new_empty!(
11357                    fidl::encoding::BoundedString<4096>,
11358                    fidl::encoding::DefaultFuchsiaResourceDialect
11359                ),
11360                iterator: fidl::new_empty!(
11361                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11362                    fidl::encoding::DefaultFuchsiaResourceDialect
11363                ),
11364            }
11365        }
11366
11367        #[inline]
11368        unsafe fn decode(
11369            &mut self,
11370            decoder: &mut fidl::encoding::Decoder<
11371                '_,
11372                fidl::encoding::DefaultFuchsiaResourceDialect,
11373            >,
11374            offset: usize,
11375            _depth: fidl::encoding::Depth,
11376        ) -> fidl::Result<()> {
11377            decoder.debug_check_bounds::<Self>(offset);
11378            // Verify that padding bytes are zero.
11379            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11380            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11381            let mask = 0xffffffff00000000u64;
11382            let maskedval = padval & mask;
11383            if maskedval != 0 {
11384                return Err(fidl::Error::NonZeroPadding {
11385                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11386                });
11387            }
11388            fidl::decode!(
11389                fidl::encoding::BoundedString<4096>,
11390                fidl::encoding::DefaultFuchsiaResourceDialect,
11391                &mut self.relative_moniker,
11392                decoder,
11393                offset + 0,
11394                _depth
11395            )?;
11396            fidl::decode!(
11397                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11398                fidl::encoding::DefaultFuchsiaResourceDialect,
11399                &mut self.iterator,
11400                decoder,
11401                offset + 16,
11402                _depth
11403            )?;
11404            Ok(())
11405        }
11406    }
11407
11408    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenComponentStorageByIdRequest {
11409        type Borrowed<'a> = &'a mut Self;
11410        fn take_or_borrow<'a>(
11411            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11412        ) -> Self::Borrowed<'a> {
11413            value
11414        }
11415    }
11416
11417    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenComponentStorageByIdRequest {
11418        type Owned = Self;
11419
11420        #[inline(always)]
11421        fn inline_align(_context: fidl::encoding::Context) -> usize {
11422            8
11423        }
11424
11425        #[inline(always)]
11426        fn inline_size(_context: fidl::encoding::Context) -> usize {
11427            24
11428        }
11429    }
11430
11431    unsafe impl
11432        fidl::encoding::Encode<
11433            StorageAdminOpenComponentStorageByIdRequest,
11434            fidl::encoding::DefaultFuchsiaResourceDialect,
11435        > for &mut StorageAdminOpenComponentStorageByIdRequest
11436    {
11437        #[inline]
11438        unsafe fn encode(
11439            self,
11440            encoder: &mut fidl::encoding::Encoder<
11441                '_,
11442                fidl::encoding::DefaultFuchsiaResourceDialect,
11443            >,
11444            offset: usize,
11445            _depth: fidl::encoding::Depth,
11446        ) -> fidl::Result<()> {
11447            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
11448            // Delegate to tuple encoding.
11449            fidl::encoding::Encode::<
11450                StorageAdminOpenComponentStorageByIdRequest,
11451                fidl::encoding::DefaultFuchsiaResourceDialect,
11452            >::encode(
11453                (
11454                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
11455                        &self.id,
11456                    ),
11457                    <fidl::encoding::Endpoint<
11458                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11459                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11460                        &mut self.object
11461                    ),
11462                ),
11463                encoder,
11464                offset,
11465                _depth,
11466            )
11467        }
11468    }
11469    unsafe impl<
11470        T0: fidl::encoding::Encode<
11471                fidl::encoding::BoundedString<64>,
11472                fidl::encoding::DefaultFuchsiaResourceDialect,
11473            >,
11474        T1: fidl::encoding::Encode<
11475                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11476                fidl::encoding::DefaultFuchsiaResourceDialect,
11477            >,
11478    >
11479        fidl::encoding::Encode<
11480            StorageAdminOpenComponentStorageByIdRequest,
11481            fidl::encoding::DefaultFuchsiaResourceDialect,
11482        > for (T0, T1)
11483    {
11484        #[inline]
11485        unsafe fn encode(
11486            self,
11487            encoder: &mut fidl::encoding::Encoder<
11488                '_,
11489                fidl::encoding::DefaultFuchsiaResourceDialect,
11490            >,
11491            offset: usize,
11492            depth: fidl::encoding::Depth,
11493        ) -> fidl::Result<()> {
11494            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
11495            // Zero out padding regions. There's no need to apply masks
11496            // because the unmasked parts will be overwritten by fields.
11497            unsafe {
11498                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11499                (ptr as *mut u64).write_unaligned(0);
11500            }
11501            // Write the fields.
11502            self.0.encode(encoder, offset + 0, depth)?;
11503            self.1.encode(encoder, offset + 16, depth)?;
11504            Ok(())
11505        }
11506    }
11507
11508    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11509        for StorageAdminOpenComponentStorageByIdRequest
11510    {
11511        #[inline(always)]
11512        fn new_empty() -> Self {
11513            Self {
11514                id: fidl::new_empty!(
11515                    fidl::encoding::BoundedString<64>,
11516                    fidl::encoding::DefaultFuchsiaResourceDialect
11517                ),
11518                object: fidl::new_empty!(
11519                    fidl::encoding::Endpoint<
11520                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11521                    >,
11522                    fidl::encoding::DefaultFuchsiaResourceDialect
11523                ),
11524            }
11525        }
11526
11527        #[inline]
11528        unsafe fn decode(
11529            &mut self,
11530            decoder: &mut fidl::encoding::Decoder<
11531                '_,
11532                fidl::encoding::DefaultFuchsiaResourceDialect,
11533            >,
11534            offset: usize,
11535            _depth: fidl::encoding::Depth,
11536        ) -> fidl::Result<()> {
11537            decoder.debug_check_bounds::<Self>(offset);
11538            // Verify that padding bytes are zero.
11539            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11540            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11541            let mask = 0xffffffff00000000u64;
11542            let maskedval = padval & mask;
11543            if maskedval != 0 {
11544                return Err(fidl::Error::NonZeroPadding {
11545                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11546                });
11547            }
11548            fidl::decode!(
11549                fidl::encoding::BoundedString<64>,
11550                fidl::encoding::DefaultFuchsiaResourceDialect,
11551                &mut self.id,
11552                decoder,
11553                offset + 0,
11554                _depth
11555            )?;
11556            fidl::decode!(
11557                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11558                fidl::encoding::DefaultFuchsiaResourceDialect,
11559                &mut self.object,
11560                decoder,
11561                offset + 16,
11562                _depth
11563            )?;
11564            Ok(())
11565        }
11566    }
11567
11568    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenStorageRequest {
11569        type Borrowed<'a> = &'a mut Self;
11570        fn take_or_borrow<'a>(
11571            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11572        ) -> Self::Borrowed<'a> {
11573            value
11574        }
11575    }
11576
11577    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenStorageRequest {
11578        type Owned = Self;
11579
11580        #[inline(always)]
11581        fn inline_align(_context: fidl::encoding::Context) -> usize {
11582            8
11583        }
11584
11585        #[inline(always)]
11586        fn inline_size(_context: fidl::encoding::Context) -> usize {
11587            24
11588        }
11589    }
11590
11591    unsafe impl
11592        fidl::encoding::Encode<
11593            StorageAdminOpenStorageRequest,
11594            fidl::encoding::DefaultFuchsiaResourceDialect,
11595        > for &mut StorageAdminOpenStorageRequest
11596    {
11597        #[inline]
11598        unsafe fn encode(
11599            self,
11600            encoder: &mut fidl::encoding::Encoder<
11601                '_,
11602                fidl::encoding::DefaultFuchsiaResourceDialect,
11603            >,
11604            offset: usize,
11605            _depth: fidl::encoding::Depth,
11606        ) -> fidl::Result<()> {
11607            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
11608            // Delegate to tuple encoding.
11609            fidl::encoding::Encode::<StorageAdminOpenStorageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11610                (
11611                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
11612                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object),
11613                ),
11614                encoder, offset, _depth
11615            )
11616        }
11617    }
11618    unsafe impl<
11619        T0: fidl::encoding::Encode<
11620                fidl::encoding::BoundedString<4096>,
11621                fidl::encoding::DefaultFuchsiaResourceDialect,
11622            >,
11623        T1: fidl::encoding::Encode<
11624                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11625                fidl::encoding::DefaultFuchsiaResourceDialect,
11626            >,
11627    >
11628        fidl::encoding::Encode<
11629            StorageAdminOpenStorageRequest,
11630            fidl::encoding::DefaultFuchsiaResourceDialect,
11631        > for (T0, T1)
11632    {
11633        #[inline]
11634        unsafe fn encode(
11635            self,
11636            encoder: &mut fidl::encoding::Encoder<
11637                '_,
11638                fidl::encoding::DefaultFuchsiaResourceDialect,
11639            >,
11640            offset: usize,
11641            depth: fidl::encoding::Depth,
11642        ) -> fidl::Result<()> {
11643            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
11644            // Zero out padding regions. There's no need to apply masks
11645            // because the unmasked parts will be overwritten by fields.
11646            unsafe {
11647                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11648                (ptr as *mut u64).write_unaligned(0);
11649            }
11650            // Write the fields.
11651            self.0.encode(encoder, offset + 0, depth)?;
11652            self.1.encode(encoder, offset + 16, depth)?;
11653            Ok(())
11654        }
11655    }
11656
11657    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11658        for StorageAdminOpenStorageRequest
11659    {
11660        #[inline(always)]
11661        fn new_empty() -> Self {
11662            Self {
11663                relative_moniker: fidl::new_empty!(
11664                    fidl::encoding::BoundedString<4096>,
11665                    fidl::encoding::DefaultFuchsiaResourceDialect
11666                ),
11667                object: fidl::new_empty!(
11668                    fidl::encoding::Endpoint<
11669                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11670                    >,
11671                    fidl::encoding::DefaultFuchsiaResourceDialect
11672                ),
11673            }
11674        }
11675
11676        #[inline]
11677        unsafe fn decode(
11678            &mut self,
11679            decoder: &mut fidl::encoding::Decoder<
11680                '_,
11681                fidl::encoding::DefaultFuchsiaResourceDialect,
11682            >,
11683            offset: usize,
11684            _depth: fidl::encoding::Depth,
11685        ) -> fidl::Result<()> {
11686            decoder.debug_check_bounds::<Self>(offset);
11687            // Verify that padding bytes are zero.
11688            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11689            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11690            let mask = 0xffffffff00000000u64;
11691            let maskedval = padval & mask;
11692            if maskedval != 0 {
11693                return Err(fidl::Error::NonZeroPadding {
11694                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11695                });
11696            }
11697            fidl::decode!(
11698                fidl::encoding::BoundedString<4096>,
11699                fidl::encoding::DefaultFuchsiaResourceDialect,
11700                &mut self.relative_moniker,
11701                decoder,
11702                offset + 0,
11703                _depth
11704            )?;
11705            fidl::decode!(
11706                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11707                fidl::encoding::DefaultFuchsiaResourceDialect,
11708                &mut self.object,
11709                decoder,
11710                offset + 16,
11711                _depth
11712            )?;
11713            Ok(())
11714        }
11715    }
11716}