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