fidl_fuchsia_ui_observation_geometry__common/
fidl_fuchsia_ui_observation_geometry__common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// The ratio from physical pixels (of a display) to logical pixels (of the
12/// coordinate system of a view).
13/// - The values are placed in (x, y) order.
14pub type PixelScale = [f32; 2];
15
16/// The maximum number of `ViewTreeSnapshot`s a client can expect in a `Watch` call's
17/// response. The number of `ViewTreeSnapshot`s can be less than `BUFFER_SIZE` when
18/// the size of a `Watch` call's response exceeds the limit of a FIDL channel.
19///
20/// There is a limit on the number of `ViewTreeSnapshot`s that can be included in a
21/// `Watch` call's response due to the size restrictions of a FIDL channel. This limit
22/// was calculated by finding out the maximum number of `ViewTreeSnapshot`s which can be
23/// included in a `Watch` call's response when `MAX_VIEW_COUNT` is 1.
24///
25/// Note: This value would have to adjusted when modifying `ViewTreeSnapshot` or
26/// `ViewDescriptor`.
27pub const BUFFER_SIZE: u32 = 200;
28
29/// The maximum number of `ViewDescriptor`s a client can expect in a
30/// `ViewTreeSnapshot`.
31///
32/// There is a limit on the number of `ViewDescriptor`s that can be included in a
33/// `ViewTreeSnapshot` due to the size restrictions of a FIDL channel. This limit was
34/// calculated by finding out the maximum number of `ViewDescriptor`s which can be
35/// included in a `ViewTreeSnapshot` when the `BUFFER_SIZE` is 1.
36///
37/// Note: This value would have to adjusted when modifying `ViewDescriptor`.
38pub const MAX_VIEW_COUNT: u32 = 300;
39
40bitflags! {
41    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
42    pub struct Error: u32 {
43        /// Set to true when appending a `ViewTreeSnapshot` in `WatchResponse.updates`
44        /// would exceed the limit of the FIDL channel. That snapshot is dropped, along with
45        /// older snapshots.
46        const CHANNEL_OVERFLOW = 1;
47        /// Set to true when appending a `ViewTreeSnapshot` in `WatchResponse.updates`
48        /// would exceed `BUFFER_SIZE`. That snapshot is dropped, along with older snapshots.
49        const BUFFER_OVERFLOW = 2;
50        /// Set to true when the size of `views` in a `ViewTreeSnapshot` exceeds
51        /// `MAX_VIEW_COUNT`. We represent this situation in the `ViewTreeSnapshot` with an
52        /// unset `views` field.
53        const VIEWS_OVERFLOW = 4;
54    }
55}
56
57impl Error {
58    #[inline(always)]
59    pub fn from_bits_allow_unknown(bits: u32) -> Self {
60        Self::from_bits_retain(bits)
61    }
62
63    #[inline(always)]
64    pub fn has_unknown_bits(&self) -> bool {
65        self.get_unknown_bits() != 0
66    }
67
68    #[inline(always)]
69    pub fn get_unknown_bits(&self) -> u32 {
70        self.bits() & !Self::all().bits()
71    }
72}
73
74/// A view's bounding box, described in the view's own coordinate system.
75/// Concretely, |AlignedExtent| describes the minimal and maximal points of a
76/// view's bounding box, which is rectangular and axis-aligned.
77///
78/// Note: For describing a view's bounding box in another view's coordinate
79/// system, see |RotatableExtent|.
80///
81/// The origin is min.
82/// The size is: (abs(max.x - min.x), abs(max.y - min.y)).
83#[derive(Clone, Debug, PartialEq)]
84pub struct AlignedExtent {
85    /// The minimal position of the view's bounding box.
86    pub min: fidl_fuchsia_math__common::PointF,
87    /// The maximal position of the view's bounding box.
88    pub max: fidl_fuchsia_math__common::PointF,
89}
90
91impl fidl::Persistable for AlignedExtent {}
92
93/// Geometric data of a view.
94///
95/// Note that these are server-side values, and some graphics APIs do not have
96/// consistency guarantees with UI clients around when these values "take
97/// effect". I.e., the UI client may need to be directly queried to learn what
98/// values they are currently using. However, UI clients are expected to use
99/// these values "immediately", within a few frames.
100#[derive(Clone, Debug, PartialEq)]
101pub struct Layout {
102    /// The minimal and maximal points of a view's bounding box, in the
103    /// coordinate system of that view.
104    pub extent: AlignedExtent,
105    /// The conversion ratio from physical pixels (of a display) to logical pixels
106    /// (of the coordinate system of the view).
107    pub pixel_scale: [f32; 2],
108    /// The offset data for the view's bounding box, in the coordinate system of
109    /// that view.
110    pub inset: fidl_fuchsia_math__common::InsetF,
111}
112
113impl fidl::Persistable for Layout {}
114
115/// A view bounding box, described in another view's coordinate system.
116/// Concretely, |RotatableExtent| describes the origin, size, and rotation angle
117/// about the origin, for a view's bounding box.
118///
119/// Note: For describing a view's bounding box in the view's own coordinate
120/// system, see |AlignedExtent|.
121///
122/// We use "V" to refer to the view being described, and "W" to refer to the
123/// view where V is being described.
124///
125/// Note that while |angle| can be arbitrary, typical usage is axis aligned.
126/// To find the bounding box of V in W in clockwise order, starting with
127/// |origin|, where |angle| is 0, 90, 180, or 270, and using o=origin, w=width,
128/// h=height, a=angle:
129/// a=  0: (o.x, o.y), (o.x + w, o.y), (o.x + w, o.y + h), (o.x, o.y + h)
130/// a= 90: (o.x, o.y), (o.x, o.y - w), (o.x + h, o.y - w), (o.x + h, o.y)
131/// a=180: (o.x, o.y), (o.x - w, o.y), (o.x - w, o.y - h), (o.x, o.y - h)
132/// a=270: (o.x, o.y), (o.x, o.y + w), (o.x - h, o.y + w), (o.x - h, o.y)
133/// A formula based on sin a and cos a is readily obtained, but floating point
134/// computation may give only approximate results.
135#[derive(Clone, Debug, PartialEq)]
136pub struct RotatableExtent {
137    /// The origin point of V's bounding box, in W's coordinate system.
138    pub origin: fidl_fuchsia_math__common::PointF,
139    /// The width of V's bounding box (along the direction where V's x axis
140    /// increases), in W's coordinate system.
141    pub width: f32,
142    /// The height of V's bounding box (along the direction where V's y axis
143    /// increases), in W's coordinate system.
144    pub height: f32,
145    /// The clockwise rotation about the origin, in degrees.
146    pub angle_degrees: f32,
147}
148
149impl fidl::Persistable for RotatableExtent {}
150
151/// Data for a particular view: identifier, position, and children.
152#[derive(Clone, Debug, Default, PartialEq)]
153pub struct ViewDescriptor {
154    /// This view's fuchsia.ui.views.ViewRef koid.
155    pub view_ref_koid: Option<u64>,
156    /// This view's origin, logical size, pixel scale, and inset data, in the view's
157    /// own coordinate system.
158    ///
159    /// Limitations. Data consistency between server and client depend on the
160    /// specific graphics API. Some APIs provide weak consistency, where the
161    /// server-side data (this data) and the client-side data (in the view's UI
162    /// client) are allowed to diverge for some time.
163    pub layout: Option<Layout>,
164    /// This view's extent, in the context view's coordinate system.
165    /// It does NOT describe the child view's logical size.
166    ///
167    /// This describes the "ground truth" position of this view within the context
168    /// view, regardless of view tree depth, or specific layout state of
169    /// intermediate views.
170    ///
171    /// Limitations. It does NOT describe whether the view is "visible" (e.g.,
172    /// whether the view has opacity applied, or is not occluded by another view),
173    /// and it does NOT describe whether the view is "hittable" (e.g., whether the
174    /// view is positioned fully inside of every ancestor view's bounding box).
175    pub extent_in_context: Option<RotatableExtent>,
176    /// The space occupied within the parent view's coordinate system.
177    /// It does NOT describe the child view's logical size.
178    pub extent_in_parent: Option<RotatableExtent>,
179    /// The list of child views, in the order known to the graphics API.
180    ///
181    /// Each integer in this vector refers to the child's position in the
182    /// |views| or |incomplete| vector that the parent is in.
183    ///
184    /// The identity, position, and size of each child view. Position and size are
185    /// described by the extent of the child view within the parent view's
186    /// coordinate system.
187    ///
188    /// The view tree topology is reliable. A child placed here is equivalent to
189    /// the parent view receiving a "child view connected" signal.
190    ///
191    /// Limitations. A child's view boundary is described in the parent view's
192    /// coordinate system, which is subject to weak consistency (depending on the
193    /// graphics API). That is, when a parent view has a change in size or metrics,
194    /// the context view may observe a "jump" as the parent view incorporates those
195    /// data. In such cases, a new ViewTreeSnapshot is issued to describe the
196    /// change in position, relative to the context view.
197    pub children: Option<Vec<u32>>,
198    #[doc(hidden)]
199    pub __source_breaking: fidl::marker::SourceBreaking,
200}
201
202impl fidl::Persistable for ViewDescriptor {}
203
204/// A description of the context view and its descendant views, if any.
205#[derive(Clone, Debug, Default, PartialEq)]
206pub struct ViewTreeSnapshot {
207    /// When the snapshot was taken. Timebase is monotonic time.
208    pub time: Option<i64>,
209    /// The context view (at element 0) and a complete list of its descendant views.
210    ///
211    /// If `MAX_VIEW_COUNT` is exceeded, this field is not set, and an error is reported in
212    /// `Error`.
213    pub views: Option<Vec<ViewDescriptor>>,
214    #[doc(hidden)]
215    pub __source_breaking: fidl::marker::SourceBreaking,
216}
217
218impl fidl::Persistable for ViewTreeSnapshot {}
219
220/// Response for fuchsia.ui.observation.geometry.ViewTreeWatcher.Watch.
221#[derive(Clone, Debug, Default, PartialEq)]
222pub struct WatchResponse {
223    /// When the response is sent. Timebase is monotonic time.
224    pub epoch_end: Option<i64>,
225    /// A list of most recent updates for a particular view.
226    pub updates: Option<Vec<ViewTreeSnapshot>>,
227    /// Only set if an error condition is detected. If unset, the client may assume
228    /// that updates has complete information over its epoch.
229    pub error: Option<Error>,
230    #[doc(hidden)]
231    pub __source_breaking: fidl::marker::SourceBreaking,
232}
233
234impl fidl::Persistable for WatchResponse {}
235
236pub mod view_tree_watcher_ordinals {
237    pub const WATCH: u64 = 0x3c7670983418477b;
238}
239
240mod internal {
241    use super::*;
242    unsafe impl fidl::encoding::TypeMarker for Error {
243        type Owned = Self;
244
245        #[inline(always)]
246        fn inline_align(_context: fidl::encoding::Context) -> usize {
247            4
248        }
249
250        #[inline(always)]
251        fn inline_size(_context: fidl::encoding::Context) -> usize {
252            4
253        }
254    }
255
256    impl fidl::encoding::ValueTypeMarker for Error {
257        type Borrowed<'a> = Self;
258        #[inline(always)]
259        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
260            *value
261        }
262    }
263
264    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
265        #[inline]
266        unsafe fn encode(
267            self,
268            encoder: &mut fidl::encoding::Encoder<'_, D>,
269            offset: usize,
270            _depth: fidl::encoding::Depth,
271        ) -> fidl::Result<()> {
272            encoder.debug_check_bounds::<Self>(offset);
273            encoder.write_num(self.bits(), offset);
274            Ok(())
275        }
276    }
277
278    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
279        #[inline(always)]
280        fn new_empty() -> Self {
281            Self::empty()
282        }
283
284        #[inline]
285        unsafe fn decode(
286            &mut self,
287            decoder: &mut fidl::encoding::Decoder<'_, D>,
288            offset: usize,
289            _depth: fidl::encoding::Depth,
290        ) -> fidl::Result<()> {
291            decoder.debug_check_bounds::<Self>(offset);
292            let prim = decoder.read_num::<u32>(offset);
293            *self = Self::from_bits_allow_unknown(prim);
294            Ok(())
295        }
296    }
297
298    impl fidl::encoding::ValueTypeMarker for AlignedExtent {
299        type Borrowed<'a> = &'a Self;
300        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
301            value
302        }
303    }
304
305    unsafe impl fidl::encoding::TypeMarker for AlignedExtent {
306        type Owned = Self;
307
308        #[inline(always)]
309        fn inline_align(_context: fidl::encoding::Context) -> usize {
310            4
311        }
312
313        #[inline(always)]
314        fn inline_size(_context: fidl::encoding::Context) -> usize {
315            16
316        }
317    }
318
319    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AlignedExtent, D>
320        for &AlignedExtent
321    {
322        #[inline]
323        unsafe fn encode(
324            self,
325            encoder: &mut fidl::encoding::Encoder<'_, D>,
326            offset: usize,
327            _depth: fidl::encoding::Depth,
328        ) -> fidl::Result<()> {
329            encoder.debug_check_bounds::<AlignedExtent>(offset);
330            // Delegate to tuple encoding.
331            fidl::encoding::Encode::<AlignedExtent, D>::encode(
332                (
333                    <fidl_fuchsia_math__common::PointF as fidl::encoding::ValueTypeMarker>::borrow(
334                        &self.min,
335                    ),
336                    <fidl_fuchsia_math__common::PointF as fidl::encoding::ValueTypeMarker>::borrow(
337                        &self.max,
338                    ),
339                ),
340                encoder,
341                offset,
342                _depth,
343            )
344        }
345    }
346    unsafe impl<
347            D: fidl::encoding::ResourceDialect,
348            T0: fidl::encoding::Encode<fidl_fuchsia_math__common::PointF, D>,
349            T1: fidl::encoding::Encode<fidl_fuchsia_math__common::PointF, D>,
350        > fidl::encoding::Encode<AlignedExtent, D> for (T0, T1)
351    {
352        #[inline]
353        unsafe fn encode(
354            self,
355            encoder: &mut fidl::encoding::Encoder<'_, D>,
356            offset: usize,
357            depth: fidl::encoding::Depth,
358        ) -> fidl::Result<()> {
359            encoder.debug_check_bounds::<AlignedExtent>(offset);
360            // Zero out padding regions. There's no need to apply masks
361            // because the unmasked parts will be overwritten by fields.
362            // Write the fields.
363            self.0.encode(encoder, offset + 0, depth)?;
364            self.1.encode(encoder, offset + 8, depth)?;
365            Ok(())
366        }
367    }
368
369    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AlignedExtent {
370        #[inline(always)]
371        fn new_empty() -> Self {
372            Self {
373                min: fidl::new_empty!(fidl_fuchsia_math__common::PointF, D),
374                max: fidl::new_empty!(fidl_fuchsia_math__common::PointF, D),
375            }
376        }
377
378        #[inline]
379        unsafe fn decode(
380            &mut self,
381            decoder: &mut fidl::encoding::Decoder<'_, D>,
382            offset: usize,
383            _depth: fidl::encoding::Depth,
384        ) -> fidl::Result<()> {
385            decoder.debug_check_bounds::<Self>(offset);
386            // Verify that padding bytes are zero.
387            fidl::decode!(
388                fidl_fuchsia_math__common::PointF,
389                D,
390                &mut self.min,
391                decoder,
392                offset + 0,
393                _depth
394            )?;
395            fidl::decode!(
396                fidl_fuchsia_math__common::PointF,
397                D,
398                &mut self.max,
399                decoder,
400                offset + 8,
401                _depth
402            )?;
403            Ok(())
404        }
405    }
406
407    impl fidl::encoding::ValueTypeMarker for Layout {
408        type Borrowed<'a> = &'a Self;
409        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
410            value
411        }
412    }
413
414    unsafe impl fidl::encoding::TypeMarker for Layout {
415        type Owned = Self;
416
417        #[inline(always)]
418        fn inline_align(_context: fidl::encoding::Context) -> usize {
419            4
420        }
421
422        #[inline(always)]
423        fn inline_size(_context: fidl::encoding::Context) -> usize {
424            40
425        }
426    }
427
428    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Layout, D> for &Layout {
429        #[inline]
430        unsafe fn encode(
431            self,
432            encoder: &mut fidl::encoding::Encoder<'_, D>,
433            offset: usize,
434            _depth: fidl::encoding::Depth,
435        ) -> fidl::Result<()> {
436            encoder.debug_check_bounds::<Layout>(offset);
437            // Delegate to tuple encoding.
438            fidl::encoding::Encode::<Layout, D>::encode(
439                (
440                    <AlignedExtent as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
441                    <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow(
442                        &self.pixel_scale,
443                    ),
444                    <fidl_fuchsia_math__common::InsetF as fidl::encoding::ValueTypeMarker>::borrow(
445                        &self.inset,
446                    ),
447                ),
448                encoder,
449                offset,
450                _depth,
451            )
452        }
453    }
454    unsafe impl<
455            D: fidl::encoding::ResourceDialect,
456            T0: fidl::encoding::Encode<AlignedExtent, D>,
457            T1: fidl::encoding::Encode<fidl::encoding::Array<f32, 2>, D>,
458            T2: fidl::encoding::Encode<fidl_fuchsia_math__common::InsetF, D>,
459        > fidl::encoding::Encode<Layout, D> for (T0, T1, T2)
460    {
461        #[inline]
462        unsafe fn encode(
463            self,
464            encoder: &mut fidl::encoding::Encoder<'_, D>,
465            offset: usize,
466            depth: fidl::encoding::Depth,
467        ) -> fidl::Result<()> {
468            encoder.debug_check_bounds::<Layout>(offset);
469            // Zero out padding regions. There's no need to apply masks
470            // because the unmasked parts will be overwritten by fields.
471            // Write the fields.
472            self.0.encode(encoder, offset + 0, depth)?;
473            self.1.encode(encoder, offset + 16, depth)?;
474            self.2.encode(encoder, offset + 24, depth)?;
475            Ok(())
476        }
477    }
478
479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Layout {
480        #[inline(always)]
481        fn new_empty() -> Self {
482            Self {
483                extent: fidl::new_empty!(AlignedExtent, D),
484                pixel_scale: fidl::new_empty!(fidl::encoding::Array<f32, 2>, D),
485                inset: fidl::new_empty!(fidl_fuchsia_math__common::InsetF, D),
486            }
487        }
488
489        #[inline]
490        unsafe fn decode(
491            &mut self,
492            decoder: &mut fidl::encoding::Decoder<'_, D>,
493            offset: usize,
494            _depth: fidl::encoding::Depth,
495        ) -> fidl::Result<()> {
496            decoder.debug_check_bounds::<Self>(offset);
497            // Verify that padding bytes are zero.
498            fidl::decode!(AlignedExtent, D, &mut self.extent, decoder, offset + 0, _depth)?;
499            fidl::decode!(fidl::encoding::Array<f32, 2>, D, &mut self.pixel_scale, decoder, offset + 16, _depth)?;
500            fidl::decode!(
501                fidl_fuchsia_math__common::InsetF,
502                D,
503                &mut self.inset,
504                decoder,
505                offset + 24,
506                _depth
507            )?;
508            Ok(())
509        }
510    }
511
512    impl fidl::encoding::ValueTypeMarker for RotatableExtent {
513        type Borrowed<'a> = &'a Self;
514        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
515            value
516        }
517    }
518
519    unsafe impl fidl::encoding::TypeMarker for RotatableExtent {
520        type Owned = Self;
521
522        #[inline(always)]
523        fn inline_align(_context: fidl::encoding::Context) -> usize {
524            4
525        }
526
527        #[inline(always)]
528        fn inline_size(_context: fidl::encoding::Context) -> usize {
529            20
530        }
531    }
532
533    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RotatableExtent, D>
534        for &RotatableExtent
535    {
536        #[inline]
537        unsafe fn encode(
538            self,
539            encoder: &mut fidl::encoding::Encoder<'_, D>,
540            offset: usize,
541            _depth: fidl::encoding::Depth,
542        ) -> fidl::Result<()> {
543            encoder.debug_check_bounds::<RotatableExtent>(offset);
544            // Delegate to tuple encoding.
545            fidl::encoding::Encode::<RotatableExtent, D>::encode(
546                (
547                    <fidl_fuchsia_math__common::PointF as fidl::encoding::ValueTypeMarker>::borrow(
548                        &self.origin,
549                    ),
550                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
551                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
552                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.angle_degrees),
553                ),
554                encoder,
555                offset,
556                _depth,
557            )
558        }
559    }
560    unsafe impl<
561            D: fidl::encoding::ResourceDialect,
562            T0: fidl::encoding::Encode<fidl_fuchsia_math__common::PointF, D>,
563            T1: fidl::encoding::Encode<f32, D>,
564            T2: fidl::encoding::Encode<f32, D>,
565            T3: fidl::encoding::Encode<f32, D>,
566        > fidl::encoding::Encode<RotatableExtent, D> for (T0, T1, T2, T3)
567    {
568        #[inline]
569        unsafe fn encode(
570            self,
571            encoder: &mut fidl::encoding::Encoder<'_, D>,
572            offset: usize,
573            depth: fidl::encoding::Depth,
574        ) -> fidl::Result<()> {
575            encoder.debug_check_bounds::<RotatableExtent>(offset);
576            // Zero out padding regions. There's no need to apply masks
577            // because the unmasked parts will be overwritten by fields.
578            // Write the fields.
579            self.0.encode(encoder, offset + 0, depth)?;
580            self.1.encode(encoder, offset + 8, depth)?;
581            self.2.encode(encoder, offset + 12, depth)?;
582            self.3.encode(encoder, offset + 16, depth)?;
583            Ok(())
584        }
585    }
586
587    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RotatableExtent {
588        #[inline(always)]
589        fn new_empty() -> Self {
590            Self {
591                origin: fidl::new_empty!(fidl_fuchsia_math__common::PointF, D),
592                width: fidl::new_empty!(f32, D),
593                height: fidl::new_empty!(f32, D),
594                angle_degrees: fidl::new_empty!(f32, D),
595            }
596        }
597
598        #[inline]
599        unsafe fn decode(
600            &mut self,
601            decoder: &mut fidl::encoding::Decoder<'_, D>,
602            offset: usize,
603            _depth: fidl::encoding::Depth,
604        ) -> fidl::Result<()> {
605            decoder.debug_check_bounds::<Self>(offset);
606            // Verify that padding bytes are zero.
607            fidl::decode!(
608                fidl_fuchsia_math__common::PointF,
609                D,
610                &mut self.origin,
611                decoder,
612                offset + 0,
613                _depth
614            )?;
615            fidl::decode!(f32, D, &mut self.width, decoder, offset + 8, _depth)?;
616            fidl::decode!(f32, D, &mut self.height, decoder, offset + 12, _depth)?;
617            fidl::decode!(f32, D, &mut self.angle_degrees, decoder, offset + 16, _depth)?;
618            Ok(())
619        }
620    }
621
622    impl ViewDescriptor {
623        #[inline(always)]
624        fn max_ordinal_present(&self) -> u64 {
625            if let Some(_) = self.children {
626                return 5;
627            }
628            if let Some(_) = self.extent_in_parent {
629                return 4;
630            }
631            if let Some(_) = self.extent_in_context {
632                return 3;
633            }
634            if let Some(_) = self.layout {
635                return 2;
636            }
637            if let Some(_) = self.view_ref_koid {
638                return 1;
639            }
640            0
641        }
642    }
643
644    impl fidl::encoding::ValueTypeMarker for ViewDescriptor {
645        type Borrowed<'a> = &'a Self;
646        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
647            value
648        }
649    }
650
651    unsafe impl fidl::encoding::TypeMarker for ViewDescriptor {
652        type Owned = Self;
653
654        #[inline(always)]
655        fn inline_align(_context: fidl::encoding::Context) -> usize {
656            8
657        }
658
659        #[inline(always)]
660        fn inline_size(_context: fidl::encoding::Context) -> usize {
661            16
662        }
663    }
664
665    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ViewDescriptor, D>
666        for &ViewDescriptor
667    {
668        unsafe fn encode(
669            self,
670            encoder: &mut fidl::encoding::Encoder<'_, D>,
671            offset: usize,
672            mut depth: fidl::encoding::Depth,
673        ) -> fidl::Result<()> {
674            encoder.debug_check_bounds::<ViewDescriptor>(offset);
675            // Vector header
676            let max_ordinal: u64 = self.max_ordinal_present();
677            encoder.write_num(max_ordinal, offset);
678            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
679            // Calling encoder.out_of_line_offset(0) is not allowed.
680            if max_ordinal == 0 {
681                return Ok(());
682            }
683            depth.increment()?;
684            let envelope_size = 8;
685            let bytes_len = max_ordinal as usize * envelope_size;
686            #[allow(unused_variables)]
687            let offset = encoder.out_of_line_offset(bytes_len);
688            let mut _prev_end_offset: usize = 0;
689            if 1 > max_ordinal {
690                return Ok(());
691            }
692
693            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
694            // are envelope_size bytes.
695            let cur_offset: usize = (1 - 1) * envelope_size;
696
697            // Zero reserved fields.
698            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
699
700            // Safety:
701            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
702            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
703            //   envelope_size bytes, there is always sufficient room.
704            fidl::encoding::encode_in_envelope_optional::<u64, D>(
705                self.view_ref_koid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
706                encoder,
707                offset + cur_offset,
708                depth,
709            )?;
710
711            _prev_end_offset = cur_offset + envelope_size;
712            if 2 > max_ordinal {
713                return Ok(());
714            }
715
716            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
717            // are envelope_size bytes.
718            let cur_offset: usize = (2 - 1) * envelope_size;
719
720            // Zero reserved fields.
721            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
722
723            // Safety:
724            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
725            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
726            //   envelope_size bytes, there is always sufficient room.
727            fidl::encoding::encode_in_envelope_optional::<Layout, D>(
728                self.layout.as_ref().map(<Layout as fidl::encoding::ValueTypeMarker>::borrow),
729                encoder,
730                offset + cur_offset,
731                depth,
732            )?;
733
734            _prev_end_offset = cur_offset + envelope_size;
735            if 3 > max_ordinal {
736                return Ok(());
737            }
738
739            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
740            // are envelope_size bytes.
741            let cur_offset: usize = (3 - 1) * envelope_size;
742
743            // Zero reserved fields.
744            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
745
746            // Safety:
747            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
748            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
749            //   envelope_size bytes, there is always sufficient room.
750            fidl::encoding::encode_in_envelope_optional::<RotatableExtent, D>(
751                self.extent_in_context
752                    .as_ref()
753                    .map(<RotatableExtent as fidl::encoding::ValueTypeMarker>::borrow),
754                encoder,
755                offset + cur_offset,
756                depth,
757            )?;
758
759            _prev_end_offset = cur_offset + envelope_size;
760            if 4 > max_ordinal {
761                return Ok(());
762            }
763
764            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
765            // are envelope_size bytes.
766            let cur_offset: usize = (4 - 1) * envelope_size;
767
768            // Zero reserved fields.
769            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
770
771            // Safety:
772            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
773            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
774            //   envelope_size bytes, there is always sufficient room.
775            fidl::encoding::encode_in_envelope_optional::<RotatableExtent, D>(
776                self.extent_in_parent
777                    .as_ref()
778                    .map(<RotatableExtent as fidl::encoding::ValueTypeMarker>::borrow),
779                encoder,
780                offset + cur_offset,
781                depth,
782            )?;
783
784            _prev_end_offset = cur_offset + envelope_size;
785            if 5 > max_ordinal {
786                return Ok(());
787            }
788
789            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
790            // are envelope_size bytes.
791            let cur_offset: usize = (5 - 1) * envelope_size;
792
793            // Zero reserved fields.
794            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
795
796            // Safety:
797            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
798            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
799            //   envelope_size bytes, there is always sufficient room.
800            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u32, 300>, D>(
801                self.children.as_ref().map(
802                    <fidl::encoding::Vector<u32, 300> as fidl::encoding::ValueTypeMarker>::borrow,
803                ),
804                encoder,
805                offset + cur_offset,
806                depth,
807            )?;
808
809            _prev_end_offset = cur_offset + envelope_size;
810
811            Ok(())
812        }
813    }
814
815    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ViewDescriptor {
816        #[inline(always)]
817        fn new_empty() -> Self {
818            Self::default()
819        }
820
821        unsafe fn decode(
822            &mut self,
823            decoder: &mut fidl::encoding::Decoder<'_, D>,
824            offset: usize,
825            mut depth: fidl::encoding::Depth,
826        ) -> fidl::Result<()> {
827            decoder.debug_check_bounds::<Self>(offset);
828            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
829                None => return Err(fidl::Error::NotNullable),
830                Some(len) => len,
831            };
832            // Calling decoder.out_of_line_offset(0) is not allowed.
833            if len == 0 {
834                return Ok(());
835            };
836            depth.increment()?;
837            let envelope_size = 8;
838            let bytes_len = len * envelope_size;
839            let offset = decoder.out_of_line_offset(bytes_len)?;
840            // Decode the envelope for each type.
841            let mut _next_ordinal_to_read = 0;
842            let mut next_offset = offset;
843            let end_offset = offset + bytes_len;
844            _next_ordinal_to_read += 1;
845            if next_offset >= end_offset {
846                return Ok(());
847            }
848
849            // Decode unknown envelopes for gaps in ordinals.
850            while _next_ordinal_to_read < 1 {
851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
852                _next_ordinal_to_read += 1;
853                next_offset += envelope_size;
854            }
855
856            let next_out_of_line = decoder.next_out_of_line();
857            let handles_before = decoder.remaining_handles();
858            if let Some((inlined, num_bytes, num_handles)) =
859                fidl::encoding::decode_envelope_header(decoder, next_offset)?
860            {
861                let member_inline_size =
862                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
863                if inlined != (member_inline_size <= 4) {
864                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
865                }
866                let inner_offset;
867                let mut inner_depth = depth.clone();
868                if inlined {
869                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
870                    inner_offset = next_offset;
871                } else {
872                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
873                    inner_depth.increment()?;
874                }
875                let val_ref = self.view_ref_koid.get_or_insert_with(|| fidl::new_empty!(u64, D));
876                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
877                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
878                {
879                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
880                }
881                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
882                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
883                }
884            }
885
886            next_offset += envelope_size;
887            _next_ordinal_to_read += 1;
888            if next_offset >= end_offset {
889                return Ok(());
890            }
891
892            // Decode unknown envelopes for gaps in ordinals.
893            while _next_ordinal_to_read < 2 {
894                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
895                _next_ordinal_to_read += 1;
896                next_offset += envelope_size;
897            }
898
899            let next_out_of_line = decoder.next_out_of_line();
900            let handles_before = decoder.remaining_handles();
901            if let Some((inlined, num_bytes, num_handles)) =
902                fidl::encoding::decode_envelope_header(decoder, next_offset)?
903            {
904                let member_inline_size =
905                    <Layout as fidl::encoding::TypeMarker>::inline_size(decoder.context);
906                if inlined != (member_inline_size <= 4) {
907                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
908                }
909                let inner_offset;
910                let mut inner_depth = depth.clone();
911                if inlined {
912                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
913                    inner_offset = next_offset;
914                } else {
915                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
916                    inner_depth.increment()?;
917                }
918                let val_ref = self.layout.get_or_insert_with(|| fidl::new_empty!(Layout, D));
919                fidl::decode!(Layout, D, val_ref, decoder, inner_offset, inner_depth)?;
920                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
921                {
922                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
923                }
924                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
925                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
926                }
927            }
928
929            next_offset += envelope_size;
930            _next_ordinal_to_read += 1;
931            if next_offset >= end_offset {
932                return Ok(());
933            }
934
935            // Decode unknown envelopes for gaps in ordinals.
936            while _next_ordinal_to_read < 3 {
937                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
938                _next_ordinal_to_read += 1;
939                next_offset += envelope_size;
940            }
941
942            let next_out_of_line = decoder.next_out_of_line();
943            let handles_before = decoder.remaining_handles();
944            if let Some((inlined, num_bytes, num_handles)) =
945                fidl::encoding::decode_envelope_header(decoder, next_offset)?
946            {
947                let member_inline_size =
948                    <RotatableExtent as fidl::encoding::TypeMarker>::inline_size(decoder.context);
949                if inlined != (member_inline_size <= 4) {
950                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
951                }
952                let inner_offset;
953                let mut inner_depth = depth.clone();
954                if inlined {
955                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
956                    inner_offset = next_offset;
957                } else {
958                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
959                    inner_depth.increment()?;
960                }
961                let val_ref = self
962                    .extent_in_context
963                    .get_or_insert_with(|| fidl::new_empty!(RotatableExtent, D));
964                fidl::decode!(RotatableExtent, D, val_ref, decoder, inner_offset, inner_depth)?;
965                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
966                {
967                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
968                }
969                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
970                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
971                }
972            }
973
974            next_offset += envelope_size;
975            _next_ordinal_to_read += 1;
976            if next_offset >= end_offset {
977                return Ok(());
978            }
979
980            // Decode unknown envelopes for gaps in ordinals.
981            while _next_ordinal_to_read < 4 {
982                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
983                _next_ordinal_to_read += 1;
984                next_offset += envelope_size;
985            }
986
987            let next_out_of_line = decoder.next_out_of_line();
988            let handles_before = decoder.remaining_handles();
989            if let Some((inlined, num_bytes, num_handles)) =
990                fidl::encoding::decode_envelope_header(decoder, next_offset)?
991            {
992                let member_inline_size =
993                    <RotatableExtent as fidl::encoding::TypeMarker>::inline_size(decoder.context);
994                if inlined != (member_inline_size <= 4) {
995                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
996                }
997                let inner_offset;
998                let mut inner_depth = depth.clone();
999                if inlined {
1000                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1001                    inner_offset = next_offset;
1002                } else {
1003                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1004                    inner_depth.increment()?;
1005                }
1006                let val_ref = self
1007                    .extent_in_parent
1008                    .get_or_insert_with(|| fidl::new_empty!(RotatableExtent, D));
1009                fidl::decode!(RotatableExtent, D, val_ref, decoder, inner_offset, inner_depth)?;
1010                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1011                {
1012                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1013                }
1014                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1015                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1016                }
1017            }
1018
1019            next_offset += envelope_size;
1020            _next_ordinal_to_read += 1;
1021            if next_offset >= end_offset {
1022                return Ok(());
1023            }
1024
1025            // Decode unknown envelopes for gaps in ordinals.
1026            while _next_ordinal_to_read < 5 {
1027                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1028                _next_ordinal_to_read += 1;
1029                next_offset += envelope_size;
1030            }
1031
1032            let next_out_of_line = decoder.next_out_of_line();
1033            let handles_before = decoder.remaining_handles();
1034            if let Some((inlined, num_bytes, num_handles)) =
1035                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1036            {
1037                let member_inline_size =
1038                    <fidl::encoding::Vector<u32, 300> as fidl::encoding::TypeMarker>::inline_size(
1039                        decoder.context,
1040                    );
1041                if inlined != (member_inline_size <= 4) {
1042                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1043                }
1044                let inner_offset;
1045                let mut inner_depth = depth.clone();
1046                if inlined {
1047                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1048                    inner_offset = next_offset;
1049                } else {
1050                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1051                    inner_depth.increment()?;
1052                }
1053                let val_ref = self
1054                    .children
1055                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u32, 300>, D));
1056                fidl::decode!(fidl::encoding::Vector<u32, 300>, D, val_ref, decoder, inner_offset, inner_depth)?;
1057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1058                {
1059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1060                }
1061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1063                }
1064            }
1065
1066            next_offset += envelope_size;
1067
1068            // Decode the remaining unknown envelopes.
1069            while next_offset < end_offset {
1070                _next_ordinal_to_read += 1;
1071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1072                next_offset += envelope_size;
1073            }
1074
1075            Ok(())
1076        }
1077    }
1078
1079    impl ViewTreeSnapshot {
1080        #[inline(always)]
1081        fn max_ordinal_present(&self) -> u64 {
1082            if let Some(_) = self.views {
1083                return 2;
1084            }
1085            if let Some(_) = self.time {
1086                return 1;
1087            }
1088            0
1089        }
1090    }
1091
1092    impl fidl::encoding::ValueTypeMarker for ViewTreeSnapshot {
1093        type Borrowed<'a> = &'a Self;
1094        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1095            value
1096        }
1097    }
1098
1099    unsafe impl fidl::encoding::TypeMarker for ViewTreeSnapshot {
1100        type Owned = Self;
1101
1102        #[inline(always)]
1103        fn inline_align(_context: fidl::encoding::Context) -> usize {
1104            8
1105        }
1106
1107        #[inline(always)]
1108        fn inline_size(_context: fidl::encoding::Context) -> usize {
1109            16
1110        }
1111    }
1112
1113    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ViewTreeSnapshot, D>
1114        for &ViewTreeSnapshot
1115    {
1116        unsafe fn encode(
1117            self,
1118            encoder: &mut fidl::encoding::Encoder<'_, D>,
1119            offset: usize,
1120            mut depth: fidl::encoding::Depth,
1121        ) -> fidl::Result<()> {
1122            encoder.debug_check_bounds::<ViewTreeSnapshot>(offset);
1123            // Vector header
1124            let max_ordinal: u64 = self.max_ordinal_present();
1125            encoder.write_num(max_ordinal, offset);
1126            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1127            // Calling encoder.out_of_line_offset(0) is not allowed.
1128            if max_ordinal == 0 {
1129                return Ok(());
1130            }
1131            depth.increment()?;
1132            let envelope_size = 8;
1133            let bytes_len = max_ordinal as usize * envelope_size;
1134            #[allow(unused_variables)]
1135            let offset = encoder.out_of_line_offset(bytes_len);
1136            let mut _prev_end_offset: usize = 0;
1137            if 1 > max_ordinal {
1138                return Ok(());
1139            }
1140
1141            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1142            // are envelope_size bytes.
1143            let cur_offset: usize = (1 - 1) * envelope_size;
1144
1145            // Zero reserved fields.
1146            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1147
1148            // Safety:
1149            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1150            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1151            //   envelope_size bytes, there is always sufficient room.
1152            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1153                self.time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1154                encoder,
1155                offset + cur_offset,
1156                depth,
1157            )?;
1158
1159            _prev_end_offset = cur_offset + envelope_size;
1160            if 2 > max_ordinal {
1161                return Ok(());
1162            }
1163
1164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1165            // are envelope_size bytes.
1166            let cur_offset: usize = (2 - 1) * envelope_size;
1167
1168            // Zero reserved fields.
1169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1170
1171            // Safety:
1172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1174            //   envelope_size bytes, there is always sufficient room.
1175            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ViewDescriptor, 300>, D>(
1176            self.views.as_ref().map(<fidl::encoding::Vector<ViewDescriptor, 300> as fidl::encoding::ValueTypeMarker>::borrow),
1177            encoder, offset + cur_offset, depth
1178        )?;
1179
1180            _prev_end_offset = cur_offset + envelope_size;
1181
1182            Ok(())
1183        }
1184    }
1185
1186    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ViewTreeSnapshot {
1187        #[inline(always)]
1188        fn new_empty() -> Self {
1189            Self::default()
1190        }
1191
1192        unsafe fn decode(
1193            &mut self,
1194            decoder: &mut fidl::encoding::Decoder<'_, D>,
1195            offset: usize,
1196            mut depth: fidl::encoding::Depth,
1197        ) -> fidl::Result<()> {
1198            decoder.debug_check_bounds::<Self>(offset);
1199            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1200                None => return Err(fidl::Error::NotNullable),
1201                Some(len) => len,
1202            };
1203            // Calling decoder.out_of_line_offset(0) is not allowed.
1204            if len == 0 {
1205                return Ok(());
1206            };
1207            depth.increment()?;
1208            let envelope_size = 8;
1209            let bytes_len = len * envelope_size;
1210            let offset = decoder.out_of_line_offset(bytes_len)?;
1211            // Decode the envelope for each type.
1212            let mut _next_ordinal_to_read = 0;
1213            let mut next_offset = offset;
1214            let end_offset = offset + bytes_len;
1215            _next_ordinal_to_read += 1;
1216            if next_offset >= end_offset {
1217                return Ok(());
1218            }
1219
1220            // Decode unknown envelopes for gaps in ordinals.
1221            while _next_ordinal_to_read < 1 {
1222                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1223                _next_ordinal_to_read += 1;
1224                next_offset += envelope_size;
1225            }
1226
1227            let next_out_of_line = decoder.next_out_of_line();
1228            let handles_before = decoder.remaining_handles();
1229            if let Some((inlined, num_bytes, num_handles)) =
1230                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1231            {
1232                let member_inline_size =
1233                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1234                if inlined != (member_inline_size <= 4) {
1235                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1236                }
1237                let inner_offset;
1238                let mut inner_depth = depth.clone();
1239                if inlined {
1240                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1241                    inner_offset = next_offset;
1242                } else {
1243                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1244                    inner_depth.increment()?;
1245                }
1246                let val_ref = self.time.get_or_insert_with(|| fidl::new_empty!(i64, D));
1247                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1248                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1249                {
1250                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1251                }
1252                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1253                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1254                }
1255            }
1256
1257            next_offset += envelope_size;
1258            _next_ordinal_to_read += 1;
1259            if next_offset >= end_offset {
1260                return Ok(());
1261            }
1262
1263            // Decode unknown envelopes for gaps in ordinals.
1264            while _next_ordinal_to_read < 2 {
1265                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1266                _next_ordinal_to_read += 1;
1267                next_offset += envelope_size;
1268            }
1269
1270            let next_out_of_line = decoder.next_out_of_line();
1271            let handles_before = decoder.remaining_handles();
1272            if let Some((inlined, num_bytes, num_handles)) =
1273                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1274            {
1275                let member_inline_size = <fidl::encoding::Vector<ViewDescriptor, 300> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1276                if inlined != (member_inline_size <= 4) {
1277                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1278                }
1279                let inner_offset;
1280                let mut inner_depth = depth.clone();
1281                if inlined {
1282                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1283                    inner_offset = next_offset;
1284                } else {
1285                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1286                    inner_depth.increment()?;
1287                }
1288                let val_ref = self.views.get_or_insert_with(
1289                    || fidl::new_empty!(fidl::encoding::Vector<ViewDescriptor, 300>, D),
1290                );
1291                fidl::decode!(fidl::encoding::Vector<ViewDescriptor, 300>, D, val_ref, decoder, inner_offset, inner_depth)?;
1292                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1293                {
1294                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1295                }
1296                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1297                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1298                }
1299            }
1300
1301            next_offset += envelope_size;
1302
1303            // Decode the remaining unknown envelopes.
1304            while next_offset < end_offset {
1305                _next_ordinal_to_read += 1;
1306                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1307                next_offset += envelope_size;
1308            }
1309
1310            Ok(())
1311        }
1312    }
1313
1314    impl WatchResponse {
1315        #[inline(always)]
1316        fn max_ordinal_present(&self) -> u64 {
1317            if let Some(_) = self.error {
1318                return 3;
1319            }
1320            if let Some(_) = self.updates {
1321                return 2;
1322            }
1323            if let Some(_) = self.epoch_end {
1324                return 1;
1325            }
1326            0
1327        }
1328    }
1329
1330    impl fidl::encoding::ValueTypeMarker for WatchResponse {
1331        type Borrowed<'a> = &'a Self;
1332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1333            value
1334        }
1335    }
1336
1337    unsafe impl fidl::encoding::TypeMarker for WatchResponse {
1338        type Owned = Self;
1339
1340        #[inline(always)]
1341        fn inline_align(_context: fidl::encoding::Context) -> usize {
1342            8
1343        }
1344
1345        #[inline(always)]
1346        fn inline_size(_context: fidl::encoding::Context) -> usize {
1347            16
1348        }
1349    }
1350
1351    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchResponse, D>
1352        for &WatchResponse
1353    {
1354        unsafe fn encode(
1355            self,
1356            encoder: &mut fidl::encoding::Encoder<'_, D>,
1357            offset: usize,
1358            mut depth: fidl::encoding::Depth,
1359        ) -> fidl::Result<()> {
1360            encoder.debug_check_bounds::<WatchResponse>(offset);
1361            // Vector header
1362            let max_ordinal: u64 = self.max_ordinal_present();
1363            encoder.write_num(max_ordinal, offset);
1364            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1365            // Calling encoder.out_of_line_offset(0) is not allowed.
1366            if max_ordinal == 0 {
1367                return Ok(());
1368            }
1369            depth.increment()?;
1370            let envelope_size = 8;
1371            let bytes_len = max_ordinal as usize * envelope_size;
1372            #[allow(unused_variables)]
1373            let offset = encoder.out_of_line_offset(bytes_len);
1374            let mut _prev_end_offset: usize = 0;
1375            if 1 > max_ordinal {
1376                return Ok(());
1377            }
1378
1379            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1380            // are envelope_size bytes.
1381            let cur_offset: usize = (1 - 1) * envelope_size;
1382
1383            // Zero reserved fields.
1384            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1385
1386            // Safety:
1387            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1388            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1389            //   envelope_size bytes, there is always sufficient room.
1390            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1391                self.epoch_end.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1392                encoder,
1393                offset + cur_offset,
1394                depth,
1395            )?;
1396
1397            _prev_end_offset = cur_offset + envelope_size;
1398            if 2 > max_ordinal {
1399                return Ok(());
1400            }
1401
1402            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1403            // are envelope_size bytes.
1404            let cur_offset: usize = (2 - 1) * envelope_size;
1405
1406            // Zero reserved fields.
1407            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1408
1409            // Safety:
1410            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1411            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1412            //   envelope_size bytes, there is always sufficient room.
1413            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ViewTreeSnapshot, 200>, D>(
1414            self.updates.as_ref().map(<fidl::encoding::Vector<ViewTreeSnapshot, 200> as fidl::encoding::ValueTypeMarker>::borrow),
1415            encoder, offset + cur_offset, depth
1416        )?;
1417
1418            _prev_end_offset = cur_offset + envelope_size;
1419            if 3 > max_ordinal {
1420                return Ok(());
1421            }
1422
1423            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1424            // are envelope_size bytes.
1425            let cur_offset: usize = (3 - 1) * envelope_size;
1426
1427            // Zero reserved fields.
1428            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1429
1430            // Safety:
1431            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1432            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1433            //   envelope_size bytes, there is always sufficient room.
1434            fidl::encoding::encode_in_envelope_optional::<Error, D>(
1435                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
1436                encoder,
1437                offset + cur_offset,
1438                depth,
1439            )?;
1440
1441            _prev_end_offset = cur_offset + envelope_size;
1442
1443            Ok(())
1444        }
1445    }
1446
1447    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchResponse {
1448        #[inline(always)]
1449        fn new_empty() -> Self {
1450            Self::default()
1451        }
1452
1453        unsafe fn decode(
1454            &mut self,
1455            decoder: &mut fidl::encoding::Decoder<'_, D>,
1456            offset: usize,
1457            mut depth: fidl::encoding::Depth,
1458        ) -> fidl::Result<()> {
1459            decoder.debug_check_bounds::<Self>(offset);
1460            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1461                None => return Err(fidl::Error::NotNullable),
1462                Some(len) => len,
1463            };
1464            // Calling decoder.out_of_line_offset(0) is not allowed.
1465            if len == 0 {
1466                return Ok(());
1467            };
1468            depth.increment()?;
1469            let envelope_size = 8;
1470            let bytes_len = len * envelope_size;
1471            let offset = decoder.out_of_line_offset(bytes_len)?;
1472            // Decode the envelope for each type.
1473            let mut _next_ordinal_to_read = 0;
1474            let mut next_offset = offset;
1475            let end_offset = offset + bytes_len;
1476            _next_ordinal_to_read += 1;
1477            if next_offset >= end_offset {
1478                return Ok(());
1479            }
1480
1481            // Decode unknown envelopes for gaps in ordinals.
1482            while _next_ordinal_to_read < 1 {
1483                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1484                _next_ordinal_to_read += 1;
1485                next_offset += envelope_size;
1486            }
1487
1488            let next_out_of_line = decoder.next_out_of_line();
1489            let handles_before = decoder.remaining_handles();
1490            if let Some((inlined, num_bytes, num_handles)) =
1491                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1492            {
1493                let member_inline_size =
1494                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1495                if inlined != (member_inline_size <= 4) {
1496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1497                }
1498                let inner_offset;
1499                let mut inner_depth = depth.clone();
1500                if inlined {
1501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1502                    inner_offset = next_offset;
1503                } else {
1504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1505                    inner_depth.increment()?;
1506                }
1507                let val_ref = self.epoch_end.get_or_insert_with(|| fidl::new_empty!(i64, D));
1508                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1509                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1510                {
1511                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1512                }
1513                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1514                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1515                }
1516            }
1517
1518            next_offset += envelope_size;
1519            _next_ordinal_to_read += 1;
1520            if next_offset >= end_offset {
1521                return Ok(());
1522            }
1523
1524            // Decode unknown envelopes for gaps in ordinals.
1525            while _next_ordinal_to_read < 2 {
1526                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1527                _next_ordinal_to_read += 1;
1528                next_offset += envelope_size;
1529            }
1530
1531            let next_out_of_line = decoder.next_out_of_line();
1532            let handles_before = decoder.remaining_handles();
1533            if let Some((inlined, num_bytes, num_handles)) =
1534                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1535            {
1536                let member_inline_size = <fidl::encoding::Vector<ViewTreeSnapshot, 200> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1537                if inlined != (member_inline_size <= 4) {
1538                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1539                }
1540                let inner_offset;
1541                let mut inner_depth = depth.clone();
1542                if inlined {
1543                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1544                    inner_offset = next_offset;
1545                } else {
1546                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1547                    inner_depth.increment()?;
1548                }
1549                let val_ref = self.updates.get_or_insert_with(
1550                    || fidl::new_empty!(fidl::encoding::Vector<ViewTreeSnapshot, 200>, D),
1551                );
1552                fidl::decode!(fidl::encoding::Vector<ViewTreeSnapshot, 200>, D, val_ref, decoder, inner_offset, inner_depth)?;
1553                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1554                {
1555                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1556                }
1557                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1558                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1559                }
1560            }
1561
1562            next_offset += envelope_size;
1563            _next_ordinal_to_read += 1;
1564            if next_offset >= end_offset {
1565                return Ok(());
1566            }
1567
1568            // Decode unknown envelopes for gaps in ordinals.
1569            while _next_ordinal_to_read < 3 {
1570                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1571                _next_ordinal_to_read += 1;
1572                next_offset += envelope_size;
1573            }
1574
1575            let next_out_of_line = decoder.next_out_of_line();
1576            let handles_before = decoder.remaining_handles();
1577            if let Some((inlined, num_bytes, num_handles)) =
1578                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1579            {
1580                let member_inline_size =
1581                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1582                if inlined != (member_inline_size <= 4) {
1583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1584                }
1585                let inner_offset;
1586                let mut inner_depth = depth.clone();
1587                if inlined {
1588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1589                    inner_offset = next_offset;
1590                } else {
1591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1592                    inner_depth.increment()?;
1593                }
1594                let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
1595                fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
1596                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1597                {
1598                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1599                }
1600                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1601                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1602                }
1603            }
1604
1605            next_offset += envelope_size;
1606
1607            // Decode the remaining unknown envelopes.
1608            while next_offset < end_offset {
1609                _next_ordinal_to_read += 1;
1610                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1611                next_offset += envelope_size;
1612            }
1613
1614            Ok(())
1615        }
1616    }
1617}