fidl_fuchsia_inspect/
fidl_fuchsia_inspect.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_inspect__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14pub type EscrowedVmo = fidl::Vmo;
15
16#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct EscrowToken {
18    pub token: fidl::EventPair,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EscrowToken {}
22
23#[derive(Debug, PartialEq)]
24pub struct TreeGetContentResponse {
25    pub content: TreeContent,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeGetContentResponse {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct TreeListChildNamesRequest {
32    pub tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeListChildNamesRequest {}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct TreeOpenChildRequest {
39    pub child_name: String,
40    pub tree: fidl::endpoints::ServerEnd<TreeMarker>,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeOpenChildRequest {}
44
45#[derive(Debug, Default, PartialEq)]
46pub struct InspectSinkEscrowRequest {
47    /// The VMO containing Inspect data that the server will store.
48    /// Required
49    pub vmo: Option<fidl::Vmo>,
50    /// The token identifying this VMO and also serving as a controller to
51    /// stop storing this VMO in the server.
52    /// Required
53    pub token: Option<EscrowToken>,
54    /// An optional name to identify this VMO, that can be human readable.
55    ///
56    /// Optional
57    pub name: Option<String>,
58    /// An optional reference to the Tree that was previously provided to
59    /// the server using `Publish`. The server will drop the handle
60    /// associated with that tree connection, triggering a peer closed on
61    /// the tree server. This enables the client to ensure the following:
62    ///
63    /// - Tree data and escrowed data won't be present twice in snapshots.
64    /// - The caller can know when to stop serving the tree, preventing data
65    ///   missing from snapshots.
66    ///
67    /// If `name` isn't provided, the `name` of this Inspect will be the one
68    /// associated with this tree.
69    ///
70    /// If the server isn't tracking any handle associated with the source
71    /// component with this koid, this will be ignored and treated as if
72    /// nothing had been provided.
73    ///
74    /// Optional
75    pub tree: Option<u64>,
76    #[doc(hidden)]
77    pub __source_breaking: fidl::marker::SourceBreaking,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InspectSinkEscrowRequest {}
81
82#[derive(Debug, Default, PartialEq)]
83pub struct InspectSinkFetchEscrowRequest {
84    /// The token associated with the VMO taht we want to fetch. If this
85    /// token isn't associated with any VMO the response will be empty.
86    ///
87    /// Required
88    pub token: Option<EscrowToken>,
89    /// A handle that the server can use to continue reading data associated
90    /// with this VMO. The previous name that the component had given to
91    /// this VMO will be maintained. This would be equivalent to calling
92    /// `Publish` with the return VMO, except that it removes the race that
93    /// can happen if Inspect data is read, between the time that the
94    /// component fetches the VMO and publishes a tree for it.
95    ///
96    /// Optional
97    pub tree: Option<fidl::endpoints::ClientEnd<TreeMarker>>,
98    #[doc(hidden)]
99    pub __source_breaking: fidl::marker::SourceBreaking,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103    for InspectSinkFetchEscrowRequest
104{
105}
106
107#[derive(Debug, Default, PartialEq)]
108pub struct InspectSinkPublishRequest {
109    /// The Tree that the server will use to fetch Inspect data.
110    ///
111    /// The connection will be closed if this isn't provided.
112    ///
113    /// Required
114    pub tree: Option<fidl::endpoints::ClientEnd<TreeMarker>>,
115    /// A name to identify this tree from the client perspective. This name
116    /// isn't required to be unique across multiple trees. Multiple trees
117    /// published under the same name are accepted and will not overwrite
118    /// previously published trees.
119    ///
120    /// Optional
121    pub name: Option<String>,
122    #[doc(hidden)]
123    pub __source_breaking: fidl::marker::SourceBreaking,
124}
125
126impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InspectSinkPublishRequest {}
127
128#[derive(Debug, Default, PartialEq)]
129pub struct InspectSinkFetchEscrowResponse {
130    pub vmo: Option<fidl::Vmo>,
131    #[doc(hidden)]
132    pub __source_breaking: fidl::marker::SourceBreaking,
133}
134
135impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
136    for InspectSinkFetchEscrowResponse
137{
138}
139
140/// The content of a specific Inspect Tree.
141#[derive(Debug, Default, PartialEq)]
142pub struct TreeContent {
143    /// Buffer containing the bytes of a tree in Inspect format.
144    pub buffer: Option<fidl_fuchsia_mem::Buffer>,
145    #[doc(hidden)]
146    pub __source_breaking: fidl::marker::SourceBreaking,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeContent {}
150
151#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub struct InspectSinkMarker;
153
154impl fidl::endpoints::ProtocolMarker for InspectSinkMarker {
155    type Proxy = InspectSinkProxy;
156    type RequestStream = InspectSinkRequestStream;
157    #[cfg(target_os = "fuchsia")]
158    type SynchronousProxy = InspectSinkSynchronousProxy;
159
160    const DEBUG_NAME: &'static str = "fuchsia.inspect.InspectSink";
161}
162impl fidl::endpoints::DiscoverableProtocolMarker for InspectSinkMarker {}
163
164pub trait InspectSinkProxyInterface: Send + Sync {
165    fn r#publish(&self, payload: InspectSinkPublishRequest) -> Result<(), fidl::Error>;
166    fn r#escrow(&self, payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error>;
167    type FetchEscrowResponseFut: std::future::Future<Output = Result<InspectSinkFetchEscrowResponse, fidl::Error>>
168        + Send;
169    fn r#fetch_escrow(
170        &self,
171        payload: InspectSinkFetchEscrowRequest,
172    ) -> Self::FetchEscrowResponseFut;
173}
174#[derive(Debug)]
175#[cfg(target_os = "fuchsia")]
176pub struct InspectSinkSynchronousProxy {
177    client: fidl::client::sync::Client,
178}
179
180#[cfg(target_os = "fuchsia")]
181impl fidl::endpoints::SynchronousProxy for InspectSinkSynchronousProxy {
182    type Proxy = InspectSinkProxy;
183    type Protocol = InspectSinkMarker;
184
185    fn from_channel(inner: fidl::Channel) -> Self {
186        Self::new(inner)
187    }
188
189    fn into_channel(self) -> fidl::Channel {
190        self.client.into_channel()
191    }
192
193    fn as_channel(&self) -> &fidl::Channel {
194        self.client.as_channel()
195    }
196}
197
198#[cfg(target_os = "fuchsia")]
199impl InspectSinkSynchronousProxy {
200    pub fn new(channel: fidl::Channel) -> Self {
201        let protocol_name = <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
202        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
203    }
204
205    pub fn into_channel(self) -> fidl::Channel {
206        self.client.into_channel()
207    }
208
209    /// Waits until an event arrives and returns it. It is safe for other
210    /// threads to make concurrent requests while waiting for an event.
211    pub fn wait_for_event(
212        &self,
213        deadline: zx::MonotonicInstant,
214    ) -> Result<InspectSinkEvent, fidl::Error> {
215        InspectSinkEvent::decode(self.client.wait_for_event(deadline)?)
216    }
217
218    /// Publishes a handle to the `fuchsia.inspect.Tree` protocol that the
219    /// server can use to read Inspect data, including lazy nodes.
220    pub fn r#publish(&self, mut payload: InspectSinkPublishRequest) -> Result<(), fidl::Error> {
221        self.client.send::<InspectSinkPublishRequest>(
222            &mut payload,
223            0xf9ceb1ab8ec6b4b,
224            fidl::encoding::DynamicFlags::FLEXIBLE,
225        )
226    }
227
228    /// Instructs the server to store the VMO provided to make its data
229    /// available to Inspect readers, even when the component that published
230    /// this VMO isn't running.
231    ///
232    /// This is meant to be used when integrating with Component Framework's
233    /// Escrow APIs to enable stopping when IDLE but still ensure that some
234    /// useful diagnostics information is available.
235    ///
236    /// The client must provide a `token` that will be used as a unique
237    /// identifier to this VMO by the the server. This token is an event pair, a
238    /// client must provide one end of this event pair and hold to the other end
239    /// (or escrow the handle it using Component APIs). If the server sees a
240    /// PEER_CLOSED on the handle it received, it will drop the VMO associated
241    /// with this token.
242    ///
243    /// If any of the required arguments isn't passed the connection will be
244    /// closed.
245    ///
246    /// To learn more about stopping IDLE components, please refer to:
247    /// https://fuchsia.dev/fuchsia-src/development/components/stop_idle
248    pub fn r#escrow(&self, mut payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error> {
249        self.client.send::<InspectSinkEscrowRequest>(
250            &mut payload,
251            0x4b683186a65d2d16,
252            fidl::encoding::DynamicFlags::FLEXIBLE,
253        )
254    }
255
256    /// Instructs the server to return (and stop tracking) the VMO associated
257    /// with the given token.
258    ///
259    /// This is meant to be used when a component restarts and wants to fetch
260    /// Inspect data that it escrowed.
261    ///
262    /// To learn more about stopping IDLE components, please refer to:
263    /// https://fuchsia.dev/fuchsia-src/development/components/stop_idle
264    pub fn r#fetch_escrow(
265        &self,
266        mut payload: InspectSinkFetchEscrowRequest,
267        ___deadline: zx::MonotonicInstant,
268    ) -> Result<InspectSinkFetchEscrowResponse, fidl::Error> {
269        let _response = self.client.send_query::<
270            InspectSinkFetchEscrowRequest,
271            fidl::encoding::FlexibleType<InspectSinkFetchEscrowResponse>,
272        >(
273            &mut payload,
274            0x7b9faa1a6f8e666a,
275            fidl::encoding::DynamicFlags::FLEXIBLE,
276            ___deadline,
277        )?
278        .into_result::<InspectSinkMarker>("fetch_escrow")?;
279        Ok(_response)
280    }
281}
282
283#[cfg(target_os = "fuchsia")]
284impl From<InspectSinkSynchronousProxy> for zx::NullableHandle {
285    fn from(value: InspectSinkSynchronousProxy) -> Self {
286        value.into_channel().into()
287    }
288}
289
290#[cfg(target_os = "fuchsia")]
291impl From<fidl::Channel> for InspectSinkSynchronousProxy {
292    fn from(value: fidl::Channel) -> Self {
293        Self::new(value)
294    }
295}
296
297#[cfg(target_os = "fuchsia")]
298impl fidl::endpoints::FromClient for InspectSinkSynchronousProxy {
299    type Protocol = InspectSinkMarker;
300
301    fn from_client(value: fidl::endpoints::ClientEnd<InspectSinkMarker>) -> Self {
302        Self::new(value.into_channel())
303    }
304}
305
306#[derive(Debug, Clone)]
307pub struct InspectSinkProxy {
308    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
309}
310
311impl fidl::endpoints::Proxy for InspectSinkProxy {
312    type Protocol = InspectSinkMarker;
313
314    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
315        Self::new(inner)
316    }
317
318    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
319        self.client.into_channel().map_err(|client| Self { client })
320    }
321
322    fn as_channel(&self) -> &::fidl::AsyncChannel {
323        self.client.as_channel()
324    }
325}
326
327impl InspectSinkProxy {
328    /// Create a new Proxy for fuchsia.inspect/InspectSink.
329    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
330        let protocol_name = <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
331        Self { client: fidl::client::Client::new(channel, protocol_name) }
332    }
333
334    /// Get a Stream of events from the remote end of the protocol.
335    ///
336    /// # Panics
337    ///
338    /// Panics if the event stream was already taken.
339    pub fn take_event_stream(&self) -> InspectSinkEventStream {
340        InspectSinkEventStream { event_receiver: self.client.take_event_receiver() }
341    }
342
343    /// Publishes a handle to the `fuchsia.inspect.Tree` protocol that the
344    /// server can use to read Inspect data, including lazy nodes.
345    pub fn r#publish(&self, mut payload: InspectSinkPublishRequest) -> Result<(), fidl::Error> {
346        InspectSinkProxyInterface::r#publish(self, payload)
347    }
348
349    /// Instructs the server to store the VMO provided to make its data
350    /// available to Inspect readers, even when the component that published
351    /// this VMO isn't running.
352    ///
353    /// This is meant to be used when integrating with Component Framework's
354    /// Escrow APIs to enable stopping when IDLE but still ensure that some
355    /// useful diagnostics information is available.
356    ///
357    /// The client must provide a `token` that will be used as a unique
358    /// identifier to this VMO by the the server. This token is an event pair, a
359    /// client must provide one end of this event pair and hold to the other end
360    /// (or escrow the handle it using Component APIs). If the server sees a
361    /// PEER_CLOSED on the handle it received, it will drop the VMO associated
362    /// with this token.
363    ///
364    /// If any of the required arguments isn't passed the connection will be
365    /// closed.
366    ///
367    /// To learn more about stopping IDLE components, please refer to:
368    /// https://fuchsia.dev/fuchsia-src/development/components/stop_idle
369    pub fn r#escrow(&self, mut payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error> {
370        InspectSinkProxyInterface::r#escrow(self, payload)
371    }
372
373    /// Instructs the server to return (and stop tracking) the VMO associated
374    /// with the given token.
375    ///
376    /// This is meant to be used when a component restarts and wants to fetch
377    /// Inspect data that it escrowed.
378    ///
379    /// To learn more about stopping IDLE components, please refer to:
380    /// https://fuchsia.dev/fuchsia-src/development/components/stop_idle
381    pub fn r#fetch_escrow(
382        &self,
383        mut payload: InspectSinkFetchEscrowRequest,
384    ) -> fidl::client::QueryResponseFut<
385        InspectSinkFetchEscrowResponse,
386        fidl::encoding::DefaultFuchsiaResourceDialect,
387    > {
388        InspectSinkProxyInterface::r#fetch_escrow(self, payload)
389    }
390}
391
392impl InspectSinkProxyInterface for InspectSinkProxy {
393    fn r#publish(&self, mut payload: InspectSinkPublishRequest) -> Result<(), fidl::Error> {
394        self.client.send::<InspectSinkPublishRequest>(
395            &mut payload,
396            0xf9ceb1ab8ec6b4b,
397            fidl::encoding::DynamicFlags::FLEXIBLE,
398        )
399    }
400
401    fn r#escrow(&self, mut payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error> {
402        self.client.send::<InspectSinkEscrowRequest>(
403            &mut payload,
404            0x4b683186a65d2d16,
405            fidl::encoding::DynamicFlags::FLEXIBLE,
406        )
407    }
408
409    type FetchEscrowResponseFut = fidl::client::QueryResponseFut<
410        InspectSinkFetchEscrowResponse,
411        fidl::encoding::DefaultFuchsiaResourceDialect,
412    >;
413    fn r#fetch_escrow(
414        &self,
415        mut payload: InspectSinkFetchEscrowRequest,
416    ) -> Self::FetchEscrowResponseFut {
417        fn _decode(
418            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
419        ) -> Result<InspectSinkFetchEscrowResponse, fidl::Error> {
420            let _response = fidl::client::decode_transaction_body::<
421                fidl::encoding::FlexibleType<InspectSinkFetchEscrowResponse>,
422                fidl::encoding::DefaultFuchsiaResourceDialect,
423                0x7b9faa1a6f8e666a,
424            >(_buf?)?
425            .into_result::<InspectSinkMarker>("fetch_escrow")?;
426            Ok(_response)
427        }
428        self.client
429            .send_query_and_decode::<InspectSinkFetchEscrowRequest, InspectSinkFetchEscrowResponse>(
430                &mut payload,
431                0x7b9faa1a6f8e666a,
432                fidl::encoding::DynamicFlags::FLEXIBLE,
433                _decode,
434            )
435    }
436}
437
438pub struct InspectSinkEventStream {
439    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
440}
441
442impl std::marker::Unpin for InspectSinkEventStream {}
443
444impl futures::stream::FusedStream for InspectSinkEventStream {
445    fn is_terminated(&self) -> bool {
446        self.event_receiver.is_terminated()
447    }
448}
449
450impl futures::Stream for InspectSinkEventStream {
451    type Item = Result<InspectSinkEvent, fidl::Error>;
452
453    fn poll_next(
454        mut self: std::pin::Pin<&mut Self>,
455        cx: &mut std::task::Context<'_>,
456    ) -> std::task::Poll<Option<Self::Item>> {
457        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
458            &mut self.event_receiver,
459            cx
460        )?) {
461            Some(buf) => std::task::Poll::Ready(Some(InspectSinkEvent::decode(buf))),
462            None => std::task::Poll::Ready(None),
463        }
464    }
465}
466
467#[derive(Debug)]
468pub enum InspectSinkEvent {
469    #[non_exhaustive]
470    _UnknownEvent {
471        /// Ordinal of the event that was sent.
472        ordinal: u64,
473    },
474}
475
476impl InspectSinkEvent {
477    /// Decodes a message buffer as a [`InspectSinkEvent`].
478    fn decode(
479        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
480    ) -> Result<InspectSinkEvent, fidl::Error> {
481        let (bytes, _handles) = buf.split_mut();
482        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
483        debug_assert_eq!(tx_header.tx_id, 0);
484        match tx_header.ordinal {
485            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
486                Ok(InspectSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
487            }
488            _ => Err(fidl::Error::UnknownOrdinal {
489                ordinal: tx_header.ordinal,
490                protocol_name: <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
491            }),
492        }
493    }
494}
495
496/// A Stream of incoming requests for fuchsia.inspect/InspectSink.
497pub struct InspectSinkRequestStream {
498    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
499    is_terminated: bool,
500}
501
502impl std::marker::Unpin for InspectSinkRequestStream {}
503
504impl futures::stream::FusedStream for InspectSinkRequestStream {
505    fn is_terminated(&self) -> bool {
506        self.is_terminated
507    }
508}
509
510impl fidl::endpoints::RequestStream for InspectSinkRequestStream {
511    type Protocol = InspectSinkMarker;
512    type ControlHandle = InspectSinkControlHandle;
513
514    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
515        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
516    }
517
518    fn control_handle(&self) -> Self::ControlHandle {
519        InspectSinkControlHandle { inner: self.inner.clone() }
520    }
521
522    fn into_inner(
523        self,
524    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
525    {
526        (self.inner, self.is_terminated)
527    }
528
529    fn from_inner(
530        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
531        is_terminated: bool,
532    ) -> Self {
533        Self { inner, is_terminated }
534    }
535}
536
537impl futures::Stream for InspectSinkRequestStream {
538    type Item = Result<InspectSinkRequest, fidl::Error>;
539
540    fn poll_next(
541        mut self: std::pin::Pin<&mut Self>,
542        cx: &mut std::task::Context<'_>,
543    ) -> std::task::Poll<Option<Self::Item>> {
544        let this = &mut *self;
545        if this.inner.check_shutdown(cx) {
546            this.is_terminated = true;
547            return std::task::Poll::Ready(None);
548        }
549        if this.is_terminated {
550            panic!("polled InspectSinkRequestStream after completion");
551        }
552        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
553            |bytes, handles| {
554                match this.inner.channel().read_etc(cx, bytes, handles) {
555                    std::task::Poll::Ready(Ok(())) => {}
556                    std::task::Poll::Pending => return std::task::Poll::Pending,
557                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
558                        this.is_terminated = true;
559                        return std::task::Poll::Ready(None);
560                    }
561                    std::task::Poll::Ready(Err(e)) => {
562                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
563                            e.into(),
564                        ))));
565                    }
566                }
567
568                // A message has been received from the channel
569                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
570
571                std::task::Poll::Ready(Some(match header.ordinal {
572                    0xf9ceb1ab8ec6b4b => {
573                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
574                        let mut req = fidl::new_empty!(
575                            InspectSinkPublishRequest,
576                            fidl::encoding::DefaultFuchsiaResourceDialect
577                        );
578                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectSinkPublishRequest>(&header, _body_bytes, handles, &mut req)?;
579                        let control_handle = InspectSinkControlHandle { inner: this.inner.clone() };
580                        Ok(InspectSinkRequest::Publish { payload: req, control_handle })
581                    }
582                    0x4b683186a65d2d16 => {
583                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
584                        let mut req = fidl::new_empty!(
585                            InspectSinkEscrowRequest,
586                            fidl::encoding::DefaultFuchsiaResourceDialect
587                        );
588                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectSinkEscrowRequest>(&header, _body_bytes, handles, &mut req)?;
589                        let control_handle = InspectSinkControlHandle { inner: this.inner.clone() };
590                        Ok(InspectSinkRequest::Escrow { payload: req, control_handle })
591                    }
592                    0x7b9faa1a6f8e666a => {
593                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
594                        let mut req = fidl::new_empty!(
595                            InspectSinkFetchEscrowRequest,
596                            fidl::encoding::DefaultFuchsiaResourceDialect
597                        );
598                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectSinkFetchEscrowRequest>(&header, _body_bytes, handles, &mut req)?;
599                        let control_handle = InspectSinkControlHandle { inner: this.inner.clone() };
600                        Ok(InspectSinkRequest::FetchEscrow {
601                            payload: req,
602                            responder: InspectSinkFetchEscrowResponder {
603                                control_handle: std::mem::ManuallyDrop::new(control_handle),
604                                tx_id: header.tx_id,
605                            },
606                        })
607                    }
608                    _ if header.tx_id == 0
609                        && header
610                            .dynamic_flags()
611                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
612                    {
613                        Ok(InspectSinkRequest::_UnknownMethod {
614                            ordinal: header.ordinal,
615                            control_handle: InspectSinkControlHandle { inner: this.inner.clone() },
616                            method_type: fidl::MethodType::OneWay,
617                        })
618                    }
619                    _ if header
620                        .dynamic_flags()
621                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
622                    {
623                        this.inner.send_framework_err(
624                            fidl::encoding::FrameworkErr::UnknownMethod,
625                            header.tx_id,
626                            header.ordinal,
627                            header.dynamic_flags(),
628                            (bytes, handles),
629                        )?;
630                        Ok(InspectSinkRequest::_UnknownMethod {
631                            ordinal: header.ordinal,
632                            control_handle: InspectSinkControlHandle { inner: this.inner.clone() },
633                            method_type: fidl::MethodType::TwoWay,
634                        })
635                    }
636                    _ => Err(fidl::Error::UnknownOrdinal {
637                        ordinal: header.ordinal,
638                        protocol_name:
639                            <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
640                    }),
641                }))
642            },
643        )
644    }
645}
646
647#[derive(Debug)]
648pub enum InspectSinkRequest {
649    /// Publishes a handle to the `fuchsia.inspect.Tree` protocol that the
650    /// server can use to read Inspect data, including lazy nodes.
651    Publish { payload: InspectSinkPublishRequest, control_handle: InspectSinkControlHandle },
652    /// Instructs the server to store the VMO provided to make its data
653    /// available to Inspect readers, even when the component that published
654    /// this VMO isn't running.
655    ///
656    /// This is meant to be used when integrating with Component Framework's
657    /// Escrow APIs to enable stopping when IDLE but still ensure that some
658    /// useful diagnostics information is available.
659    ///
660    /// The client must provide a `token` that will be used as a unique
661    /// identifier to this VMO by the the server. This token is an event pair, a
662    /// client must provide one end of this event pair and hold to the other end
663    /// (or escrow the handle it using Component APIs). If the server sees a
664    /// PEER_CLOSED on the handle it received, it will drop the VMO associated
665    /// with this token.
666    ///
667    /// If any of the required arguments isn't passed the connection will be
668    /// closed.
669    ///
670    /// To learn more about stopping IDLE components, please refer to:
671    /// https://fuchsia.dev/fuchsia-src/development/components/stop_idle
672    Escrow { payload: InspectSinkEscrowRequest, control_handle: InspectSinkControlHandle },
673    /// Instructs the server to return (and stop tracking) the VMO associated
674    /// with the given token.
675    ///
676    /// This is meant to be used when a component restarts and wants to fetch
677    /// Inspect data that it escrowed.
678    ///
679    /// To learn more about stopping IDLE components, please refer to:
680    /// https://fuchsia.dev/fuchsia-src/development/components/stop_idle
681    FetchEscrow {
682        payload: InspectSinkFetchEscrowRequest,
683        responder: InspectSinkFetchEscrowResponder,
684    },
685    /// An interaction was received which does not match any known method.
686    #[non_exhaustive]
687    _UnknownMethod {
688        /// Ordinal of the method that was called.
689        ordinal: u64,
690        control_handle: InspectSinkControlHandle,
691        method_type: fidl::MethodType,
692    },
693}
694
695impl InspectSinkRequest {
696    #[allow(irrefutable_let_patterns)]
697    pub fn into_publish(self) -> Option<(InspectSinkPublishRequest, InspectSinkControlHandle)> {
698        if let InspectSinkRequest::Publish { payload, control_handle } = self {
699            Some((payload, control_handle))
700        } else {
701            None
702        }
703    }
704
705    #[allow(irrefutable_let_patterns)]
706    pub fn into_escrow(self) -> Option<(InspectSinkEscrowRequest, InspectSinkControlHandle)> {
707        if let InspectSinkRequest::Escrow { payload, control_handle } = self {
708            Some((payload, control_handle))
709        } else {
710            None
711        }
712    }
713
714    #[allow(irrefutable_let_patterns)]
715    pub fn into_fetch_escrow(
716        self,
717    ) -> Option<(InspectSinkFetchEscrowRequest, InspectSinkFetchEscrowResponder)> {
718        if let InspectSinkRequest::FetchEscrow { payload, responder } = self {
719            Some((payload, responder))
720        } else {
721            None
722        }
723    }
724
725    /// Name of the method defined in FIDL
726    pub fn method_name(&self) -> &'static str {
727        match *self {
728            InspectSinkRequest::Publish { .. } => "publish",
729            InspectSinkRequest::Escrow { .. } => "escrow",
730            InspectSinkRequest::FetchEscrow { .. } => "fetch_escrow",
731            InspectSinkRequest::_UnknownMethod {
732                method_type: fidl::MethodType::OneWay, ..
733            } => "unknown one-way method",
734            InspectSinkRequest::_UnknownMethod {
735                method_type: fidl::MethodType::TwoWay, ..
736            } => "unknown two-way method",
737        }
738    }
739}
740
741#[derive(Debug, Clone)]
742pub struct InspectSinkControlHandle {
743    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
744}
745
746impl fidl::endpoints::ControlHandle for InspectSinkControlHandle {
747    fn shutdown(&self) {
748        self.inner.shutdown()
749    }
750
751    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
752        self.inner.shutdown_with_epitaph(status)
753    }
754
755    fn is_closed(&self) -> bool {
756        self.inner.channel().is_closed()
757    }
758    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
759        self.inner.channel().on_closed()
760    }
761
762    #[cfg(target_os = "fuchsia")]
763    fn signal_peer(
764        &self,
765        clear_mask: zx::Signals,
766        set_mask: zx::Signals,
767    ) -> Result<(), zx_status::Status> {
768        use fidl::Peered;
769        self.inner.channel().signal_peer(clear_mask, set_mask)
770    }
771}
772
773impl InspectSinkControlHandle {}
774
775#[must_use = "FIDL methods require a response to be sent"]
776#[derive(Debug)]
777pub struct InspectSinkFetchEscrowResponder {
778    control_handle: std::mem::ManuallyDrop<InspectSinkControlHandle>,
779    tx_id: u32,
780}
781
782/// Set the the channel to be shutdown (see [`InspectSinkControlHandle::shutdown`])
783/// if the responder is dropped without sending a response, so that the client
784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
785impl std::ops::Drop for InspectSinkFetchEscrowResponder {
786    fn drop(&mut self) {
787        self.control_handle.shutdown();
788        // Safety: drops once, never accessed again
789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
790    }
791}
792
793impl fidl::endpoints::Responder for InspectSinkFetchEscrowResponder {
794    type ControlHandle = InspectSinkControlHandle;
795
796    fn control_handle(&self) -> &InspectSinkControlHandle {
797        &self.control_handle
798    }
799
800    fn drop_without_shutdown(mut self) {
801        // Safety: drops once, never accessed again due to mem::forget
802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
803        // Prevent Drop from running (which would shut down the channel)
804        std::mem::forget(self);
805    }
806}
807
808impl InspectSinkFetchEscrowResponder {
809    /// Sends a response to the FIDL transaction.
810    ///
811    /// Sets the channel to shutdown if an error occurs.
812    pub fn send(self, mut payload: InspectSinkFetchEscrowResponse) -> Result<(), fidl::Error> {
813        let _result = self.send_raw(payload);
814        if _result.is_err() {
815            self.control_handle.shutdown();
816        }
817        self.drop_without_shutdown();
818        _result
819    }
820
821    /// Similar to "send" but does not shutdown the channel if an error occurs.
822    pub fn send_no_shutdown_on_err(
823        self,
824        mut payload: InspectSinkFetchEscrowResponse,
825    ) -> Result<(), fidl::Error> {
826        let _result = self.send_raw(payload);
827        self.drop_without_shutdown();
828        _result
829    }
830
831    fn send_raw(&self, mut payload: InspectSinkFetchEscrowResponse) -> Result<(), fidl::Error> {
832        self.control_handle
833            .inner
834            .send::<fidl::encoding::FlexibleType<InspectSinkFetchEscrowResponse>>(
835                fidl::encoding::Flexible::new(&mut payload),
836                self.tx_id,
837                0x7b9faa1a6f8e666a,
838                fidl::encoding::DynamicFlags::FLEXIBLE,
839            )
840    }
841}
842
843#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
844pub struct TreeMarker;
845
846impl fidl::endpoints::ProtocolMarker for TreeMarker {
847    type Proxy = TreeProxy;
848    type RequestStream = TreeRequestStream;
849    #[cfg(target_os = "fuchsia")]
850    type SynchronousProxy = TreeSynchronousProxy;
851
852    const DEBUG_NAME: &'static str = "fuchsia.inspect.Tree";
853}
854impl fidl::endpoints::DiscoverableProtocolMarker for TreeMarker {}
855
856pub trait TreeProxyInterface: Send + Sync {
857    type GetContentResponseFut: std::future::Future<Output = Result<TreeContent, fidl::Error>>
858        + Send;
859    fn r#get_content(&self) -> Self::GetContentResponseFut;
860    fn r#list_child_names(
861        &self,
862        tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
863    ) -> Result<(), fidl::Error>;
864    fn r#open_child(
865        &self,
866        child_name: &str,
867        tree: fidl::endpoints::ServerEnd<TreeMarker>,
868    ) -> Result<(), fidl::Error>;
869}
870#[derive(Debug)]
871#[cfg(target_os = "fuchsia")]
872pub struct TreeSynchronousProxy {
873    client: fidl::client::sync::Client,
874}
875
876#[cfg(target_os = "fuchsia")]
877impl fidl::endpoints::SynchronousProxy for TreeSynchronousProxy {
878    type Proxy = TreeProxy;
879    type Protocol = TreeMarker;
880
881    fn from_channel(inner: fidl::Channel) -> Self {
882        Self::new(inner)
883    }
884
885    fn into_channel(self) -> fidl::Channel {
886        self.client.into_channel()
887    }
888
889    fn as_channel(&self) -> &fidl::Channel {
890        self.client.as_channel()
891    }
892}
893
894#[cfg(target_os = "fuchsia")]
895impl TreeSynchronousProxy {
896    pub fn new(channel: fidl::Channel) -> Self {
897        let protocol_name = <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
898        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
899    }
900
901    pub fn into_channel(self) -> fidl::Channel {
902        self.client.into_channel()
903    }
904
905    /// Waits until an event arrives and returns it. It is safe for other
906    /// threads to make concurrent requests while waiting for an event.
907    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<TreeEvent, fidl::Error> {
908        TreeEvent::decode(self.client.wait_for_event(deadline)?)
909    }
910
911    /// Get the content for the Inspect VMO backing this tree.
912    ///
913    /// So long as the Tree connection is still maintained, the contents
914    /// of the tree are guaranteed to still be live. Once the connection is
915    /// lost, the serving component is free to clear the contents of returned
916    /// shared buffers.
917    ///
918    /// Serving components may return different buffers to GetContent
919    /// requests for the same Tree.
920    pub fn r#get_content(
921        &self,
922        ___deadline: zx::MonotonicInstant,
923    ) -> Result<TreeContent, fidl::Error> {
924        let _response =
925            self.client.send_query::<fidl::encoding::EmptyPayload, TreeGetContentResponse>(
926                (),
927                0x6ce0c1e42f903b47,
928                fidl::encoding::DynamicFlags::empty(),
929                ___deadline,
930            )?;
931        Ok(_response.content)
932    }
933
934    /// Iterate over the names of Trees that are children of this Tree.
935    ///
936    /// The underlying list of children may change in between calls to
937    /// ListChildNames and OpenChild.
938    pub fn r#list_child_names(
939        &self,
940        mut tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
941    ) -> Result<(), fidl::Error> {
942        self.client.send::<TreeListChildNamesRequest>(
943            (tree_iterator,),
944            0x577c988a830784a3,
945            fidl::encoding::DynamicFlags::empty(),
946        )
947    }
948
949    /// Open a child Tree by name.
950    ///
951    /// If the child cannot be opened, the given request is closed.
952    pub fn r#open_child(
953        &self,
954        mut child_name: &str,
955        mut tree: fidl::endpoints::ServerEnd<TreeMarker>,
956    ) -> Result<(), fidl::Error> {
957        self.client.send::<TreeOpenChildRequest>(
958            (child_name, tree),
959            0x526e35326e80a1b3,
960            fidl::encoding::DynamicFlags::empty(),
961        )
962    }
963}
964
965#[cfg(target_os = "fuchsia")]
966impl From<TreeSynchronousProxy> for zx::NullableHandle {
967    fn from(value: TreeSynchronousProxy) -> Self {
968        value.into_channel().into()
969    }
970}
971
972#[cfg(target_os = "fuchsia")]
973impl From<fidl::Channel> for TreeSynchronousProxy {
974    fn from(value: fidl::Channel) -> Self {
975        Self::new(value)
976    }
977}
978
979#[cfg(target_os = "fuchsia")]
980impl fidl::endpoints::FromClient for TreeSynchronousProxy {
981    type Protocol = TreeMarker;
982
983    fn from_client(value: fidl::endpoints::ClientEnd<TreeMarker>) -> Self {
984        Self::new(value.into_channel())
985    }
986}
987
988#[derive(Debug, Clone)]
989pub struct TreeProxy {
990    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
991}
992
993impl fidl::endpoints::Proxy for TreeProxy {
994    type Protocol = TreeMarker;
995
996    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
997        Self::new(inner)
998    }
999
1000    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1001        self.client.into_channel().map_err(|client| Self { client })
1002    }
1003
1004    fn as_channel(&self) -> &::fidl::AsyncChannel {
1005        self.client.as_channel()
1006    }
1007}
1008
1009impl TreeProxy {
1010    /// Create a new Proxy for fuchsia.inspect/Tree.
1011    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1012        let protocol_name = <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1013        Self { client: fidl::client::Client::new(channel, protocol_name) }
1014    }
1015
1016    /// Get a Stream of events from the remote end of the protocol.
1017    ///
1018    /// # Panics
1019    ///
1020    /// Panics if the event stream was already taken.
1021    pub fn take_event_stream(&self) -> TreeEventStream {
1022        TreeEventStream { event_receiver: self.client.take_event_receiver() }
1023    }
1024
1025    /// Get the content for the Inspect VMO backing this tree.
1026    ///
1027    /// So long as the Tree connection is still maintained, the contents
1028    /// of the tree are guaranteed to still be live. Once the connection is
1029    /// lost, the serving component is free to clear the contents of returned
1030    /// shared buffers.
1031    ///
1032    /// Serving components may return different buffers to GetContent
1033    /// requests for the same Tree.
1034    pub fn r#get_content(
1035        &self,
1036    ) -> fidl::client::QueryResponseFut<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>
1037    {
1038        TreeProxyInterface::r#get_content(self)
1039    }
1040
1041    /// Iterate over the names of Trees that are children of this Tree.
1042    ///
1043    /// The underlying list of children may change in between calls to
1044    /// ListChildNames and OpenChild.
1045    pub fn r#list_child_names(
1046        &self,
1047        mut tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
1048    ) -> Result<(), fidl::Error> {
1049        TreeProxyInterface::r#list_child_names(self, tree_iterator)
1050    }
1051
1052    /// Open a child Tree by name.
1053    ///
1054    /// If the child cannot be opened, the given request is closed.
1055    pub fn r#open_child(
1056        &self,
1057        mut child_name: &str,
1058        mut tree: fidl::endpoints::ServerEnd<TreeMarker>,
1059    ) -> Result<(), fidl::Error> {
1060        TreeProxyInterface::r#open_child(self, child_name, tree)
1061    }
1062}
1063
1064impl TreeProxyInterface for TreeProxy {
1065    type GetContentResponseFut =
1066        fidl::client::QueryResponseFut<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>;
1067    fn r#get_content(&self) -> Self::GetContentResponseFut {
1068        fn _decode(
1069            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1070        ) -> Result<TreeContent, fidl::Error> {
1071            let _response = fidl::client::decode_transaction_body::<
1072                TreeGetContentResponse,
1073                fidl::encoding::DefaultFuchsiaResourceDialect,
1074                0x6ce0c1e42f903b47,
1075            >(_buf?)?;
1076            Ok(_response.content)
1077        }
1078        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TreeContent>(
1079            (),
1080            0x6ce0c1e42f903b47,
1081            fidl::encoding::DynamicFlags::empty(),
1082            _decode,
1083        )
1084    }
1085
1086    fn r#list_child_names(
1087        &self,
1088        mut tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
1089    ) -> Result<(), fidl::Error> {
1090        self.client.send::<TreeListChildNamesRequest>(
1091            (tree_iterator,),
1092            0x577c988a830784a3,
1093            fidl::encoding::DynamicFlags::empty(),
1094        )
1095    }
1096
1097    fn r#open_child(
1098        &self,
1099        mut child_name: &str,
1100        mut tree: fidl::endpoints::ServerEnd<TreeMarker>,
1101    ) -> Result<(), fidl::Error> {
1102        self.client.send::<TreeOpenChildRequest>(
1103            (child_name, tree),
1104            0x526e35326e80a1b3,
1105            fidl::encoding::DynamicFlags::empty(),
1106        )
1107    }
1108}
1109
1110pub struct TreeEventStream {
1111    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1112}
1113
1114impl std::marker::Unpin for TreeEventStream {}
1115
1116impl futures::stream::FusedStream for TreeEventStream {
1117    fn is_terminated(&self) -> bool {
1118        self.event_receiver.is_terminated()
1119    }
1120}
1121
1122impl futures::Stream for TreeEventStream {
1123    type Item = Result<TreeEvent, fidl::Error>;
1124
1125    fn poll_next(
1126        mut self: std::pin::Pin<&mut Self>,
1127        cx: &mut std::task::Context<'_>,
1128    ) -> std::task::Poll<Option<Self::Item>> {
1129        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1130            &mut self.event_receiver,
1131            cx
1132        )?) {
1133            Some(buf) => std::task::Poll::Ready(Some(TreeEvent::decode(buf))),
1134            None => std::task::Poll::Ready(None),
1135        }
1136    }
1137}
1138
1139#[derive(Debug)]
1140pub enum TreeEvent {
1141    #[non_exhaustive]
1142    _UnknownEvent {
1143        /// Ordinal of the event that was sent.
1144        ordinal: u64,
1145    },
1146}
1147
1148impl TreeEvent {
1149    /// Decodes a message buffer as a [`TreeEvent`].
1150    fn decode(
1151        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1152    ) -> Result<TreeEvent, fidl::Error> {
1153        let (bytes, _handles) = buf.split_mut();
1154        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1155        debug_assert_eq!(tx_header.tx_id, 0);
1156        match tx_header.ordinal {
1157            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1158                Ok(TreeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1159            }
1160            _ => Err(fidl::Error::UnknownOrdinal {
1161                ordinal: tx_header.ordinal,
1162                protocol_name: <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1163            }),
1164        }
1165    }
1166}
1167
1168/// A Stream of incoming requests for fuchsia.inspect/Tree.
1169pub struct TreeRequestStream {
1170    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1171    is_terminated: bool,
1172}
1173
1174impl std::marker::Unpin for TreeRequestStream {}
1175
1176impl futures::stream::FusedStream for TreeRequestStream {
1177    fn is_terminated(&self) -> bool {
1178        self.is_terminated
1179    }
1180}
1181
1182impl fidl::endpoints::RequestStream for TreeRequestStream {
1183    type Protocol = TreeMarker;
1184    type ControlHandle = TreeControlHandle;
1185
1186    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1187        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1188    }
1189
1190    fn control_handle(&self) -> Self::ControlHandle {
1191        TreeControlHandle { inner: self.inner.clone() }
1192    }
1193
1194    fn into_inner(
1195        self,
1196    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1197    {
1198        (self.inner, self.is_terminated)
1199    }
1200
1201    fn from_inner(
1202        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1203        is_terminated: bool,
1204    ) -> Self {
1205        Self { inner, is_terminated }
1206    }
1207}
1208
1209impl futures::Stream for TreeRequestStream {
1210    type Item = Result<TreeRequest, fidl::Error>;
1211
1212    fn poll_next(
1213        mut self: std::pin::Pin<&mut Self>,
1214        cx: &mut std::task::Context<'_>,
1215    ) -> std::task::Poll<Option<Self::Item>> {
1216        let this = &mut *self;
1217        if this.inner.check_shutdown(cx) {
1218            this.is_terminated = true;
1219            return std::task::Poll::Ready(None);
1220        }
1221        if this.is_terminated {
1222            panic!("polled TreeRequestStream after completion");
1223        }
1224        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1225            |bytes, handles| {
1226                match this.inner.channel().read_etc(cx, bytes, handles) {
1227                    std::task::Poll::Ready(Ok(())) => {}
1228                    std::task::Poll::Pending => return std::task::Poll::Pending,
1229                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1230                        this.is_terminated = true;
1231                        return std::task::Poll::Ready(None);
1232                    }
1233                    std::task::Poll::Ready(Err(e)) => {
1234                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1235                            e.into(),
1236                        ))));
1237                    }
1238                }
1239
1240                // A message has been received from the channel
1241                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1242
1243                std::task::Poll::Ready(Some(match header.ordinal {
1244                    0x6ce0c1e42f903b47 => {
1245                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1246                        let mut req = fidl::new_empty!(
1247                            fidl::encoding::EmptyPayload,
1248                            fidl::encoding::DefaultFuchsiaResourceDialect
1249                        );
1250                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1251                        let control_handle = TreeControlHandle { inner: this.inner.clone() };
1252                        Ok(TreeRequest::GetContent {
1253                            responder: TreeGetContentResponder {
1254                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1255                                tx_id: header.tx_id,
1256                            },
1257                        })
1258                    }
1259                    0x577c988a830784a3 => {
1260                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1261                        let mut req = fidl::new_empty!(
1262                            TreeListChildNamesRequest,
1263                            fidl::encoding::DefaultFuchsiaResourceDialect
1264                        );
1265                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TreeListChildNamesRequest>(&header, _body_bytes, handles, &mut req)?;
1266                        let control_handle = TreeControlHandle { inner: this.inner.clone() };
1267                        Ok(TreeRequest::ListChildNames {
1268                            tree_iterator: req.tree_iterator,
1269
1270                            control_handle,
1271                        })
1272                    }
1273                    0x526e35326e80a1b3 => {
1274                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1275                        let mut req = fidl::new_empty!(
1276                            TreeOpenChildRequest,
1277                            fidl::encoding::DefaultFuchsiaResourceDialect
1278                        );
1279                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TreeOpenChildRequest>(&header, _body_bytes, handles, &mut req)?;
1280                        let control_handle = TreeControlHandle { inner: this.inner.clone() };
1281                        Ok(TreeRequest::OpenChild {
1282                            child_name: req.child_name,
1283                            tree: req.tree,
1284
1285                            control_handle,
1286                        })
1287                    }
1288                    _ if header.tx_id == 0
1289                        && header
1290                            .dynamic_flags()
1291                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1292                    {
1293                        Ok(TreeRequest::_UnknownMethod {
1294                            ordinal: header.ordinal,
1295                            control_handle: TreeControlHandle { inner: this.inner.clone() },
1296                            method_type: fidl::MethodType::OneWay,
1297                        })
1298                    }
1299                    _ if header
1300                        .dynamic_flags()
1301                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1302                    {
1303                        this.inner.send_framework_err(
1304                            fidl::encoding::FrameworkErr::UnknownMethod,
1305                            header.tx_id,
1306                            header.ordinal,
1307                            header.dynamic_flags(),
1308                            (bytes, handles),
1309                        )?;
1310                        Ok(TreeRequest::_UnknownMethod {
1311                            ordinal: header.ordinal,
1312                            control_handle: TreeControlHandle { inner: this.inner.clone() },
1313                            method_type: fidl::MethodType::TwoWay,
1314                        })
1315                    }
1316                    _ => Err(fidl::Error::UnknownOrdinal {
1317                        ordinal: header.ordinal,
1318                        protocol_name: <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1319                    }),
1320                }))
1321            },
1322        )
1323    }
1324}
1325
1326/// The Tree protocol represents a hierarchy of Inspect VMOs.
1327///
1328/// Link values stored in an Inspect file contain references to new
1329/// named files that contain a continuation of the data for the overall
1330/// hierarchy. Protocol Tree allows clients to request these named files so
1331/// long as the hosting component is still alive.
1332///
1333/// Connecting to a particular tree keeps the content for that Tree resident
1334/// in memory. Clients are recommended to traverse the trees in depth-first
1335/// order to reduce memory usage. Serving components are free to deny
1336/// connections to avoid unbounded memory usage.
1337#[derive(Debug)]
1338pub enum TreeRequest {
1339    /// Get the content for the Inspect VMO backing this tree.
1340    ///
1341    /// So long as the Tree connection is still maintained, the contents
1342    /// of the tree are guaranteed to still be live. Once the connection is
1343    /// lost, the serving component is free to clear the contents of returned
1344    /// shared buffers.
1345    ///
1346    /// Serving components may return different buffers to GetContent
1347    /// requests for the same Tree.
1348    GetContent { responder: TreeGetContentResponder },
1349    /// Iterate over the names of Trees that are children of this Tree.
1350    ///
1351    /// The underlying list of children may change in between calls to
1352    /// ListChildNames and OpenChild.
1353    ListChildNames {
1354        tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
1355        control_handle: TreeControlHandle,
1356    },
1357    /// Open a child Tree by name.
1358    ///
1359    /// If the child cannot be opened, the given request is closed.
1360    OpenChild {
1361        child_name: String,
1362        tree: fidl::endpoints::ServerEnd<TreeMarker>,
1363        control_handle: TreeControlHandle,
1364    },
1365    /// An interaction was received which does not match any known method.
1366    #[non_exhaustive]
1367    _UnknownMethod {
1368        /// Ordinal of the method that was called.
1369        ordinal: u64,
1370        control_handle: TreeControlHandle,
1371        method_type: fidl::MethodType,
1372    },
1373}
1374
1375impl TreeRequest {
1376    #[allow(irrefutable_let_patterns)]
1377    pub fn into_get_content(self) -> Option<(TreeGetContentResponder)> {
1378        if let TreeRequest::GetContent { responder } = self { Some((responder)) } else { None }
1379    }
1380
1381    #[allow(irrefutable_let_patterns)]
1382    pub fn into_list_child_names(
1383        self,
1384    ) -> Option<(fidl::endpoints::ServerEnd<TreeNameIteratorMarker>, TreeControlHandle)> {
1385        if let TreeRequest::ListChildNames { tree_iterator, control_handle } = self {
1386            Some((tree_iterator, control_handle))
1387        } else {
1388            None
1389        }
1390    }
1391
1392    #[allow(irrefutable_let_patterns)]
1393    pub fn into_open_child(
1394        self,
1395    ) -> Option<(String, fidl::endpoints::ServerEnd<TreeMarker>, TreeControlHandle)> {
1396        if let TreeRequest::OpenChild { child_name, tree, control_handle } = self {
1397            Some((child_name, tree, control_handle))
1398        } else {
1399            None
1400        }
1401    }
1402
1403    /// Name of the method defined in FIDL
1404    pub fn method_name(&self) -> &'static str {
1405        match *self {
1406            TreeRequest::GetContent { .. } => "get_content",
1407            TreeRequest::ListChildNames { .. } => "list_child_names",
1408            TreeRequest::OpenChild { .. } => "open_child",
1409            TreeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1410                "unknown one-way method"
1411            }
1412            TreeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1413                "unknown two-way method"
1414            }
1415        }
1416    }
1417}
1418
1419#[derive(Debug, Clone)]
1420pub struct TreeControlHandle {
1421    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1422}
1423
1424impl fidl::endpoints::ControlHandle for TreeControlHandle {
1425    fn shutdown(&self) {
1426        self.inner.shutdown()
1427    }
1428
1429    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1430        self.inner.shutdown_with_epitaph(status)
1431    }
1432
1433    fn is_closed(&self) -> bool {
1434        self.inner.channel().is_closed()
1435    }
1436    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1437        self.inner.channel().on_closed()
1438    }
1439
1440    #[cfg(target_os = "fuchsia")]
1441    fn signal_peer(
1442        &self,
1443        clear_mask: zx::Signals,
1444        set_mask: zx::Signals,
1445    ) -> Result<(), zx_status::Status> {
1446        use fidl::Peered;
1447        self.inner.channel().signal_peer(clear_mask, set_mask)
1448    }
1449}
1450
1451impl TreeControlHandle {}
1452
1453#[must_use = "FIDL methods require a response to be sent"]
1454#[derive(Debug)]
1455pub struct TreeGetContentResponder {
1456    control_handle: std::mem::ManuallyDrop<TreeControlHandle>,
1457    tx_id: u32,
1458}
1459
1460/// Set the the channel to be shutdown (see [`TreeControlHandle::shutdown`])
1461/// if the responder is dropped without sending a response, so that the client
1462/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1463impl std::ops::Drop for TreeGetContentResponder {
1464    fn drop(&mut self) {
1465        self.control_handle.shutdown();
1466        // Safety: drops once, never accessed again
1467        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1468    }
1469}
1470
1471impl fidl::endpoints::Responder for TreeGetContentResponder {
1472    type ControlHandle = TreeControlHandle;
1473
1474    fn control_handle(&self) -> &TreeControlHandle {
1475        &self.control_handle
1476    }
1477
1478    fn drop_without_shutdown(mut self) {
1479        // Safety: drops once, never accessed again due to mem::forget
1480        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1481        // Prevent Drop from running (which would shut down the channel)
1482        std::mem::forget(self);
1483    }
1484}
1485
1486impl TreeGetContentResponder {
1487    /// Sends a response to the FIDL transaction.
1488    ///
1489    /// Sets the channel to shutdown if an error occurs.
1490    pub fn send(self, mut content: TreeContent) -> Result<(), fidl::Error> {
1491        let _result = self.send_raw(content);
1492        if _result.is_err() {
1493            self.control_handle.shutdown();
1494        }
1495        self.drop_without_shutdown();
1496        _result
1497    }
1498
1499    /// Similar to "send" but does not shutdown the channel if an error occurs.
1500    pub fn send_no_shutdown_on_err(self, mut content: TreeContent) -> Result<(), fidl::Error> {
1501        let _result = self.send_raw(content);
1502        self.drop_without_shutdown();
1503        _result
1504    }
1505
1506    fn send_raw(&self, mut content: TreeContent) -> Result<(), fidl::Error> {
1507        self.control_handle.inner.send::<TreeGetContentResponse>(
1508            (&mut content,),
1509            self.tx_id,
1510            0x6ce0c1e42f903b47,
1511            fidl::encoding::DynamicFlags::empty(),
1512        )
1513    }
1514}
1515
1516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1517pub struct TreeNameIteratorMarker;
1518
1519impl fidl::endpoints::ProtocolMarker for TreeNameIteratorMarker {
1520    type Proxy = TreeNameIteratorProxy;
1521    type RequestStream = TreeNameIteratorRequestStream;
1522    #[cfg(target_os = "fuchsia")]
1523    type SynchronousProxy = TreeNameIteratorSynchronousProxy;
1524
1525    const DEBUG_NAME: &'static str = "(anonymous) TreeNameIterator";
1526}
1527
1528pub trait TreeNameIteratorProxyInterface: Send + Sync {
1529    type GetNextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
1530    fn r#get_next(&self) -> Self::GetNextResponseFut;
1531}
1532#[derive(Debug)]
1533#[cfg(target_os = "fuchsia")]
1534pub struct TreeNameIteratorSynchronousProxy {
1535    client: fidl::client::sync::Client,
1536}
1537
1538#[cfg(target_os = "fuchsia")]
1539impl fidl::endpoints::SynchronousProxy for TreeNameIteratorSynchronousProxy {
1540    type Proxy = TreeNameIteratorProxy;
1541    type Protocol = TreeNameIteratorMarker;
1542
1543    fn from_channel(inner: fidl::Channel) -> Self {
1544        Self::new(inner)
1545    }
1546
1547    fn into_channel(self) -> fidl::Channel {
1548        self.client.into_channel()
1549    }
1550
1551    fn as_channel(&self) -> &fidl::Channel {
1552        self.client.as_channel()
1553    }
1554}
1555
1556#[cfg(target_os = "fuchsia")]
1557impl TreeNameIteratorSynchronousProxy {
1558    pub fn new(channel: fidl::Channel) -> Self {
1559        let protocol_name = <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1560        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1561    }
1562
1563    pub fn into_channel(self) -> fidl::Channel {
1564        self.client.into_channel()
1565    }
1566
1567    /// Waits until an event arrives and returns it. It is safe for other
1568    /// threads to make concurrent requests while waiting for an event.
1569    pub fn wait_for_event(
1570        &self,
1571        deadline: zx::MonotonicInstant,
1572    ) -> Result<TreeNameIteratorEvent, fidl::Error> {
1573        TreeNameIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1574    }
1575
1576    /// Get the next batch of names.
1577    ///
1578    /// Returns an empty vector and closes the channel when no more names are present.
1579    /// Implementors may eagerly close the channel after sending the last batch.
1580    pub fn r#get_next(
1581        &self,
1582        ___deadline: zx::MonotonicInstant,
1583    ) -> Result<Vec<String>, fidl::Error> {
1584        let _response = self
1585            .client
1586            .send_query::<fidl::encoding::EmptyPayload, TreeNameIteratorGetNextResponse>(
1587                (),
1588                0x6a7d7af5a325c8ac,
1589                fidl::encoding::DynamicFlags::empty(),
1590                ___deadline,
1591            )?;
1592        Ok(_response.name)
1593    }
1594}
1595
1596#[cfg(target_os = "fuchsia")]
1597impl From<TreeNameIteratorSynchronousProxy> for zx::NullableHandle {
1598    fn from(value: TreeNameIteratorSynchronousProxy) -> Self {
1599        value.into_channel().into()
1600    }
1601}
1602
1603#[cfg(target_os = "fuchsia")]
1604impl From<fidl::Channel> for TreeNameIteratorSynchronousProxy {
1605    fn from(value: fidl::Channel) -> Self {
1606        Self::new(value)
1607    }
1608}
1609
1610#[cfg(target_os = "fuchsia")]
1611impl fidl::endpoints::FromClient for TreeNameIteratorSynchronousProxy {
1612    type Protocol = TreeNameIteratorMarker;
1613
1614    fn from_client(value: fidl::endpoints::ClientEnd<TreeNameIteratorMarker>) -> Self {
1615        Self::new(value.into_channel())
1616    }
1617}
1618
1619#[derive(Debug, Clone)]
1620pub struct TreeNameIteratorProxy {
1621    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1622}
1623
1624impl fidl::endpoints::Proxy for TreeNameIteratorProxy {
1625    type Protocol = TreeNameIteratorMarker;
1626
1627    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1628        Self::new(inner)
1629    }
1630
1631    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1632        self.client.into_channel().map_err(|client| Self { client })
1633    }
1634
1635    fn as_channel(&self) -> &::fidl::AsyncChannel {
1636        self.client.as_channel()
1637    }
1638}
1639
1640impl TreeNameIteratorProxy {
1641    /// Create a new Proxy for fuchsia.inspect/TreeNameIterator.
1642    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1643        let protocol_name = <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1644        Self { client: fidl::client::Client::new(channel, protocol_name) }
1645    }
1646
1647    /// Get a Stream of events from the remote end of the protocol.
1648    ///
1649    /// # Panics
1650    ///
1651    /// Panics if the event stream was already taken.
1652    pub fn take_event_stream(&self) -> TreeNameIteratorEventStream {
1653        TreeNameIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1654    }
1655
1656    /// Get the next batch of names.
1657    ///
1658    /// Returns an empty vector and closes the channel when no more names are present.
1659    /// Implementors may eagerly close the channel after sending the last batch.
1660    pub fn r#get_next(
1661        &self,
1662    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
1663    {
1664        TreeNameIteratorProxyInterface::r#get_next(self)
1665    }
1666}
1667
1668impl TreeNameIteratorProxyInterface for TreeNameIteratorProxy {
1669    type GetNextResponseFut =
1670        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1671    fn r#get_next(&self) -> Self::GetNextResponseFut {
1672        fn _decode(
1673            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1674        ) -> Result<Vec<String>, fidl::Error> {
1675            let _response = fidl::client::decode_transaction_body::<
1676                TreeNameIteratorGetNextResponse,
1677                fidl::encoding::DefaultFuchsiaResourceDialect,
1678                0x6a7d7af5a325c8ac,
1679            >(_buf?)?;
1680            Ok(_response.name)
1681        }
1682        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
1683            (),
1684            0x6a7d7af5a325c8ac,
1685            fidl::encoding::DynamicFlags::empty(),
1686            _decode,
1687        )
1688    }
1689}
1690
1691pub struct TreeNameIteratorEventStream {
1692    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1693}
1694
1695impl std::marker::Unpin for TreeNameIteratorEventStream {}
1696
1697impl futures::stream::FusedStream for TreeNameIteratorEventStream {
1698    fn is_terminated(&self) -> bool {
1699        self.event_receiver.is_terminated()
1700    }
1701}
1702
1703impl futures::Stream for TreeNameIteratorEventStream {
1704    type Item = Result<TreeNameIteratorEvent, fidl::Error>;
1705
1706    fn poll_next(
1707        mut self: std::pin::Pin<&mut Self>,
1708        cx: &mut std::task::Context<'_>,
1709    ) -> std::task::Poll<Option<Self::Item>> {
1710        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1711            &mut self.event_receiver,
1712            cx
1713        )?) {
1714            Some(buf) => std::task::Poll::Ready(Some(TreeNameIteratorEvent::decode(buf))),
1715            None => std::task::Poll::Ready(None),
1716        }
1717    }
1718}
1719
1720#[derive(Debug)]
1721pub enum TreeNameIteratorEvent {
1722    #[non_exhaustive]
1723    _UnknownEvent {
1724        /// Ordinal of the event that was sent.
1725        ordinal: u64,
1726    },
1727}
1728
1729impl TreeNameIteratorEvent {
1730    /// Decodes a message buffer as a [`TreeNameIteratorEvent`].
1731    fn decode(
1732        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1733    ) -> Result<TreeNameIteratorEvent, fidl::Error> {
1734        let (bytes, _handles) = buf.split_mut();
1735        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1736        debug_assert_eq!(tx_header.tx_id, 0);
1737        match tx_header.ordinal {
1738            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1739                Ok(TreeNameIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1740            }
1741            _ => Err(fidl::Error::UnknownOrdinal {
1742                ordinal: tx_header.ordinal,
1743                protocol_name:
1744                    <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1745            }),
1746        }
1747    }
1748}
1749
1750/// A Stream of incoming requests for fuchsia.inspect/TreeNameIterator.
1751pub struct TreeNameIteratorRequestStream {
1752    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1753    is_terminated: bool,
1754}
1755
1756impl std::marker::Unpin for TreeNameIteratorRequestStream {}
1757
1758impl futures::stream::FusedStream for TreeNameIteratorRequestStream {
1759    fn is_terminated(&self) -> bool {
1760        self.is_terminated
1761    }
1762}
1763
1764impl fidl::endpoints::RequestStream for TreeNameIteratorRequestStream {
1765    type Protocol = TreeNameIteratorMarker;
1766    type ControlHandle = TreeNameIteratorControlHandle;
1767
1768    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1769        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1770    }
1771
1772    fn control_handle(&self) -> Self::ControlHandle {
1773        TreeNameIteratorControlHandle { inner: self.inner.clone() }
1774    }
1775
1776    fn into_inner(
1777        self,
1778    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1779    {
1780        (self.inner, self.is_terminated)
1781    }
1782
1783    fn from_inner(
1784        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1785        is_terminated: bool,
1786    ) -> Self {
1787        Self { inner, is_terminated }
1788    }
1789}
1790
1791impl futures::Stream for TreeNameIteratorRequestStream {
1792    type Item = Result<TreeNameIteratorRequest, fidl::Error>;
1793
1794    fn poll_next(
1795        mut self: std::pin::Pin<&mut Self>,
1796        cx: &mut std::task::Context<'_>,
1797    ) -> std::task::Poll<Option<Self::Item>> {
1798        let this = &mut *self;
1799        if this.inner.check_shutdown(cx) {
1800            this.is_terminated = true;
1801            return std::task::Poll::Ready(None);
1802        }
1803        if this.is_terminated {
1804            panic!("polled TreeNameIteratorRequestStream after completion");
1805        }
1806        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1807            |bytes, handles| {
1808                match this.inner.channel().read_etc(cx, bytes, handles) {
1809                    std::task::Poll::Ready(Ok(())) => {}
1810                    std::task::Poll::Pending => return std::task::Poll::Pending,
1811                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1812                        this.is_terminated = true;
1813                        return std::task::Poll::Ready(None);
1814                    }
1815                    std::task::Poll::Ready(Err(e)) => {
1816                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1817                            e.into(),
1818                        ))));
1819                    }
1820                }
1821
1822                // A message has been received from the channel
1823                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1824
1825                std::task::Poll::Ready(Some(match header.ordinal {
1826                    0x6a7d7af5a325c8ac => {
1827                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1828                        let mut req = fidl::new_empty!(
1829                            fidl::encoding::EmptyPayload,
1830                            fidl::encoding::DefaultFuchsiaResourceDialect
1831                        );
1832                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1833                        let control_handle =
1834                            TreeNameIteratorControlHandle { inner: this.inner.clone() };
1835                        Ok(TreeNameIteratorRequest::GetNext {
1836                            responder: TreeNameIteratorGetNextResponder {
1837                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1838                                tx_id: header.tx_id,
1839                            },
1840                        })
1841                    }
1842                    _ if header.tx_id == 0
1843                        && header
1844                            .dynamic_flags()
1845                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1846                    {
1847                        Ok(TreeNameIteratorRequest::_UnknownMethod {
1848                            ordinal: header.ordinal,
1849                            control_handle: TreeNameIteratorControlHandle {
1850                                inner: this.inner.clone(),
1851                            },
1852                            method_type: fidl::MethodType::OneWay,
1853                        })
1854                    }
1855                    _ if header
1856                        .dynamic_flags()
1857                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1858                    {
1859                        this.inner.send_framework_err(
1860                            fidl::encoding::FrameworkErr::UnknownMethod,
1861                            header.tx_id,
1862                            header.ordinal,
1863                            header.dynamic_flags(),
1864                            (bytes, handles),
1865                        )?;
1866                        Ok(TreeNameIteratorRequest::_UnknownMethod {
1867                            ordinal: header.ordinal,
1868                            control_handle: TreeNameIteratorControlHandle {
1869                                inner: this.inner.clone(),
1870                            },
1871                            method_type: fidl::MethodType::TwoWay,
1872                        })
1873                    }
1874                    _ => Err(fidl::Error::UnknownOrdinal {
1875                        ordinal: header.ordinal,
1876                        protocol_name:
1877                            <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1878                    }),
1879                }))
1880            },
1881        )
1882    }
1883}
1884
1885/// Iterator protocol for listing the names of children of a particular Tree.
1886#[derive(Debug)]
1887pub enum TreeNameIteratorRequest {
1888    /// Get the next batch of names.
1889    ///
1890    /// Returns an empty vector and closes the channel when no more names are present.
1891    /// Implementors may eagerly close the channel after sending the last batch.
1892    GetNext { responder: TreeNameIteratorGetNextResponder },
1893    /// An interaction was received which does not match any known method.
1894    #[non_exhaustive]
1895    _UnknownMethod {
1896        /// Ordinal of the method that was called.
1897        ordinal: u64,
1898        control_handle: TreeNameIteratorControlHandle,
1899        method_type: fidl::MethodType,
1900    },
1901}
1902
1903impl TreeNameIteratorRequest {
1904    #[allow(irrefutable_let_patterns)]
1905    pub fn into_get_next(self) -> Option<(TreeNameIteratorGetNextResponder)> {
1906        if let TreeNameIteratorRequest::GetNext { responder } = self {
1907            Some((responder))
1908        } else {
1909            None
1910        }
1911    }
1912
1913    /// Name of the method defined in FIDL
1914    pub fn method_name(&self) -> &'static str {
1915        match *self {
1916            TreeNameIteratorRequest::GetNext { .. } => "get_next",
1917            TreeNameIteratorRequest::_UnknownMethod {
1918                method_type: fidl::MethodType::OneWay,
1919                ..
1920            } => "unknown one-way method",
1921            TreeNameIteratorRequest::_UnknownMethod {
1922                method_type: fidl::MethodType::TwoWay,
1923                ..
1924            } => "unknown two-way method",
1925        }
1926    }
1927}
1928
1929#[derive(Debug, Clone)]
1930pub struct TreeNameIteratorControlHandle {
1931    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1932}
1933
1934impl fidl::endpoints::ControlHandle for TreeNameIteratorControlHandle {
1935    fn shutdown(&self) {
1936        self.inner.shutdown()
1937    }
1938
1939    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1940        self.inner.shutdown_with_epitaph(status)
1941    }
1942
1943    fn is_closed(&self) -> bool {
1944        self.inner.channel().is_closed()
1945    }
1946    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1947        self.inner.channel().on_closed()
1948    }
1949
1950    #[cfg(target_os = "fuchsia")]
1951    fn signal_peer(
1952        &self,
1953        clear_mask: zx::Signals,
1954        set_mask: zx::Signals,
1955    ) -> Result<(), zx_status::Status> {
1956        use fidl::Peered;
1957        self.inner.channel().signal_peer(clear_mask, set_mask)
1958    }
1959}
1960
1961impl TreeNameIteratorControlHandle {}
1962
1963#[must_use = "FIDL methods require a response to be sent"]
1964#[derive(Debug)]
1965pub struct TreeNameIteratorGetNextResponder {
1966    control_handle: std::mem::ManuallyDrop<TreeNameIteratorControlHandle>,
1967    tx_id: u32,
1968}
1969
1970/// Set the the channel to be shutdown (see [`TreeNameIteratorControlHandle::shutdown`])
1971/// if the responder is dropped without sending a response, so that the client
1972/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1973impl std::ops::Drop for TreeNameIteratorGetNextResponder {
1974    fn drop(&mut self) {
1975        self.control_handle.shutdown();
1976        // Safety: drops once, never accessed again
1977        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1978    }
1979}
1980
1981impl fidl::endpoints::Responder for TreeNameIteratorGetNextResponder {
1982    type ControlHandle = TreeNameIteratorControlHandle;
1983
1984    fn control_handle(&self) -> &TreeNameIteratorControlHandle {
1985        &self.control_handle
1986    }
1987
1988    fn drop_without_shutdown(mut self) {
1989        // Safety: drops once, never accessed again due to mem::forget
1990        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1991        // Prevent Drop from running (which would shut down the channel)
1992        std::mem::forget(self);
1993    }
1994}
1995
1996impl TreeNameIteratorGetNextResponder {
1997    /// Sends a response to the FIDL transaction.
1998    ///
1999    /// Sets the channel to shutdown if an error occurs.
2000    pub fn send(self, mut name: &[String]) -> Result<(), fidl::Error> {
2001        let _result = self.send_raw(name);
2002        if _result.is_err() {
2003            self.control_handle.shutdown();
2004        }
2005        self.drop_without_shutdown();
2006        _result
2007    }
2008
2009    /// Similar to "send" but does not shutdown the channel if an error occurs.
2010    pub fn send_no_shutdown_on_err(self, mut name: &[String]) -> Result<(), fidl::Error> {
2011        let _result = self.send_raw(name);
2012        self.drop_without_shutdown();
2013        _result
2014    }
2015
2016    fn send_raw(&self, mut name: &[String]) -> Result<(), fidl::Error> {
2017        self.control_handle.inner.send::<TreeNameIteratorGetNextResponse>(
2018            (name,),
2019            self.tx_id,
2020            0x6a7d7af5a325c8ac,
2021            fidl::encoding::DynamicFlags::empty(),
2022        )
2023    }
2024}
2025
2026mod internal {
2027    use super::*;
2028
2029    impl fidl::encoding::ResourceTypeMarker for EscrowToken {
2030        type Borrowed<'a> = &'a mut Self;
2031        fn take_or_borrow<'a>(
2032            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2033        ) -> Self::Borrowed<'a> {
2034            value
2035        }
2036    }
2037
2038    unsafe impl fidl::encoding::TypeMarker for EscrowToken {
2039        type Owned = Self;
2040
2041        #[inline(always)]
2042        fn inline_align(_context: fidl::encoding::Context) -> usize {
2043            4
2044        }
2045
2046        #[inline(always)]
2047        fn inline_size(_context: fidl::encoding::Context) -> usize {
2048            4
2049        }
2050    }
2051
2052    unsafe impl fidl::encoding::Encode<EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>
2053        for &mut EscrowToken
2054    {
2055        #[inline]
2056        unsafe fn encode(
2057            self,
2058            encoder: &mut fidl::encoding::Encoder<
2059                '_,
2060                fidl::encoding::DefaultFuchsiaResourceDialect,
2061            >,
2062            offset: usize,
2063            _depth: fidl::encoding::Depth,
2064        ) -> fidl::Result<()> {
2065            encoder.debug_check_bounds::<EscrowToken>(offset);
2066            // Delegate to tuple encoding.
2067            fidl::encoding::Encode::<EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2068                (
2069                    <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 49154> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
2070                ),
2071                encoder, offset, _depth
2072            )
2073        }
2074    }
2075    unsafe impl<
2076        T0: fidl::encoding::Encode<
2077                fidl::encoding::HandleType<
2078                    fidl::EventPair,
2079                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2080                    49154,
2081                >,
2082                fidl::encoding::DefaultFuchsiaResourceDialect,
2083            >,
2084    > fidl::encoding::Encode<EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0,)
2085    {
2086        #[inline]
2087        unsafe fn encode(
2088            self,
2089            encoder: &mut fidl::encoding::Encoder<
2090                '_,
2091                fidl::encoding::DefaultFuchsiaResourceDialect,
2092            >,
2093            offset: usize,
2094            depth: fidl::encoding::Depth,
2095        ) -> fidl::Result<()> {
2096            encoder.debug_check_bounds::<EscrowToken>(offset);
2097            // Zero out padding regions. There's no need to apply masks
2098            // because the unmasked parts will be overwritten by fields.
2099            // Write the fields.
2100            self.0.encode(encoder, offset + 0, depth)?;
2101            Ok(())
2102        }
2103    }
2104
2105    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for EscrowToken {
2106        #[inline(always)]
2107        fn new_empty() -> Self {
2108            Self {
2109                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 49154>, fidl::encoding::DefaultFuchsiaResourceDialect),
2110            }
2111        }
2112
2113        #[inline]
2114        unsafe fn decode(
2115            &mut self,
2116            decoder: &mut fidl::encoding::Decoder<
2117                '_,
2118                fidl::encoding::DefaultFuchsiaResourceDialect,
2119            >,
2120            offset: usize,
2121            _depth: fidl::encoding::Depth,
2122        ) -> fidl::Result<()> {
2123            decoder.debug_check_bounds::<Self>(offset);
2124            // Verify that padding bytes are zero.
2125            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 49154>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
2126            Ok(())
2127        }
2128    }
2129
2130    impl fidl::encoding::ResourceTypeMarker for TreeGetContentResponse {
2131        type Borrowed<'a> = &'a mut Self;
2132        fn take_or_borrow<'a>(
2133            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2134        ) -> Self::Borrowed<'a> {
2135            value
2136        }
2137    }
2138
2139    unsafe impl fidl::encoding::TypeMarker for TreeGetContentResponse {
2140        type Owned = Self;
2141
2142        #[inline(always)]
2143        fn inline_align(_context: fidl::encoding::Context) -> usize {
2144            8
2145        }
2146
2147        #[inline(always)]
2148        fn inline_size(_context: fidl::encoding::Context) -> usize {
2149            16
2150        }
2151    }
2152
2153    unsafe impl
2154        fidl::encoding::Encode<
2155            TreeGetContentResponse,
2156            fidl::encoding::DefaultFuchsiaResourceDialect,
2157        > for &mut TreeGetContentResponse
2158    {
2159        #[inline]
2160        unsafe fn encode(
2161            self,
2162            encoder: &mut fidl::encoding::Encoder<
2163                '_,
2164                fidl::encoding::DefaultFuchsiaResourceDialect,
2165            >,
2166            offset: usize,
2167            _depth: fidl::encoding::Depth,
2168        ) -> fidl::Result<()> {
2169            encoder.debug_check_bounds::<TreeGetContentResponse>(offset);
2170            // Delegate to tuple encoding.
2171            fidl::encoding::Encode::<
2172                TreeGetContentResponse,
2173                fidl::encoding::DefaultFuchsiaResourceDialect,
2174            >::encode(
2175                (<TreeContent as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2176                    &mut self.content,
2177                ),),
2178                encoder,
2179                offset,
2180                _depth,
2181            )
2182        }
2183    }
2184    unsafe impl<
2185        T0: fidl::encoding::Encode<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>,
2186    >
2187        fidl::encoding::Encode<
2188            TreeGetContentResponse,
2189            fidl::encoding::DefaultFuchsiaResourceDialect,
2190        > for (T0,)
2191    {
2192        #[inline]
2193        unsafe fn encode(
2194            self,
2195            encoder: &mut fidl::encoding::Encoder<
2196                '_,
2197                fidl::encoding::DefaultFuchsiaResourceDialect,
2198            >,
2199            offset: usize,
2200            depth: fidl::encoding::Depth,
2201        ) -> fidl::Result<()> {
2202            encoder.debug_check_bounds::<TreeGetContentResponse>(offset);
2203            // Zero out padding regions. There's no need to apply masks
2204            // because the unmasked parts will be overwritten by fields.
2205            // Write the fields.
2206            self.0.encode(encoder, offset + 0, depth)?;
2207            Ok(())
2208        }
2209    }
2210
2211    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2212        for TreeGetContentResponse
2213    {
2214        #[inline(always)]
2215        fn new_empty() -> Self {
2216            Self {
2217                content: fidl::new_empty!(
2218                    TreeContent,
2219                    fidl::encoding::DefaultFuchsiaResourceDialect
2220                ),
2221            }
2222        }
2223
2224        #[inline]
2225        unsafe fn decode(
2226            &mut self,
2227            decoder: &mut fidl::encoding::Decoder<
2228                '_,
2229                fidl::encoding::DefaultFuchsiaResourceDialect,
2230            >,
2231            offset: usize,
2232            _depth: fidl::encoding::Depth,
2233        ) -> fidl::Result<()> {
2234            decoder.debug_check_bounds::<Self>(offset);
2235            // Verify that padding bytes are zero.
2236            fidl::decode!(
2237                TreeContent,
2238                fidl::encoding::DefaultFuchsiaResourceDialect,
2239                &mut self.content,
2240                decoder,
2241                offset + 0,
2242                _depth
2243            )?;
2244            Ok(())
2245        }
2246    }
2247
2248    impl fidl::encoding::ResourceTypeMarker for TreeListChildNamesRequest {
2249        type Borrowed<'a> = &'a mut Self;
2250        fn take_or_borrow<'a>(
2251            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2252        ) -> Self::Borrowed<'a> {
2253            value
2254        }
2255    }
2256
2257    unsafe impl fidl::encoding::TypeMarker for TreeListChildNamesRequest {
2258        type Owned = Self;
2259
2260        #[inline(always)]
2261        fn inline_align(_context: fidl::encoding::Context) -> usize {
2262            4
2263        }
2264
2265        #[inline(always)]
2266        fn inline_size(_context: fidl::encoding::Context) -> usize {
2267            4
2268        }
2269    }
2270
2271    unsafe impl
2272        fidl::encoding::Encode<
2273            TreeListChildNamesRequest,
2274            fidl::encoding::DefaultFuchsiaResourceDialect,
2275        > for &mut TreeListChildNamesRequest
2276    {
2277        #[inline]
2278        unsafe fn encode(
2279            self,
2280            encoder: &mut fidl::encoding::Encoder<
2281                '_,
2282                fidl::encoding::DefaultFuchsiaResourceDialect,
2283            >,
2284            offset: usize,
2285            _depth: fidl::encoding::Depth,
2286        ) -> fidl::Result<()> {
2287            encoder.debug_check_bounds::<TreeListChildNamesRequest>(offset);
2288            // Delegate to tuple encoding.
2289            fidl::encoding::Encode::<TreeListChildNamesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2290                (
2291                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.tree_iterator),
2292                ),
2293                encoder, offset, _depth
2294            )
2295        }
2296    }
2297    unsafe impl<
2298        T0: fidl::encoding::Encode<
2299                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>>,
2300                fidl::encoding::DefaultFuchsiaResourceDialect,
2301            >,
2302    >
2303        fidl::encoding::Encode<
2304            TreeListChildNamesRequest,
2305            fidl::encoding::DefaultFuchsiaResourceDialect,
2306        > for (T0,)
2307    {
2308        #[inline]
2309        unsafe fn encode(
2310            self,
2311            encoder: &mut fidl::encoding::Encoder<
2312                '_,
2313                fidl::encoding::DefaultFuchsiaResourceDialect,
2314            >,
2315            offset: usize,
2316            depth: fidl::encoding::Depth,
2317        ) -> fidl::Result<()> {
2318            encoder.debug_check_bounds::<TreeListChildNamesRequest>(offset);
2319            // Zero out padding regions. There's no need to apply masks
2320            // because the unmasked parts will be overwritten by fields.
2321            // Write the fields.
2322            self.0.encode(encoder, offset + 0, depth)?;
2323            Ok(())
2324        }
2325    }
2326
2327    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2328        for TreeListChildNamesRequest
2329    {
2330        #[inline(always)]
2331        fn new_empty() -> Self {
2332            Self {
2333                tree_iterator: fidl::new_empty!(
2334                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>>,
2335                    fidl::encoding::DefaultFuchsiaResourceDialect
2336                ),
2337            }
2338        }
2339
2340        #[inline]
2341        unsafe fn decode(
2342            &mut self,
2343            decoder: &mut fidl::encoding::Decoder<
2344                '_,
2345                fidl::encoding::DefaultFuchsiaResourceDialect,
2346            >,
2347            offset: usize,
2348            _depth: fidl::encoding::Depth,
2349        ) -> fidl::Result<()> {
2350            decoder.debug_check_bounds::<Self>(offset);
2351            // Verify that padding bytes are zero.
2352            fidl::decode!(
2353                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>>,
2354                fidl::encoding::DefaultFuchsiaResourceDialect,
2355                &mut self.tree_iterator,
2356                decoder,
2357                offset + 0,
2358                _depth
2359            )?;
2360            Ok(())
2361        }
2362    }
2363
2364    impl fidl::encoding::ResourceTypeMarker for TreeOpenChildRequest {
2365        type Borrowed<'a> = &'a mut Self;
2366        fn take_or_borrow<'a>(
2367            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2368        ) -> Self::Borrowed<'a> {
2369            value
2370        }
2371    }
2372
2373    unsafe impl fidl::encoding::TypeMarker for TreeOpenChildRequest {
2374        type Owned = Self;
2375
2376        #[inline(always)]
2377        fn inline_align(_context: fidl::encoding::Context) -> usize {
2378            8
2379        }
2380
2381        #[inline(always)]
2382        fn inline_size(_context: fidl::encoding::Context) -> usize {
2383            24
2384        }
2385    }
2386
2387    unsafe impl
2388        fidl::encoding::Encode<TreeOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2389        for &mut TreeOpenChildRequest
2390    {
2391        #[inline]
2392        unsafe fn encode(
2393            self,
2394            encoder: &mut fidl::encoding::Encoder<
2395                '_,
2396                fidl::encoding::DefaultFuchsiaResourceDialect,
2397            >,
2398            offset: usize,
2399            _depth: fidl::encoding::Depth,
2400        ) -> fidl::Result<()> {
2401            encoder.debug_check_bounds::<TreeOpenChildRequest>(offset);
2402            // Delegate to tuple encoding.
2403            fidl::encoding::Encode::<TreeOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2404                (
2405                    <fidl::encoding::BoundedString<2040> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
2406                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.tree),
2407                ),
2408                encoder, offset, _depth
2409            )
2410        }
2411    }
2412    unsafe impl<
2413        T0: fidl::encoding::Encode<
2414                fidl::encoding::BoundedString<2040>,
2415                fidl::encoding::DefaultFuchsiaResourceDialect,
2416            >,
2417        T1: fidl::encoding::Encode<
2418                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>>,
2419                fidl::encoding::DefaultFuchsiaResourceDialect,
2420            >,
2421    >
2422        fidl::encoding::Encode<TreeOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2423        for (T0, T1)
2424    {
2425        #[inline]
2426        unsafe fn encode(
2427            self,
2428            encoder: &mut fidl::encoding::Encoder<
2429                '_,
2430                fidl::encoding::DefaultFuchsiaResourceDialect,
2431            >,
2432            offset: usize,
2433            depth: fidl::encoding::Depth,
2434        ) -> fidl::Result<()> {
2435            encoder.debug_check_bounds::<TreeOpenChildRequest>(offset);
2436            // Zero out padding regions. There's no need to apply masks
2437            // because the unmasked parts will be overwritten by fields.
2438            unsafe {
2439                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2440                (ptr as *mut u64).write_unaligned(0);
2441            }
2442            // Write the fields.
2443            self.0.encode(encoder, offset + 0, depth)?;
2444            self.1.encode(encoder, offset + 16, depth)?;
2445            Ok(())
2446        }
2447    }
2448
2449    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2450        for TreeOpenChildRequest
2451    {
2452        #[inline(always)]
2453        fn new_empty() -> Self {
2454            Self {
2455                child_name: fidl::new_empty!(
2456                    fidl::encoding::BoundedString<2040>,
2457                    fidl::encoding::DefaultFuchsiaResourceDialect
2458                ),
2459                tree: fidl::new_empty!(
2460                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>>,
2461                    fidl::encoding::DefaultFuchsiaResourceDialect
2462                ),
2463            }
2464        }
2465
2466        #[inline]
2467        unsafe fn decode(
2468            &mut self,
2469            decoder: &mut fidl::encoding::Decoder<
2470                '_,
2471                fidl::encoding::DefaultFuchsiaResourceDialect,
2472            >,
2473            offset: usize,
2474            _depth: fidl::encoding::Depth,
2475        ) -> fidl::Result<()> {
2476            decoder.debug_check_bounds::<Self>(offset);
2477            // Verify that padding bytes are zero.
2478            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2479            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2480            let mask = 0xffffffff00000000u64;
2481            let maskedval = padval & mask;
2482            if maskedval != 0 {
2483                return Err(fidl::Error::NonZeroPadding {
2484                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2485                });
2486            }
2487            fidl::decode!(
2488                fidl::encoding::BoundedString<2040>,
2489                fidl::encoding::DefaultFuchsiaResourceDialect,
2490                &mut self.child_name,
2491                decoder,
2492                offset + 0,
2493                _depth
2494            )?;
2495            fidl::decode!(
2496                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>>,
2497                fidl::encoding::DefaultFuchsiaResourceDialect,
2498                &mut self.tree,
2499                decoder,
2500                offset + 16,
2501                _depth
2502            )?;
2503            Ok(())
2504        }
2505    }
2506
2507    impl InspectSinkEscrowRequest {
2508        #[inline(always)]
2509        fn max_ordinal_present(&self) -> u64 {
2510            if let Some(_) = self.tree {
2511                return 4;
2512            }
2513            if let Some(_) = self.name {
2514                return 3;
2515            }
2516            if let Some(_) = self.token {
2517                return 2;
2518            }
2519            if let Some(_) = self.vmo {
2520                return 1;
2521            }
2522            0
2523        }
2524    }
2525
2526    impl fidl::encoding::ResourceTypeMarker for InspectSinkEscrowRequest {
2527        type Borrowed<'a> = &'a mut Self;
2528        fn take_or_borrow<'a>(
2529            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2530        ) -> Self::Borrowed<'a> {
2531            value
2532        }
2533    }
2534
2535    unsafe impl fidl::encoding::TypeMarker for InspectSinkEscrowRequest {
2536        type Owned = Self;
2537
2538        #[inline(always)]
2539        fn inline_align(_context: fidl::encoding::Context) -> usize {
2540            8
2541        }
2542
2543        #[inline(always)]
2544        fn inline_size(_context: fidl::encoding::Context) -> usize {
2545            16
2546        }
2547    }
2548
2549    unsafe impl
2550        fidl::encoding::Encode<
2551            InspectSinkEscrowRequest,
2552            fidl::encoding::DefaultFuchsiaResourceDialect,
2553        > for &mut InspectSinkEscrowRequest
2554    {
2555        unsafe fn encode(
2556            self,
2557            encoder: &mut fidl::encoding::Encoder<
2558                '_,
2559                fidl::encoding::DefaultFuchsiaResourceDialect,
2560            >,
2561            offset: usize,
2562            mut depth: fidl::encoding::Depth,
2563        ) -> fidl::Result<()> {
2564            encoder.debug_check_bounds::<InspectSinkEscrowRequest>(offset);
2565            // Vector header
2566            let max_ordinal: u64 = self.max_ordinal_present();
2567            encoder.write_num(max_ordinal, offset);
2568            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2569            // Calling encoder.out_of_line_offset(0) is not allowed.
2570            if max_ordinal == 0 {
2571                return Ok(());
2572            }
2573            depth.increment()?;
2574            let envelope_size = 8;
2575            let bytes_len = max_ordinal as usize * envelope_size;
2576            #[allow(unused_variables)]
2577            let offset = encoder.out_of_line_offset(bytes_len);
2578            let mut _prev_end_offset: usize = 0;
2579            if 1 > max_ordinal {
2580                return Ok(());
2581            }
2582
2583            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2584            // are envelope_size bytes.
2585            let cur_offset: usize = (1 - 1) * envelope_size;
2586
2587            // Zero reserved fields.
2588            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2589
2590            // Safety:
2591            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2592            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2593            //   envelope_size bytes, there is always sufficient room.
2594            fidl::encoding::encode_in_envelope_optional::<
2595                fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>,
2596                fidl::encoding::DefaultFuchsiaResourceDialect,
2597            >(
2598                self.vmo.as_mut().map(
2599                    <fidl::encoding::HandleType<
2600                        fidl::Vmo,
2601                        { fidl::ObjectType::VMO.into_raw() },
2602                        49383,
2603                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2604                ),
2605                encoder,
2606                offset + cur_offset,
2607                depth,
2608            )?;
2609
2610            _prev_end_offset = cur_offset + envelope_size;
2611            if 2 > max_ordinal {
2612                return Ok(());
2613            }
2614
2615            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2616            // are envelope_size bytes.
2617            let cur_offset: usize = (2 - 1) * envelope_size;
2618
2619            // Zero reserved fields.
2620            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2621
2622            // Safety:
2623            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2624            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2625            //   envelope_size bytes, there is always sufficient room.
2626            fidl::encoding::encode_in_envelope_optional::<
2627                EscrowToken,
2628                fidl::encoding::DefaultFuchsiaResourceDialect,
2629            >(
2630                self.token
2631                    .as_mut()
2632                    .map(<EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2633                encoder,
2634                offset + cur_offset,
2635                depth,
2636            )?;
2637
2638            _prev_end_offset = cur_offset + envelope_size;
2639            if 3 > max_ordinal {
2640                return Ok(());
2641            }
2642
2643            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2644            // are envelope_size bytes.
2645            let cur_offset: usize = (3 - 1) * envelope_size;
2646
2647            // Zero reserved fields.
2648            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2649
2650            // Safety:
2651            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2652            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2653            //   envelope_size bytes, there is always sufficient room.
2654            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2655            self.name.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2656            encoder, offset + cur_offset, depth
2657        )?;
2658
2659            _prev_end_offset = cur_offset + envelope_size;
2660            if 4 > max_ordinal {
2661                return Ok(());
2662            }
2663
2664            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2665            // are envelope_size bytes.
2666            let cur_offset: usize = (4 - 1) * envelope_size;
2667
2668            // Zero reserved fields.
2669            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2670
2671            // Safety:
2672            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2673            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2674            //   envelope_size bytes, there is always sufficient room.
2675            fidl::encoding::encode_in_envelope_optional::<
2676                u64,
2677                fidl::encoding::DefaultFuchsiaResourceDialect,
2678            >(
2679                self.tree.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2680                encoder,
2681                offset + cur_offset,
2682                depth,
2683            )?;
2684
2685            _prev_end_offset = cur_offset + envelope_size;
2686
2687            Ok(())
2688        }
2689    }
2690
2691    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2692        for InspectSinkEscrowRequest
2693    {
2694        #[inline(always)]
2695        fn new_empty() -> Self {
2696            Self::default()
2697        }
2698
2699        unsafe fn decode(
2700            &mut self,
2701            decoder: &mut fidl::encoding::Decoder<
2702                '_,
2703                fidl::encoding::DefaultFuchsiaResourceDialect,
2704            >,
2705            offset: usize,
2706            mut depth: fidl::encoding::Depth,
2707        ) -> fidl::Result<()> {
2708            decoder.debug_check_bounds::<Self>(offset);
2709            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2710                None => return Err(fidl::Error::NotNullable),
2711                Some(len) => len,
2712            };
2713            // Calling decoder.out_of_line_offset(0) is not allowed.
2714            if len == 0 {
2715                return Ok(());
2716            };
2717            depth.increment()?;
2718            let envelope_size = 8;
2719            let bytes_len = len * envelope_size;
2720            let offset = decoder.out_of_line_offset(bytes_len)?;
2721            // Decode the envelope for each type.
2722            let mut _next_ordinal_to_read = 0;
2723            let mut next_offset = offset;
2724            let end_offset = offset + bytes_len;
2725            _next_ordinal_to_read += 1;
2726            if next_offset >= end_offset {
2727                return Ok(());
2728            }
2729
2730            // Decode unknown envelopes for gaps in ordinals.
2731            while _next_ordinal_to_read < 1 {
2732                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2733                _next_ordinal_to_read += 1;
2734                next_offset += envelope_size;
2735            }
2736
2737            let next_out_of_line = decoder.next_out_of_line();
2738            let handles_before = decoder.remaining_handles();
2739            if let Some((inlined, num_bytes, num_handles)) =
2740                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2741            {
2742                let member_inline_size = <fidl::encoding::HandleType<
2743                    fidl::Vmo,
2744                    { fidl::ObjectType::VMO.into_raw() },
2745                    49383,
2746                > as fidl::encoding::TypeMarker>::inline_size(
2747                    decoder.context
2748                );
2749                if inlined != (member_inline_size <= 4) {
2750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2751                }
2752                let inner_offset;
2753                let mut inner_depth = depth.clone();
2754                if inlined {
2755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2756                    inner_offset = next_offset;
2757                } else {
2758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2759                    inner_depth.increment()?;
2760                }
2761                let val_ref =
2762                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>, fidl::encoding::DefaultFuchsiaResourceDialect));
2763                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2764                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2765                {
2766                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2767                }
2768                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2769                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2770                }
2771            }
2772
2773            next_offset += envelope_size;
2774            _next_ordinal_to_read += 1;
2775            if next_offset >= end_offset {
2776                return Ok(());
2777            }
2778
2779            // Decode unknown envelopes for gaps in ordinals.
2780            while _next_ordinal_to_read < 2 {
2781                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2782                _next_ordinal_to_read += 1;
2783                next_offset += envelope_size;
2784            }
2785
2786            let next_out_of_line = decoder.next_out_of_line();
2787            let handles_before = decoder.remaining_handles();
2788            if let Some((inlined, num_bytes, num_handles)) =
2789                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2790            {
2791                let member_inline_size =
2792                    <EscrowToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2793                if inlined != (member_inline_size <= 4) {
2794                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2795                }
2796                let inner_offset;
2797                let mut inner_depth = depth.clone();
2798                if inlined {
2799                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2800                    inner_offset = next_offset;
2801                } else {
2802                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2803                    inner_depth.increment()?;
2804                }
2805                let val_ref = self.token.get_or_insert_with(|| {
2806                    fidl::new_empty!(EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect)
2807                });
2808                fidl::decode!(
2809                    EscrowToken,
2810                    fidl::encoding::DefaultFuchsiaResourceDialect,
2811                    val_ref,
2812                    decoder,
2813                    inner_offset,
2814                    inner_depth
2815                )?;
2816                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2817                {
2818                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2819                }
2820                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2821                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2822                }
2823            }
2824
2825            next_offset += envelope_size;
2826            _next_ordinal_to_read += 1;
2827            if next_offset >= end_offset {
2828                return Ok(());
2829            }
2830
2831            // Decode unknown envelopes for gaps in ordinals.
2832            while _next_ordinal_to_read < 3 {
2833                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2834                _next_ordinal_to_read += 1;
2835                next_offset += envelope_size;
2836            }
2837
2838            let next_out_of_line = decoder.next_out_of_line();
2839            let handles_before = decoder.remaining_handles();
2840            if let Some((inlined, num_bytes, num_handles)) =
2841                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2842            {
2843                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2844                if inlined != (member_inline_size <= 4) {
2845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2846                }
2847                let inner_offset;
2848                let mut inner_depth = depth.clone();
2849                if inlined {
2850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2851                    inner_offset = next_offset;
2852                } else {
2853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2854                    inner_depth.increment()?;
2855                }
2856                let val_ref = self.name.get_or_insert_with(|| {
2857                    fidl::new_empty!(
2858                        fidl::encoding::BoundedString<4096>,
2859                        fidl::encoding::DefaultFuchsiaResourceDialect
2860                    )
2861                });
2862                fidl::decode!(
2863                    fidl::encoding::BoundedString<4096>,
2864                    fidl::encoding::DefaultFuchsiaResourceDialect,
2865                    val_ref,
2866                    decoder,
2867                    inner_offset,
2868                    inner_depth
2869                )?;
2870                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2871                {
2872                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2873                }
2874                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2875                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2876                }
2877            }
2878
2879            next_offset += envelope_size;
2880            _next_ordinal_to_read += 1;
2881            if next_offset >= end_offset {
2882                return Ok(());
2883            }
2884
2885            // Decode unknown envelopes for gaps in ordinals.
2886            while _next_ordinal_to_read < 4 {
2887                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2888                _next_ordinal_to_read += 1;
2889                next_offset += envelope_size;
2890            }
2891
2892            let next_out_of_line = decoder.next_out_of_line();
2893            let handles_before = decoder.remaining_handles();
2894            if let Some((inlined, num_bytes, num_handles)) =
2895                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2896            {
2897                let member_inline_size =
2898                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2899                if inlined != (member_inline_size <= 4) {
2900                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2901                }
2902                let inner_offset;
2903                let mut inner_depth = depth.clone();
2904                if inlined {
2905                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2906                    inner_offset = next_offset;
2907                } else {
2908                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2909                    inner_depth.increment()?;
2910                }
2911                let val_ref = self.tree.get_or_insert_with(|| {
2912                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2913                });
2914                fidl::decode!(
2915                    u64,
2916                    fidl::encoding::DefaultFuchsiaResourceDialect,
2917                    val_ref,
2918                    decoder,
2919                    inner_offset,
2920                    inner_depth
2921                )?;
2922                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2923                {
2924                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2925                }
2926                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2927                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2928                }
2929            }
2930
2931            next_offset += envelope_size;
2932
2933            // Decode the remaining unknown envelopes.
2934            while next_offset < end_offset {
2935                _next_ordinal_to_read += 1;
2936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2937                next_offset += envelope_size;
2938            }
2939
2940            Ok(())
2941        }
2942    }
2943
2944    impl InspectSinkFetchEscrowRequest {
2945        #[inline(always)]
2946        fn max_ordinal_present(&self) -> u64 {
2947            if let Some(_) = self.tree {
2948                return 2;
2949            }
2950            if let Some(_) = self.token {
2951                return 1;
2952            }
2953            0
2954        }
2955    }
2956
2957    impl fidl::encoding::ResourceTypeMarker for InspectSinkFetchEscrowRequest {
2958        type Borrowed<'a> = &'a mut Self;
2959        fn take_or_borrow<'a>(
2960            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2961        ) -> Self::Borrowed<'a> {
2962            value
2963        }
2964    }
2965
2966    unsafe impl fidl::encoding::TypeMarker for InspectSinkFetchEscrowRequest {
2967        type Owned = Self;
2968
2969        #[inline(always)]
2970        fn inline_align(_context: fidl::encoding::Context) -> usize {
2971            8
2972        }
2973
2974        #[inline(always)]
2975        fn inline_size(_context: fidl::encoding::Context) -> usize {
2976            16
2977        }
2978    }
2979
2980    unsafe impl
2981        fidl::encoding::Encode<
2982            InspectSinkFetchEscrowRequest,
2983            fidl::encoding::DefaultFuchsiaResourceDialect,
2984        > for &mut InspectSinkFetchEscrowRequest
2985    {
2986        unsafe fn encode(
2987            self,
2988            encoder: &mut fidl::encoding::Encoder<
2989                '_,
2990                fidl::encoding::DefaultFuchsiaResourceDialect,
2991            >,
2992            offset: usize,
2993            mut depth: fidl::encoding::Depth,
2994        ) -> fidl::Result<()> {
2995            encoder.debug_check_bounds::<InspectSinkFetchEscrowRequest>(offset);
2996            // Vector header
2997            let max_ordinal: u64 = self.max_ordinal_present();
2998            encoder.write_num(max_ordinal, offset);
2999            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3000            // Calling encoder.out_of_line_offset(0) is not allowed.
3001            if max_ordinal == 0 {
3002                return Ok(());
3003            }
3004            depth.increment()?;
3005            let envelope_size = 8;
3006            let bytes_len = max_ordinal as usize * envelope_size;
3007            #[allow(unused_variables)]
3008            let offset = encoder.out_of_line_offset(bytes_len);
3009            let mut _prev_end_offset: usize = 0;
3010            if 1 > max_ordinal {
3011                return Ok(());
3012            }
3013
3014            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3015            // are envelope_size bytes.
3016            let cur_offset: usize = (1 - 1) * envelope_size;
3017
3018            // Zero reserved fields.
3019            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3020
3021            // Safety:
3022            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3023            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3024            //   envelope_size bytes, there is always sufficient room.
3025            fidl::encoding::encode_in_envelope_optional::<
3026                EscrowToken,
3027                fidl::encoding::DefaultFuchsiaResourceDialect,
3028            >(
3029                self.token
3030                    .as_mut()
3031                    .map(<EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3032                encoder,
3033                offset + cur_offset,
3034                depth,
3035            )?;
3036
3037            _prev_end_offset = cur_offset + envelope_size;
3038            if 2 > max_ordinal {
3039                return Ok(());
3040            }
3041
3042            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3043            // are envelope_size bytes.
3044            let cur_offset: usize = (2 - 1) * envelope_size;
3045
3046            // Zero reserved fields.
3047            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3048
3049            // Safety:
3050            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3051            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3052            //   envelope_size bytes, there is always sufficient room.
3053            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3054            self.tree.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3055            encoder, offset + cur_offset, depth
3056        )?;
3057
3058            _prev_end_offset = cur_offset + envelope_size;
3059
3060            Ok(())
3061        }
3062    }
3063
3064    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3065        for InspectSinkFetchEscrowRequest
3066    {
3067        #[inline(always)]
3068        fn new_empty() -> Self {
3069            Self::default()
3070        }
3071
3072        unsafe fn decode(
3073            &mut self,
3074            decoder: &mut fidl::encoding::Decoder<
3075                '_,
3076                fidl::encoding::DefaultFuchsiaResourceDialect,
3077            >,
3078            offset: usize,
3079            mut depth: fidl::encoding::Depth,
3080        ) -> fidl::Result<()> {
3081            decoder.debug_check_bounds::<Self>(offset);
3082            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3083                None => return Err(fidl::Error::NotNullable),
3084                Some(len) => len,
3085            };
3086            // Calling decoder.out_of_line_offset(0) is not allowed.
3087            if len == 0 {
3088                return Ok(());
3089            };
3090            depth.increment()?;
3091            let envelope_size = 8;
3092            let bytes_len = len * envelope_size;
3093            let offset = decoder.out_of_line_offset(bytes_len)?;
3094            // Decode the envelope for each type.
3095            let mut _next_ordinal_to_read = 0;
3096            let mut next_offset = offset;
3097            let end_offset = offset + bytes_len;
3098            _next_ordinal_to_read += 1;
3099            if next_offset >= end_offset {
3100                return Ok(());
3101            }
3102
3103            // Decode unknown envelopes for gaps in ordinals.
3104            while _next_ordinal_to_read < 1 {
3105                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3106                _next_ordinal_to_read += 1;
3107                next_offset += envelope_size;
3108            }
3109
3110            let next_out_of_line = decoder.next_out_of_line();
3111            let handles_before = decoder.remaining_handles();
3112            if let Some((inlined, num_bytes, num_handles)) =
3113                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3114            {
3115                let member_inline_size =
3116                    <EscrowToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3117                if inlined != (member_inline_size <= 4) {
3118                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3119                }
3120                let inner_offset;
3121                let mut inner_depth = depth.clone();
3122                if inlined {
3123                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3124                    inner_offset = next_offset;
3125                } else {
3126                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3127                    inner_depth.increment()?;
3128                }
3129                let val_ref = self.token.get_or_insert_with(|| {
3130                    fidl::new_empty!(EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect)
3131                });
3132                fidl::decode!(
3133                    EscrowToken,
3134                    fidl::encoding::DefaultFuchsiaResourceDialect,
3135                    val_ref,
3136                    decoder,
3137                    inner_offset,
3138                    inner_depth
3139                )?;
3140                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3141                {
3142                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3143                }
3144                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3145                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3146                }
3147            }
3148
3149            next_offset += envelope_size;
3150            _next_ordinal_to_read += 1;
3151            if next_offset >= end_offset {
3152                return Ok(());
3153            }
3154
3155            // Decode unknown envelopes for gaps in ordinals.
3156            while _next_ordinal_to_read < 2 {
3157                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3158                _next_ordinal_to_read += 1;
3159                next_offset += envelope_size;
3160            }
3161
3162            let next_out_of_line = decoder.next_out_of_line();
3163            let handles_before = decoder.remaining_handles();
3164            if let Some((inlined, num_bytes, num_handles)) =
3165                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3166            {
3167                let member_inline_size = <fidl::encoding::Endpoint<
3168                    fidl::endpoints::ClientEnd<TreeMarker>,
3169                > as fidl::encoding::TypeMarker>::inline_size(
3170                    decoder.context
3171                );
3172                if inlined != (member_inline_size <= 4) {
3173                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3174                }
3175                let inner_offset;
3176                let mut inner_depth = depth.clone();
3177                if inlined {
3178                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3179                    inner_offset = next_offset;
3180                } else {
3181                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3182                    inner_depth.increment()?;
3183                }
3184                let val_ref = self.tree.get_or_insert_with(|| {
3185                    fidl::new_empty!(
3186                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3187                        fidl::encoding::DefaultFuchsiaResourceDialect
3188                    )
3189                });
3190                fidl::decode!(
3191                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3192                    fidl::encoding::DefaultFuchsiaResourceDialect,
3193                    val_ref,
3194                    decoder,
3195                    inner_offset,
3196                    inner_depth
3197                )?;
3198                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3199                {
3200                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3201                }
3202                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3203                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3204                }
3205            }
3206
3207            next_offset += envelope_size;
3208
3209            // Decode the remaining unknown envelopes.
3210            while next_offset < end_offset {
3211                _next_ordinal_to_read += 1;
3212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3213                next_offset += envelope_size;
3214            }
3215
3216            Ok(())
3217        }
3218    }
3219
3220    impl InspectSinkPublishRequest {
3221        #[inline(always)]
3222        fn max_ordinal_present(&self) -> u64 {
3223            if let Some(_) = self.name {
3224                return 2;
3225            }
3226            if let Some(_) = self.tree {
3227                return 1;
3228            }
3229            0
3230        }
3231    }
3232
3233    impl fidl::encoding::ResourceTypeMarker for InspectSinkPublishRequest {
3234        type Borrowed<'a> = &'a mut Self;
3235        fn take_or_borrow<'a>(
3236            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3237        ) -> Self::Borrowed<'a> {
3238            value
3239        }
3240    }
3241
3242    unsafe impl fidl::encoding::TypeMarker for InspectSinkPublishRequest {
3243        type Owned = Self;
3244
3245        #[inline(always)]
3246        fn inline_align(_context: fidl::encoding::Context) -> usize {
3247            8
3248        }
3249
3250        #[inline(always)]
3251        fn inline_size(_context: fidl::encoding::Context) -> usize {
3252            16
3253        }
3254    }
3255
3256    unsafe impl
3257        fidl::encoding::Encode<
3258            InspectSinkPublishRequest,
3259            fidl::encoding::DefaultFuchsiaResourceDialect,
3260        > for &mut InspectSinkPublishRequest
3261    {
3262        unsafe fn encode(
3263            self,
3264            encoder: &mut fidl::encoding::Encoder<
3265                '_,
3266                fidl::encoding::DefaultFuchsiaResourceDialect,
3267            >,
3268            offset: usize,
3269            mut depth: fidl::encoding::Depth,
3270        ) -> fidl::Result<()> {
3271            encoder.debug_check_bounds::<InspectSinkPublishRequest>(offset);
3272            // Vector header
3273            let max_ordinal: u64 = self.max_ordinal_present();
3274            encoder.write_num(max_ordinal, offset);
3275            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3276            // Calling encoder.out_of_line_offset(0) is not allowed.
3277            if max_ordinal == 0 {
3278                return Ok(());
3279            }
3280            depth.increment()?;
3281            let envelope_size = 8;
3282            let bytes_len = max_ordinal as usize * envelope_size;
3283            #[allow(unused_variables)]
3284            let offset = encoder.out_of_line_offset(bytes_len);
3285            let mut _prev_end_offset: usize = 0;
3286            if 1 > max_ordinal {
3287                return Ok(());
3288            }
3289
3290            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3291            // are envelope_size bytes.
3292            let cur_offset: usize = (1 - 1) * envelope_size;
3293
3294            // Zero reserved fields.
3295            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3296
3297            // Safety:
3298            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3299            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3300            //   envelope_size bytes, there is always sufficient room.
3301            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3302            self.tree.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3303            encoder, offset + cur_offset, depth
3304        )?;
3305
3306            _prev_end_offset = cur_offset + envelope_size;
3307            if 2 > max_ordinal {
3308                return Ok(());
3309            }
3310
3311            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3312            // are envelope_size bytes.
3313            let cur_offset: usize = (2 - 1) * envelope_size;
3314
3315            // Zero reserved fields.
3316            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3317
3318            // Safety:
3319            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3320            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3321            //   envelope_size bytes, there is always sufficient room.
3322            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3323            self.name.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3324            encoder, offset + cur_offset, depth
3325        )?;
3326
3327            _prev_end_offset = cur_offset + envelope_size;
3328
3329            Ok(())
3330        }
3331    }
3332
3333    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3334        for InspectSinkPublishRequest
3335    {
3336        #[inline(always)]
3337        fn new_empty() -> Self {
3338            Self::default()
3339        }
3340
3341        unsafe fn decode(
3342            &mut self,
3343            decoder: &mut fidl::encoding::Decoder<
3344                '_,
3345                fidl::encoding::DefaultFuchsiaResourceDialect,
3346            >,
3347            offset: usize,
3348            mut depth: fidl::encoding::Depth,
3349        ) -> fidl::Result<()> {
3350            decoder.debug_check_bounds::<Self>(offset);
3351            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3352                None => return Err(fidl::Error::NotNullable),
3353                Some(len) => len,
3354            };
3355            // Calling decoder.out_of_line_offset(0) is not allowed.
3356            if len == 0 {
3357                return Ok(());
3358            };
3359            depth.increment()?;
3360            let envelope_size = 8;
3361            let bytes_len = len * envelope_size;
3362            let offset = decoder.out_of_line_offset(bytes_len)?;
3363            // Decode the envelope for each type.
3364            let mut _next_ordinal_to_read = 0;
3365            let mut next_offset = offset;
3366            let end_offset = offset + bytes_len;
3367            _next_ordinal_to_read += 1;
3368            if next_offset >= end_offset {
3369                return Ok(());
3370            }
3371
3372            // Decode unknown envelopes for gaps in ordinals.
3373            while _next_ordinal_to_read < 1 {
3374                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3375                _next_ordinal_to_read += 1;
3376                next_offset += envelope_size;
3377            }
3378
3379            let next_out_of_line = decoder.next_out_of_line();
3380            let handles_before = decoder.remaining_handles();
3381            if let Some((inlined, num_bytes, num_handles)) =
3382                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3383            {
3384                let member_inline_size = <fidl::encoding::Endpoint<
3385                    fidl::endpoints::ClientEnd<TreeMarker>,
3386                > as fidl::encoding::TypeMarker>::inline_size(
3387                    decoder.context
3388                );
3389                if inlined != (member_inline_size <= 4) {
3390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3391                }
3392                let inner_offset;
3393                let mut inner_depth = depth.clone();
3394                if inlined {
3395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3396                    inner_offset = next_offset;
3397                } else {
3398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3399                    inner_depth.increment()?;
3400                }
3401                let val_ref = self.tree.get_or_insert_with(|| {
3402                    fidl::new_empty!(
3403                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3404                        fidl::encoding::DefaultFuchsiaResourceDialect
3405                    )
3406                });
3407                fidl::decode!(
3408                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3409                    fidl::encoding::DefaultFuchsiaResourceDialect,
3410                    val_ref,
3411                    decoder,
3412                    inner_offset,
3413                    inner_depth
3414                )?;
3415                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3416                {
3417                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3418                }
3419                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3420                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3421                }
3422            }
3423
3424            next_offset += envelope_size;
3425            _next_ordinal_to_read += 1;
3426            if next_offset >= end_offset {
3427                return Ok(());
3428            }
3429
3430            // Decode unknown envelopes for gaps in ordinals.
3431            while _next_ordinal_to_read < 2 {
3432                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3433                _next_ordinal_to_read += 1;
3434                next_offset += envelope_size;
3435            }
3436
3437            let next_out_of_line = decoder.next_out_of_line();
3438            let handles_before = decoder.remaining_handles();
3439            if let Some((inlined, num_bytes, num_handles)) =
3440                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3441            {
3442                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3443                if inlined != (member_inline_size <= 4) {
3444                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3445                }
3446                let inner_offset;
3447                let mut inner_depth = depth.clone();
3448                if inlined {
3449                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3450                    inner_offset = next_offset;
3451                } else {
3452                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3453                    inner_depth.increment()?;
3454                }
3455                let val_ref = self.name.get_or_insert_with(|| {
3456                    fidl::new_empty!(
3457                        fidl::encoding::BoundedString<4096>,
3458                        fidl::encoding::DefaultFuchsiaResourceDialect
3459                    )
3460                });
3461                fidl::decode!(
3462                    fidl::encoding::BoundedString<4096>,
3463                    fidl::encoding::DefaultFuchsiaResourceDialect,
3464                    val_ref,
3465                    decoder,
3466                    inner_offset,
3467                    inner_depth
3468                )?;
3469                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3470                {
3471                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3472                }
3473                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3474                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3475                }
3476            }
3477
3478            next_offset += envelope_size;
3479
3480            // Decode the remaining unknown envelopes.
3481            while next_offset < end_offset {
3482                _next_ordinal_to_read += 1;
3483                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3484                next_offset += envelope_size;
3485            }
3486
3487            Ok(())
3488        }
3489    }
3490
3491    impl InspectSinkFetchEscrowResponse {
3492        #[inline(always)]
3493        fn max_ordinal_present(&self) -> u64 {
3494            if let Some(_) = self.vmo {
3495                return 1;
3496            }
3497            0
3498        }
3499    }
3500
3501    impl fidl::encoding::ResourceTypeMarker for InspectSinkFetchEscrowResponse {
3502        type Borrowed<'a> = &'a mut Self;
3503        fn take_or_borrow<'a>(
3504            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3505        ) -> Self::Borrowed<'a> {
3506            value
3507        }
3508    }
3509
3510    unsafe impl fidl::encoding::TypeMarker for InspectSinkFetchEscrowResponse {
3511        type Owned = Self;
3512
3513        #[inline(always)]
3514        fn inline_align(_context: fidl::encoding::Context) -> usize {
3515            8
3516        }
3517
3518        #[inline(always)]
3519        fn inline_size(_context: fidl::encoding::Context) -> usize {
3520            16
3521        }
3522    }
3523
3524    unsafe impl
3525        fidl::encoding::Encode<
3526            InspectSinkFetchEscrowResponse,
3527            fidl::encoding::DefaultFuchsiaResourceDialect,
3528        > for &mut InspectSinkFetchEscrowResponse
3529    {
3530        unsafe fn encode(
3531            self,
3532            encoder: &mut fidl::encoding::Encoder<
3533                '_,
3534                fidl::encoding::DefaultFuchsiaResourceDialect,
3535            >,
3536            offset: usize,
3537            mut depth: fidl::encoding::Depth,
3538        ) -> fidl::Result<()> {
3539            encoder.debug_check_bounds::<InspectSinkFetchEscrowResponse>(offset);
3540            // Vector header
3541            let max_ordinal: u64 = self.max_ordinal_present();
3542            encoder.write_num(max_ordinal, offset);
3543            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3544            // Calling encoder.out_of_line_offset(0) is not allowed.
3545            if max_ordinal == 0 {
3546                return Ok(());
3547            }
3548            depth.increment()?;
3549            let envelope_size = 8;
3550            let bytes_len = max_ordinal as usize * envelope_size;
3551            #[allow(unused_variables)]
3552            let offset = encoder.out_of_line_offset(bytes_len);
3553            let mut _prev_end_offset: usize = 0;
3554            if 1 > max_ordinal {
3555                return Ok(());
3556            }
3557
3558            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3559            // are envelope_size bytes.
3560            let cur_offset: usize = (1 - 1) * envelope_size;
3561
3562            // Zero reserved fields.
3563            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3564
3565            // Safety:
3566            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3567            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3568            //   envelope_size bytes, there is always sufficient room.
3569            fidl::encoding::encode_in_envelope_optional::<
3570                fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>,
3571                fidl::encoding::DefaultFuchsiaResourceDialect,
3572            >(
3573                self.vmo.as_mut().map(
3574                    <fidl::encoding::HandleType<
3575                        fidl::Vmo,
3576                        { fidl::ObjectType::VMO.into_raw() },
3577                        49383,
3578                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3579                ),
3580                encoder,
3581                offset + cur_offset,
3582                depth,
3583            )?;
3584
3585            _prev_end_offset = cur_offset + envelope_size;
3586
3587            Ok(())
3588        }
3589    }
3590
3591    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3592        for InspectSinkFetchEscrowResponse
3593    {
3594        #[inline(always)]
3595        fn new_empty() -> Self {
3596            Self::default()
3597        }
3598
3599        unsafe fn decode(
3600            &mut self,
3601            decoder: &mut fidl::encoding::Decoder<
3602                '_,
3603                fidl::encoding::DefaultFuchsiaResourceDialect,
3604            >,
3605            offset: usize,
3606            mut depth: fidl::encoding::Depth,
3607        ) -> fidl::Result<()> {
3608            decoder.debug_check_bounds::<Self>(offset);
3609            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3610                None => return Err(fidl::Error::NotNullable),
3611                Some(len) => len,
3612            };
3613            // Calling decoder.out_of_line_offset(0) is not allowed.
3614            if len == 0 {
3615                return Ok(());
3616            };
3617            depth.increment()?;
3618            let envelope_size = 8;
3619            let bytes_len = len * envelope_size;
3620            let offset = decoder.out_of_line_offset(bytes_len)?;
3621            // Decode the envelope for each type.
3622            let mut _next_ordinal_to_read = 0;
3623            let mut next_offset = offset;
3624            let end_offset = offset + bytes_len;
3625            _next_ordinal_to_read += 1;
3626            if next_offset >= end_offset {
3627                return Ok(());
3628            }
3629
3630            // Decode unknown envelopes for gaps in ordinals.
3631            while _next_ordinal_to_read < 1 {
3632                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3633                _next_ordinal_to_read += 1;
3634                next_offset += envelope_size;
3635            }
3636
3637            let next_out_of_line = decoder.next_out_of_line();
3638            let handles_before = decoder.remaining_handles();
3639            if let Some((inlined, num_bytes, num_handles)) =
3640                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3641            {
3642                let member_inline_size = <fidl::encoding::HandleType<
3643                    fidl::Vmo,
3644                    { fidl::ObjectType::VMO.into_raw() },
3645                    49383,
3646                > as fidl::encoding::TypeMarker>::inline_size(
3647                    decoder.context
3648                );
3649                if inlined != (member_inline_size <= 4) {
3650                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3651                }
3652                let inner_offset;
3653                let mut inner_depth = depth.clone();
3654                if inlined {
3655                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3656                    inner_offset = next_offset;
3657                } else {
3658                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3659                    inner_depth.increment()?;
3660                }
3661                let val_ref =
3662                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>, fidl::encoding::DefaultFuchsiaResourceDialect));
3663                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3664                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3665                {
3666                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3667                }
3668                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3669                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3670                }
3671            }
3672
3673            next_offset += envelope_size;
3674
3675            // Decode the remaining unknown envelopes.
3676            while next_offset < end_offset {
3677                _next_ordinal_to_read += 1;
3678                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3679                next_offset += envelope_size;
3680            }
3681
3682            Ok(())
3683        }
3684    }
3685
3686    impl TreeContent {
3687        #[inline(always)]
3688        fn max_ordinal_present(&self) -> u64 {
3689            if let Some(_) = self.buffer {
3690                return 1;
3691            }
3692            0
3693        }
3694    }
3695
3696    impl fidl::encoding::ResourceTypeMarker for TreeContent {
3697        type Borrowed<'a> = &'a mut Self;
3698        fn take_or_borrow<'a>(
3699            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3700        ) -> Self::Borrowed<'a> {
3701            value
3702        }
3703    }
3704
3705    unsafe impl fidl::encoding::TypeMarker for TreeContent {
3706        type Owned = Self;
3707
3708        #[inline(always)]
3709        fn inline_align(_context: fidl::encoding::Context) -> usize {
3710            8
3711        }
3712
3713        #[inline(always)]
3714        fn inline_size(_context: fidl::encoding::Context) -> usize {
3715            16
3716        }
3717    }
3718
3719    unsafe impl fidl::encoding::Encode<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>
3720        for &mut TreeContent
3721    {
3722        unsafe fn encode(
3723            self,
3724            encoder: &mut fidl::encoding::Encoder<
3725                '_,
3726                fidl::encoding::DefaultFuchsiaResourceDialect,
3727            >,
3728            offset: usize,
3729            mut depth: fidl::encoding::Depth,
3730        ) -> fidl::Result<()> {
3731            encoder.debug_check_bounds::<TreeContent>(offset);
3732            // Vector header
3733            let max_ordinal: u64 = self.max_ordinal_present();
3734            encoder.write_num(max_ordinal, offset);
3735            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3736            // Calling encoder.out_of_line_offset(0) is not allowed.
3737            if max_ordinal == 0 {
3738                return Ok(());
3739            }
3740            depth.increment()?;
3741            let envelope_size = 8;
3742            let bytes_len = max_ordinal as usize * envelope_size;
3743            #[allow(unused_variables)]
3744            let offset = encoder.out_of_line_offset(bytes_len);
3745            let mut _prev_end_offset: usize = 0;
3746            if 1 > max_ordinal {
3747                return Ok(());
3748            }
3749
3750            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3751            // are envelope_size bytes.
3752            let cur_offset: usize = (1 - 1) * envelope_size;
3753
3754            // Zero reserved fields.
3755            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3756
3757            // Safety:
3758            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3759            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3760            //   envelope_size bytes, there is always sufficient room.
3761            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3762            self.buffer.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3763            encoder, offset + cur_offset, depth
3764        )?;
3765
3766            _prev_end_offset = cur_offset + envelope_size;
3767
3768            Ok(())
3769        }
3770    }
3771
3772    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for TreeContent {
3773        #[inline(always)]
3774        fn new_empty() -> Self {
3775            Self::default()
3776        }
3777
3778        unsafe fn decode(
3779            &mut self,
3780            decoder: &mut fidl::encoding::Decoder<
3781                '_,
3782                fidl::encoding::DefaultFuchsiaResourceDialect,
3783            >,
3784            offset: usize,
3785            mut depth: fidl::encoding::Depth,
3786        ) -> fidl::Result<()> {
3787            decoder.debug_check_bounds::<Self>(offset);
3788            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3789                None => return Err(fidl::Error::NotNullable),
3790                Some(len) => len,
3791            };
3792            // Calling decoder.out_of_line_offset(0) is not allowed.
3793            if len == 0 {
3794                return Ok(());
3795            };
3796            depth.increment()?;
3797            let envelope_size = 8;
3798            let bytes_len = len * envelope_size;
3799            let offset = decoder.out_of_line_offset(bytes_len)?;
3800            // Decode the envelope for each type.
3801            let mut _next_ordinal_to_read = 0;
3802            let mut next_offset = offset;
3803            let end_offset = offset + bytes_len;
3804            _next_ordinal_to_read += 1;
3805            if next_offset >= end_offset {
3806                return Ok(());
3807            }
3808
3809            // Decode unknown envelopes for gaps in ordinals.
3810            while _next_ordinal_to_read < 1 {
3811                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3812                _next_ordinal_to_read += 1;
3813                next_offset += envelope_size;
3814            }
3815
3816            let next_out_of_line = decoder.next_out_of_line();
3817            let handles_before = decoder.remaining_handles();
3818            if let Some((inlined, num_bytes, num_handles)) =
3819                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3820            {
3821                let member_inline_size =
3822                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3823                        decoder.context,
3824                    );
3825                if inlined != (member_inline_size <= 4) {
3826                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3827                }
3828                let inner_offset;
3829                let mut inner_depth = depth.clone();
3830                if inlined {
3831                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3832                    inner_offset = next_offset;
3833                } else {
3834                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3835                    inner_depth.increment()?;
3836                }
3837                let val_ref = self.buffer.get_or_insert_with(|| {
3838                    fidl::new_empty!(
3839                        fidl_fuchsia_mem::Buffer,
3840                        fidl::encoding::DefaultFuchsiaResourceDialect
3841                    )
3842                });
3843                fidl::decode!(
3844                    fidl_fuchsia_mem::Buffer,
3845                    fidl::encoding::DefaultFuchsiaResourceDialect,
3846                    val_ref,
3847                    decoder,
3848                    inner_offset,
3849                    inner_depth
3850                )?;
3851                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3852                {
3853                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3854                }
3855                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3856                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3857                }
3858            }
3859
3860            next_offset += envelope_size;
3861
3862            // Decode the remaining unknown envelopes.
3863            while next_offset < end_offset {
3864                _next_ordinal_to_read += 1;
3865                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3866                next_offset += envelope_size;
3867            }
3868
3869            Ok(())
3870        }
3871    }
3872}