Skip to main content

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