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