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