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