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