fidl_fuchsia_pkg_rewrite_common/
fidl_fuchsia_pkg_rewrite_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#[derive(Clone, Debug, PartialEq)]
12pub struct EditTransactionAddRequest {
13    pub rule: Rule,
14}
15
16impl fidl::Persistable for EditTransactionAddRequest {}
17
18#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub struct EngineTestApplyRequest {
20    pub url: String,
21}
22
23impl fidl::Persistable for EngineTestApplyRequest {}
24
25#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct EngineTestApplyResponse {
27    pub rewritten: String,
28}
29
30impl fidl::Persistable for EngineTestApplyResponse {}
31
32/// A literal match and replacement rule.
33///
34/// # Examples
35///
36/// Replaces example.com with test.example.com for all packages
37/// ```
38/// {
39///     host_match: "example.com"
40///     host_replacement: "test.example.com"
41///     path_prefix_match: "/"
42///     path_prefix_replacement: "/"
43/// }
44/// ```
45///
46/// Replaces example.com with test.example.com for
47/// fuchsia-pkg://example.com/rolldice. A package called "rolldice" in another
48/// repo would not be rewritten.
49/// ```
50/// {
51///     host_match: "example.com"
52///     host_replacement: "test.example.com"
53///     path_prefix_match: "/rolldice"
54///     path_prefix_replacement: "/rolldice"
55/// }
56/// ```
57#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58pub struct LiteralRule {
59    /// The exact hostname to match.
60    pub host_match: String,
61    /// The new hostname to replace the matched `host_match` with.
62    pub host_replacement: String,
63    /// The absolute path to a package or directory to match against.
64    ///
65    /// If `path_prefix_match` ends with '/', it will match any packages or
66    /// subdirectories below the matched path.
67    /// If `path_prefix_match` does not end with '/', it will be interpreted as
68    /// as an exact match.
69    ///
70    /// # Examples
71    ///
72    /// "/example" only matches a package called "example" at the root of the
73    /// repo. "/parent/examples" and "/examples" would not match.
74    ///
75    /// "/example/" would match any package under the "example" path at the root
76    /// of the repo.  For example, "/example/", "/example/package" would both
77    /// match.
78    pub path_prefix_match: String,
79    /// The absolute path to a single package or a directory to replace the
80    /// matched `path_prefix_match` with.
81    ///
82    /// `path_prefix_match` and `path_prefix_replacement` must both match
83    /// directories or both match exact packages. Mixing the two forms is not
84    /// allowed.
85    pub path_prefix_replacement: String,
86}
87
88impl fidl::Persistable for LiteralRule {}
89
90#[derive(Clone, Debug, PartialEq)]
91pub struct RuleIteratorNextResponse {
92    pub rules: Vec<Rule>,
93}
94
95impl fidl::Persistable for RuleIteratorNextResponse {}
96
97/// A rewrite rule, represented as an xunion for future compatibility.
98#[derive(Clone, Debug)]
99pub enum Rule {
100    Literal(LiteralRule),
101    #[doc(hidden)]
102    __SourceBreaking {
103        unknown_ordinal: u64,
104    },
105}
106
107/// Pattern that matches an unknown `Rule` member.
108#[macro_export]
109macro_rules! RuleUnknown {
110    () => {
111        _
112    };
113}
114
115// Custom PartialEq so that unknown variants are not equal to themselves.
116impl PartialEq for Rule {
117    fn eq(&self, other: &Self) -> bool {
118        match (self, other) {
119            (Self::Literal(x), Self::Literal(y)) => *x == *y,
120            _ => false,
121        }
122    }
123}
124
125impl Rule {
126    #[inline]
127    pub fn ordinal(&self) -> u64 {
128        match *self {
129            Self::Literal(_) => 1,
130            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
131        }
132    }
133
134    #[inline]
135    pub fn unknown_variant_for_testing() -> Self {
136        Self::__SourceBreaking { unknown_ordinal: 0 }
137    }
138
139    #[inline]
140    pub fn is_unknown(&self) -> bool {
141        match self {
142            Self::__SourceBreaking { .. } => true,
143            _ => false,
144        }
145    }
146}
147
148impl fidl::Persistable for Rule {}
149
150mod internal {
151    use super::*;
152
153    impl fidl::encoding::ValueTypeMarker for EditTransactionAddRequest {
154        type Borrowed<'a> = &'a Self;
155        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
156            value
157        }
158    }
159
160    unsafe impl fidl::encoding::TypeMarker for EditTransactionAddRequest {
161        type Owned = Self;
162
163        #[inline(always)]
164        fn inline_align(_context: fidl::encoding::Context) -> usize {
165            8
166        }
167
168        #[inline(always)]
169        fn inline_size(_context: fidl::encoding::Context) -> usize {
170            16
171        }
172    }
173
174    unsafe impl<D: fidl::encoding::ResourceDialect>
175        fidl::encoding::Encode<EditTransactionAddRequest, D> for &EditTransactionAddRequest
176    {
177        #[inline]
178        unsafe fn encode(
179            self,
180            encoder: &mut fidl::encoding::Encoder<'_, D>,
181            offset: usize,
182            _depth: fidl::encoding::Depth,
183        ) -> fidl::Result<()> {
184            encoder.debug_check_bounds::<EditTransactionAddRequest>(offset);
185            // Delegate to tuple encoding.
186            fidl::encoding::Encode::<EditTransactionAddRequest, D>::encode(
187                (<Rule as fidl::encoding::ValueTypeMarker>::borrow(&self.rule),),
188                encoder,
189                offset,
190                _depth,
191            )
192        }
193    }
194    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Rule, D>>
195        fidl::encoding::Encode<EditTransactionAddRequest, D> for (T0,)
196    {
197        #[inline]
198        unsafe fn encode(
199            self,
200            encoder: &mut fidl::encoding::Encoder<'_, D>,
201            offset: usize,
202            depth: fidl::encoding::Depth,
203        ) -> fidl::Result<()> {
204            encoder.debug_check_bounds::<EditTransactionAddRequest>(offset);
205            // Zero out padding regions. There's no need to apply masks
206            // because the unmasked parts will be overwritten by fields.
207            // Write the fields.
208            self.0.encode(encoder, offset + 0, depth)?;
209            Ok(())
210        }
211    }
212
213    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
214        for EditTransactionAddRequest
215    {
216        #[inline(always)]
217        fn new_empty() -> Self {
218            Self { rule: fidl::new_empty!(Rule, D) }
219        }
220
221        #[inline]
222        unsafe fn decode(
223            &mut self,
224            decoder: &mut fidl::encoding::Decoder<'_, D>,
225            offset: usize,
226            _depth: fidl::encoding::Depth,
227        ) -> fidl::Result<()> {
228            decoder.debug_check_bounds::<Self>(offset);
229            // Verify that padding bytes are zero.
230            fidl::decode!(Rule, D, &mut self.rule, decoder, offset + 0, _depth)?;
231            Ok(())
232        }
233    }
234
235    impl fidl::encoding::ValueTypeMarker for EngineTestApplyRequest {
236        type Borrowed<'a> = &'a Self;
237        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
238            value
239        }
240    }
241
242    unsafe impl fidl::encoding::TypeMarker for EngineTestApplyRequest {
243        type Owned = Self;
244
245        #[inline(always)]
246        fn inline_align(_context: fidl::encoding::Context) -> usize {
247            8
248        }
249
250        #[inline(always)]
251        fn inline_size(_context: fidl::encoding::Context) -> usize {
252            16
253        }
254    }
255
256    unsafe impl<D: fidl::encoding::ResourceDialect>
257        fidl::encoding::Encode<EngineTestApplyRequest, D> for &EngineTestApplyRequest
258    {
259        #[inline]
260        unsafe fn encode(
261            self,
262            encoder: &mut fidl::encoding::Encoder<'_, D>,
263            offset: usize,
264            _depth: fidl::encoding::Depth,
265        ) -> fidl::Result<()> {
266            encoder.debug_check_bounds::<EngineTestApplyRequest>(offset);
267            // Delegate to tuple encoding.
268            fidl::encoding::Encode::<EngineTestApplyRequest, D>::encode(
269                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
270                    &self.url,
271                ),),
272                encoder,
273                offset,
274                _depth,
275            )
276        }
277    }
278    unsafe impl<
279            D: fidl::encoding::ResourceDialect,
280            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
281        > fidl::encoding::Encode<EngineTestApplyRequest, D> for (T0,)
282    {
283        #[inline]
284        unsafe fn encode(
285            self,
286            encoder: &mut fidl::encoding::Encoder<'_, D>,
287            offset: usize,
288            depth: fidl::encoding::Depth,
289        ) -> fidl::Result<()> {
290            encoder.debug_check_bounds::<EngineTestApplyRequest>(offset);
291            // Zero out padding regions. There's no need to apply masks
292            // because the unmasked parts will be overwritten by fields.
293            // Write the fields.
294            self.0.encode(encoder, offset + 0, depth)?;
295            Ok(())
296        }
297    }
298
299    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
300        for EngineTestApplyRequest
301    {
302        #[inline(always)]
303        fn new_empty() -> Self {
304            Self { url: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
305        }
306
307        #[inline]
308        unsafe fn decode(
309            &mut self,
310            decoder: &mut fidl::encoding::Decoder<'_, D>,
311            offset: usize,
312            _depth: fidl::encoding::Depth,
313        ) -> fidl::Result<()> {
314            decoder.debug_check_bounds::<Self>(offset);
315            // Verify that padding bytes are zero.
316            fidl::decode!(
317                fidl::encoding::UnboundedString,
318                D,
319                &mut self.url,
320                decoder,
321                offset + 0,
322                _depth
323            )?;
324            Ok(())
325        }
326    }
327
328    impl fidl::encoding::ValueTypeMarker for EngineTestApplyResponse {
329        type Borrowed<'a> = &'a Self;
330        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
331            value
332        }
333    }
334
335    unsafe impl fidl::encoding::TypeMarker for EngineTestApplyResponse {
336        type Owned = Self;
337
338        #[inline(always)]
339        fn inline_align(_context: fidl::encoding::Context) -> usize {
340            8
341        }
342
343        #[inline(always)]
344        fn inline_size(_context: fidl::encoding::Context) -> usize {
345            16
346        }
347    }
348
349    unsafe impl<D: fidl::encoding::ResourceDialect>
350        fidl::encoding::Encode<EngineTestApplyResponse, D> for &EngineTestApplyResponse
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::<EngineTestApplyResponse>(offset);
360            // Delegate to tuple encoding.
361            fidl::encoding::Encode::<EngineTestApplyResponse, D>::encode(
362                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
363                    &self.rewritten,
364                ),),
365                encoder,
366                offset,
367                _depth,
368            )
369        }
370    }
371    unsafe impl<
372            D: fidl::encoding::ResourceDialect,
373            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
374        > fidl::encoding::Encode<EngineTestApplyResponse, D> for (T0,)
375    {
376        #[inline]
377        unsafe fn encode(
378            self,
379            encoder: &mut fidl::encoding::Encoder<'_, D>,
380            offset: usize,
381            depth: fidl::encoding::Depth,
382        ) -> fidl::Result<()> {
383            encoder.debug_check_bounds::<EngineTestApplyResponse>(offset);
384            // Zero out padding regions. There's no need to apply masks
385            // because the unmasked parts will be overwritten by fields.
386            // Write the fields.
387            self.0.encode(encoder, offset + 0, depth)?;
388            Ok(())
389        }
390    }
391
392    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
393        for EngineTestApplyResponse
394    {
395        #[inline(always)]
396        fn new_empty() -> Self {
397            Self { rewritten: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
398        }
399
400        #[inline]
401        unsafe fn decode(
402            &mut self,
403            decoder: &mut fidl::encoding::Decoder<'_, D>,
404            offset: usize,
405            _depth: fidl::encoding::Depth,
406        ) -> fidl::Result<()> {
407            decoder.debug_check_bounds::<Self>(offset);
408            // Verify that padding bytes are zero.
409            fidl::decode!(
410                fidl::encoding::UnboundedString,
411                D,
412                &mut self.rewritten,
413                decoder,
414                offset + 0,
415                _depth
416            )?;
417            Ok(())
418        }
419    }
420
421    impl fidl::encoding::ValueTypeMarker for LiteralRule {
422        type Borrowed<'a> = &'a Self;
423        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
424            value
425        }
426    }
427
428    unsafe impl fidl::encoding::TypeMarker for LiteralRule {
429        type Owned = Self;
430
431        #[inline(always)]
432        fn inline_align(_context: fidl::encoding::Context) -> usize {
433            8
434        }
435
436        #[inline(always)]
437        fn inline_size(_context: fidl::encoding::Context) -> usize {
438            64
439        }
440    }
441
442    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LiteralRule, D>
443        for &LiteralRule
444    {
445        #[inline]
446        unsafe fn encode(
447            self,
448            encoder: &mut fidl::encoding::Encoder<'_, D>,
449            offset: usize,
450            _depth: fidl::encoding::Depth,
451        ) -> fidl::Result<()> {
452            encoder.debug_check_bounds::<LiteralRule>(offset);
453            // Delegate to tuple encoding.
454            fidl::encoding::Encode::<LiteralRule, D>::encode(
455                (
456                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
457                        &self.host_match,
458                    ),
459                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
460                        &self.host_replacement,
461                    ),
462                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
463                        &self.path_prefix_match,
464                    ),
465                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
466                        &self.path_prefix_replacement,
467                    ),
468                ),
469                encoder,
470                offset,
471                _depth,
472            )
473        }
474    }
475    unsafe impl<
476            D: fidl::encoding::ResourceDialect,
477            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
478            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
479            T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
480            T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
481        > fidl::encoding::Encode<LiteralRule, D> for (T0, T1, T2, T3)
482    {
483        #[inline]
484        unsafe fn encode(
485            self,
486            encoder: &mut fidl::encoding::Encoder<'_, D>,
487            offset: usize,
488            depth: fidl::encoding::Depth,
489        ) -> fidl::Result<()> {
490            encoder.debug_check_bounds::<LiteralRule>(offset);
491            // Zero out padding regions. There's no need to apply masks
492            // because the unmasked parts will be overwritten by fields.
493            // Write the fields.
494            self.0.encode(encoder, offset + 0, depth)?;
495            self.1.encode(encoder, offset + 16, depth)?;
496            self.2.encode(encoder, offset + 32, depth)?;
497            self.3.encode(encoder, offset + 48, depth)?;
498            Ok(())
499        }
500    }
501
502    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LiteralRule {
503        #[inline(always)]
504        fn new_empty() -> Self {
505            Self {
506                host_match: fidl::new_empty!(fidl::encoding::UnboundedString, D),
507                host_replacement: fidl::new_empty!(fidl::encoding::UnboundedString, D),
508                path_prefix_match: fidl::new_empty!(fidl::encoding::UnboundedString, D),
509                path_prefix_replacement: fidl::new_empty!(fidl::encoding::UnboundedString, D),
510            }
511        }
512
513        #[inline]
514        unsafe fn decode(
515            &mut self,
516            decoder: &mut fidl::encoding::Decoder<'_, D>,
517            offset: usize,
518            _depth: fidl::encoding::Depth,
519        ) -> fidl::Result<()> {
520            decoder.debug_check_bounds::<Self>(offset);
521            // Verify that padding bytes are zero.
522            fidl::decode!(
523                fidl::encoding::UnboundedString,
524                D,
525                &mut self.host_match,
526                decoder,
527                offset + 0,
528                _depth
529            )?;
530            fidl::decode!(
531                fidl::encoding::UnboundedString,
532                D,
533                &mut self.host_replacement,
534                decoder,
535                offset + 16,
536                _depth
537            )?;
538            fidl::decode!(
539                fidl::encoding::UnboundedString,
540                D,
541                &mut self.path_prefix_match,
542                decoder,
543                offset + 32,
544                _depth
545            )?;
546            fidl::decode!(
547                fidl::encoding::UnboundedString,
548                D,
549                &mut self.path_prefix_replacement,
550                decoder,
551                offset + 48,
552                _depth
553            )?;
554            Ok(())
555        }
556    }
557
558    impl fidl::encoding::ValueTypeMarker for RuleIteratorNextResponse {
559        type Borrowed<'a> = &'a Self;
560        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
561            value
562        }
563    }
564
565    unsafe impl fidl::encoding::TypeMarker for RuleIteratorNextResponse {
566        type Owned = Self;
567
568        #[inline(always)]
569        fn inline_align(_context: fidl::encoding::Context) -> usize {
570            8
571        }
572
573        #[inline(always)]
574        fn inline_size(_context: fidl::encoding::Context) -> usize {
575            16
576        }
577    }
578
579    unsafe impl<D: fidl::encoding::ResourceDialect>
580        fidl::encoding::Encode<RuleIteratorNextResponse, D> for &RuleIteratorNextResponse
581    {
582        #[inline]
583        unsafe fn encode(
584            self,
585            encoder: &mut fidl::encoding::Encoder<'_, D>,
586            offset: usize,
587            _depth: fidl::encoding::Depth,
588        ) -> fidl::Result<()> {
589            encoder.debug_check_bounds::<RuleIteratorNextResponse>(offset);
590            // Delegate to tuple encoding.
591            fidl::encoding::Encode::<RuleIteratorNextResponse, D>::encode(
592                (
593                    <fidl::encoding::UnboundedVector<Rule> as fidl::encoding::ValueTypeMarker>::borrow(&self.rules),
594                ),
595                encoder, offset, _depth
596            )
597        }
598    }
599    unsafe impl<
600            D: fidl::encoding::ResourceDialect,
601            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Rule>, D>,
602        > fidl::encoding::Encode<RuleIteratorNextResponse, D> for (T0,)
603    {
604        #[inline]
605        unsafe fn encode(
606            self,
607            encoder: &mut fidl::encoding::Encoder<'_, D>,
608            offset: usize,
609            depth: fidl::encoding::Depth,
610        ) -> fidl::Result<()> {
611            encoder.debug_check_bounds::<RuleIteratorNextResponse>(offset);
612            // Zero out padding regions. There's no need to apply masks
613            // because the unmasked parts will be overwritten by fields.
614            // Write the fields.
615            self.0.encode(encoder, offset + 0, depth)?;
616            Ok(())
617        }
618    }
619
620    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
621        for RuleIteratorNextResponse
622    {
623        #[inline(always)]
624        fn new_empty() -> Self {
625            Self { rules: fidl::new_empty!(fidl::encoding::UnboundedVector<Rule>, D) }
626        }
627
628        #[inline]
629        unsafe fn decode(
630            &mut self,
631            decoder: &mut fidl::encoding::Decoder<'_, D>,
632            offset: usize,
633            _depth: fidl::encoding::Depth,
634        ) -> fidl::Result<()> {
635            decoder.debug_check_bounds::<Self>(offset);
636            // Verify that padding bytes are zero.
637            fidl::decode!(
638                fidl::encoding::UnboundedVector<Rule>,
639                D,
640                &mut self.rules,
641                decoder,
642                offset + 0,
643                _depth
644            )?;
645            Ok(())
646        }
647    }
648
649    impl fidl::encoding::ValueTypeMarker for Rule {
650        type Borrowed<'a> = &'a Self;
651        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
652            value
653        }
654    }
655
656    unsafe impl fidl::encoding::TypeMarker for Rule {
657        type Owned = Self;
658
659        #[inline(always)]
660        fn inline_align(_context: fidl::encoding::Context) -> usize {
661            8
662        }
663
664        #[inline(always)]
665        fn inline_size(_context: fidl::encoding::Context) -> usize {
666            16
667        }
668    }
669
670    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Rule, D> for &Rule {
671        #[inline]
672        unsafe fn encode(
673            self,
674            encoder: &mut fidl::encoding::Encoder<'_, D>,
675            offset: usize,
676            _depth: fidl::encoding::Depth,
677        ) -> fidl::Result<()> {
678            encoder.debug_check_bounds::<Rule>(offset);
679            encoder.write_num::<u64>(self.ordinal(), offset);
680            match self {
681                Rule::Literal(ref val) => fidl::encoding::encode_in_envelope::<LiteralRule, D>(
682                    <LiteralRule as fidl::encoding::ValueTypeMarker>::borrow(val),
683                    encoder,
684                    offset + 8,
685                    _depth,
686                ),
687                Rule::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
688            }
689        }
690    }
691
692    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Rule {
693        #[inline(always)]
694        fn new_empty() -> Self {
695            Self::__SourceBreaking { unknown_ordinal: 0 }
696        }
697
698        #[inline]
699        unsafe fn decode(
700            &mut self,
701            decoder: &mut fidl::encoding::Decoder<'_, D>,
702            offset: usize,
703            mut depth: fidl::encoding::Depth,
704        ) -> fidl::Result<()> {
705            decoder.debug_check_bounds::<Self>(offset);
706            #[allow(unused_variables)]
707            let next_out_of_line = decoder.next_out_of_line();
708            let handles_before = decoder.remaining_handles();
709            let (ordinal, inlined, num_bytes, num_handles) =
710                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
711
712            let member_inline_size = match ordinal {
713                1 => <LiteralRule as fidl::encoding::TypeMarker>::inline_size(decoder.context),
714                0 => return Err(fidl::Error::UnknownUnionTag),
715                _ => num_bytes as usize,
716            };
717
718            if inlined != (member_inline_size <= 4) {
719                return Err(fidl::Error::InvalidInlineBitInEnvelope);
720            }
721            let _inner_offset;
722            if inlined {
723                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
724                _inner_offset = offset + 8;
725            } else {
726                depth.increment()?;
727                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
728            }
729            match ordinal {
730                1 => {
731                    #[allow(irrefutable_let_patterns)]
732                    if let Rule::Literal(_) = self {
733                        // Do nothing, read the value into the object
734                    } else {
735                        // Initialize `self` to the right variant
736                        *self = Rule::Literal(fidl::new_empty!(LiteralRule, D));
737                    }
738                    #[allow(irrefutable_let_patterns)]
739                    if let Rule::Literal(ref mut val) = self {
740                        fidl::decode!(LiteralRule, D, val, decoder, _inner_offset, depth)?;
741                    } else {
742                        unreachable!()
743                    }
744                }
745                #[allow(deprecated)]
746                ordinal => {
747                    for _ in 0..num_handles {
748                        decoder.drop_next_handle()?;
749                    }
750                    *self = Rule::__SourceBreaking { unknown_ordinal: ordinal };
751                }
752            }
753            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
754                return Err(fidl::Error::InvalidNumBytesInEnvelope);
755            }
756            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
757                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
758            }
759            Ok(())
760        }
761    }
762}