fidl_fuchsia_bluetooth_map_common/
fidl_fuchsia_bluetooth_map_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
11pub const CONVERSATION_ID_LENGTH: u8 = 16;
12
13pub const MAX_FOLDER_LENGTH: u16 = 512;
14
15pub const MAX_NUM_MAS_INSTANCE_LENGTH: u16 = 256;
16
17pub const MAX_SENDER_ADDR_LENGTH: u16 = 256;
18
19pub const MAX_SENDER_NAME_LENGTH: u16 = 256;
20
21pub const MAX_SUBJECT_LENGTH: u16 = 256;
22
23bitflags! {
24    /// Used to represent the type of a particular Message.
25    /// Also used to present the message types that are supported
26    /// by a Message Access Server.
27    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
28    pub struct MessageType: u8 {
29        const EMAIL = 1;
30        const SMS_GSM = 2;
31        const SMS_CDMA = 4;
32        const MMS = 8;
33        const IM = 16;
34    }
35}
36
37impl MessageType {
38    #[inline(always)]
39    pub fn from_bits_allow_unknown(bits: u8) -> Self {
40        Self::from_bits_retain(bits)
41    }
42
43    #[inline(always)]
44    pub fn has_unknown_bits(&self) -> bool {
45        self.get_unknown_bits() != 0
46    }
47
48    #[inline(always)]
49    pub fn get_unknown_bits(&self) -> u8 {
50        self.bits() & !Self::all().bits()
51    }
52}
53
54/// Specific error that is returned for Message Access/Message Notification
55/// related requests.
56#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
57#[repr(u32)]
58pub enum Error {
59    /// An unknown error occurred that cannot be classified as one of the more specific statuses.
60    Unknown = 1,
61    /// Peer was disconnected.
62    PeerDisconnected = 2,
63    /// Requested object or entity was not found.
64    NotFound = 3,
65    /// Request was not recognized/ill-formatted or contained parameters that
66    /// were not acceptable to the peer.
67    BadRequest = 4,
68    /// Request was not implemented at the peer.
69    NotImplemented = 5,
70    /// Object to be handled was protected and access was not authorized.
71    Unauthorized = 6,
72    /// Request could not be performed due to some condition at the peer.
73    Unavailable = 7,
74    /// The functionality is not supported by the peer.
75    NotSupported = 8,
76}
77
78impl Error {
79    #[inline]
80    pub fn from_primitive(prim: u32) -> Option<Self> {
81        match prim {
82            1 => Some(Self::Unknown),
83            2 => Some(Self::PeerDisconnected),
84            3 => Some(Self::NotFound),
85            4 => Some(Self::BadRequest),
86            5 => Some(Self::NotImplemented),
87            6 => Some(Self::Unauthorized),
88            7 => Some(Self::Unavailable),
89            8 => Some(Self::NotSupported),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub const fn into_primitive(self) -> u32 {
96        self as u32
97    }
98
99    #[deprecated = "Strict enums should not use `is_unknown`"]
100    #[inline]
101    pub fn is_unknown(&self) -> bool {
102        false
103    }
104}
105
106/// Notification type based on types defined in MAP v1.4.2 section 3.1.7.
107/// Note that MEMORY_FULL and MEMORY_AVAILABLE types are not represented as
108/// part of implementation decision.
109#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
110pub enum NotificationType {
111    NewMessage,
112    DeliverySuccess,
113    SendingSuccess,
114    DeliveryFailure,
115    SendingFailure,
116    MessageDeleted,
117    MessageShift,
118    ReadStatusChanged,
119    #[doc(hidden)]
120    __SourceBreaking {
121        unknown_ordinal: u32,
122    },
123}
124
125/// Pattern that matches an unknown `NotificationType` member.
126#[macro_export]
127macro_rules! NotificationTypeUnknown {
128    () => {
129        _
130    };
131}
132
133impl NotificationType {
134    #[inline]
135    pub fn from_primitive(prim: u32) -> Option<Self> {
136        match prim {
137            1 => Some(Self::NewMessage),
138            2 => Some(Self::DeliverySuccess),
139            3 => Some(Self::SendingSuccess),
140            4 => Some(Self::DeliveryFailure),
141            5 => Some(Self::SendingFailure),
142            6 => Some(Self::MessageDeleted),
143            7 => Some(Self::MessageShift),
144            8 => Some(Self::ReadStatusChanged),
145            _ => None,
146        }
147    }
148
149    #[inline]
150    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
151        match prim {
152            1 => Self::NewMessage,
153            2 => Self::DeliverySuccess,
154            3 => Self::SendingSuccess,
155            4 => Self::DeliveryFailure,
156            5 => Self::SendingFailure,
157            6 => Self::MessageDeleted,
158            7 => Self::MessageShift,
159            8 => Self::ReadStatusChanged,
160            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
161        }
162    }
163
164    #[inline]
165    pub fn unknown() -> Self {
166        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
167    }
168
169    #[inline]
170    pub const fn into_primitive(self) -> u32 {
171        match self {
172            Self::NewMessage => 1,
173            Self::DeliverySuccess => 2,
174            Self::SendingSuccess => 3,
175            Self::DeliveryFailure => 4,
176            Self::SendingFailure => 5,
177            Self::MessageDeleted => 6,
178            Self::MessageShift => 7,
179            Self::ReadStatusChanged => 8,
180            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
181        }
182    }
183
184    #[inline]
185    pub fn is_unknown(&self) -> bool {
186        match self {
187            Self::__SourceBreaking { unknown_ordinal: _ } => true,
188            _ => false,
189        }
190    }
191}
192
193#[derive(Clone, Debug, PartialEq)]
194pub struct AccessorListAllMasInstancesResponse {
195    pub instances: Vec<MasInstance>,
196}
197
198impl fidl::Persistable for AccessorListAllMasInstancesResponse {}
199
200#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
201pub struct MessageControllerGetDetailsRequest {
202    pub handle: u64,
203    pub include_attachment: bool,
204}
205
206impl fidl::Persistable for MessageControllerGetDetailsRequest {}
207
208#[derive(Clone, Debug, Default, PartialEq)]
209pub struct Audience {
210    /// Addressing information. In the case of emails, it's email address.
211    /// In the case of an email, this is the sender's email address.
212    /// In the case of an SMS, this is the sender's phone number.
213    /// In the case of an MMS, this is the senders email address or phone number.
214    pub addressing: Option<String>,
215    /// Display friendly name.
216    pub name: Option<String>,
217    #[doc(hidden)]
218    pub __source_breaking: fidl::marker::SourceBreaking,
219}
220
221impl fidl::Persistable for Audience {}
222
223/// Represents a Message Access Service Instance as described in
224/// MAP v1.4.2 section 3.1.8.
225#[derive(Clone, Debug, Default, PartialEq)]
226pub struct MasInstance {
227    pub id: Option<u8>,
228    pub supported_message_types: Option<MessageType>,
229    pub supports_notification: Option<bool>,
230    #[doc(hidden)]
231    pub __source_breaking: fidl::marker::SourceBreaking,
232}
233
234impl fidl::Persistable for MasInstance {}
235
236/// Based on x-bt/message, x-bt/MAP-msg-listing v1.1, and MAP-Event-Report NewMessage objects.
237/// See MAP v1.4.2 sections 3.1.3 and 3.1.6 for details.
238/// Depending on the method used to get the message, not all fields
239/// may be populated.
240#[derive(Clone, Debug, Default, PartialEq)]
241pub struct Message {
242    /// Handle for this message. Locally unique to each
243    /// Message Server Equipment (MSE).
244    /// Always present.
245    pub handle: Option<u64>,
246    /// Summary of the message.
247    pub subject: Option<String>,
248    /// Unix timestamp that represents the sending time if it was included
249    /// in the message, otherwise represents the reception time of the MSE.
250    pub timestamp: Option<i64>,
251    /// Information about the sender.
252    pub sender: Option<Audience>,
253    /// Information about the recipient.
254    pub recipient: Option<Audience>,
255    /// Type of the message.
256    /// Always present.
257    pub type_: Option<MessageType>,
258    /// Content of the message.
259    pub content: Option<String>,
260    /// Folder where the message is located in.
261    pub folder: Option<String>,
262    /// Whether or not message is high priority.
263    /// If this information is missing, it would be set as unknown, not false.
264    pub priority: Option<bool>,
265    /// Whether or not message was read.
266    /// If this information is missing, it would be set as unknown, not false.
267    pub read: Option<bool>,
268    /// Whether or not meessage has already been sent to the recipient.
269    /// If this information is missing, it would be set as unknown, not false.
270    pub sent: Option<bool>,
271    /// Whether or not message is protected by a DRM scheme.
272    pub protected: Option<bool>,
273    /// A 128 bit value that uniquely identifies a conversation within a single MAS instance.
274    pub conversation_id: Option<[u8; 16]>,
275    #[doc(hidden)]
276    pub __source_breaking: fidl::marker::SourceBreaking,
277}
278
279impl fidl::Persistable for Message {}
280
281/// Notification data from incoming event report from a remote MSE device.
282/// See MAP v1.4.2 section 3.1.7 for details about MAP event report objects.
283/// Note that not all fields are represented.
284#[derive(Clone, Debug, Default, PartialEq)]
285pub struct Notification {
286    pub type_: Option<NotificationType>,
287    pub mas_instance_id: Option<u8>,
288    pub message_handle: Option<u64>,
289    pub folder: Option<String>,
290    pub message_type: Option<MessageType>,
291    pub timestamp: Option<i64>,
292    pub subject: Option<String>,
293    pub sender: Option<Audience>,
294    pub priority: Option<bool>,
295    #[doc(hidden)]
296    pub __source_breaking: fidl::marker::SourceBreaking,
297}
298
299impl fidl::Persistable for Notification {}
300
301#[derive(Clone, Debug, Default, PartialEq)]
302pub struct NotificationRegistrationNewEventReportRequest {
303    pub notification: Option<Notification>,
304    pub received: Option<i64>,
305    #[doc(hidden)]
306    pub __source_breaking: fidl::marker::SourceBreaking,
307}
308
309impl fidl::Persistable for NotificationRegistrationNewEventReportRequest {}
310
311mod internal {
312    use super::*;
313    unsafe impl fidl::encoding::TypeMarker for MessageType {
314        type Owned = Self;
315
316        #[inline(always)]
317        fn inline_align(_context: fidl::encoding::Context) -> usize {
318            1
319        }
320
321        #[inline(always)]
322        fn inline_size(_context: fidl::encoding::Context) -> usize {
323            1
324        }
325    }
326
327    impl fidl::encoding::ValueTypeMarker for MessageType {
328        type Borrowed<'a> = Self;
329        #[inline(always)]
330        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
331            *value
332        }
333    }
334
335    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MessageType {
336        #[inline]
337        unsafe fn encode(
338            self,
339            encoder: &mut fidl::encoding::Encoder<'_, D>,
340            offset: usize,
341            _depth: fidl::encoding::Depth,
342        ) -> fidl::Result<()> {
343            encoder.debug_check_bounds::<Self>(offset);
344            encoder.write_num(self.bits(), offset);
345            Ok(())
346        }
347    }
348
349    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MessageType {
350        #[inline(always)]
351        fn new_empty() -> Self {
352            Self::empty()
353        }
354
355        #[inline]
356        unsafe fn decode(
357            &mut self,
358            decoder: &mut fidl::encoding::Decoder<'_, D>,
359            offset: usize,
360            _depth: fidl::encoding::Depth,
361        ) -> fidl::Result<()> {
362            decoder.debug_check_bounds::<Self>(offset);
363            let prim = decoder.read_num::<u8>(offset);
364            *self = Self::from_bits_allow_unknown(prim);
365            Ok(())
366        }
367    }
368    unsafe impl fidl::encoding::TypeMarker for Error {
369        type Owned = Self;
370
371        #[inline(always)]
372        fn inline_align(_context: fidl::encoding::Context) -> usize {
373            std::mem::align_of::<u32>()
374        }
375
376        #[inline(always)]
377        fn inline_size(_context: fidl::encoding::Context) -> usize {
378            std::mem::size_of::<u32>()
379        }
380
381        #[inline(always)]
382        fn encode_is_copy() -> bool {
383            true
384        }
385
386        #[inline(always)]
387        fn decode_is_copy() -> bool {
388            false
389        }
390    }
391
392    impl fidl::encoding::ValueTypeMarker for Error {
393        type Borrowed<'a> = Self;
394        #[inline(always)]
395        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
396            *value
397        }
398    }
399
400    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
401        #[inline]
402        unsafe fn encode(
403            self,
404            encoder: &mut fidl::encoding::Encoder<'_, D>,
405            offset: usize,
406            _depth: fidl::encoding::Depth,
407        ) -> fidl::Result<()> {
408            encoder.debug_check_bounds::<Self>(offset);
409            encoder.write_num(self.into_primitive(), offset);
410            Ok(())
411        }
412    }
413
414    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
415        #[inline(always)]
416        fn new_empty() -> Self {
417            Self::Unknown
418        }
419
420        #[inline]
421        unsafe fn decode(
422            &mut self,
423            decoder: &mut fidl::encoding::Decoder<'_, D>,
424            offset: usize,
425            _depth: fidl::encoding::Depth,
426        ) -> fidl::Result<()> {
427            decoder.debug_check_bounds::<Self>(offset);
428            let prim = decoder.read_num::<u32>(offset);
429
430            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
431            Ok(())
432        }
433    }
434    unsafe impl fidl::encoding::TypeMarker for NotificationType {
435        type Owned = Self;
436
437        #[inline(always)]
438        fn inline_align(_context: fidl::encoding::Context) -> usize {
439            std::mem::align_of::<u32>()
440        }
441
442        #[inline(always)]
443        fn inline_size(_context: fidl::encoding::Context) -> usize {
444            std::mem::size_of::<u32>()
445        }
446
447        #[inline(always)]
448        fn encode_is_copy() -> bool {
449            false
450        }
451
452        #[inline(always)]
453        fn decode_is_copy() -> bool {
454            false
455        }
456    }
457
458    impl fidl::encoding::ValueTypeMarker for NotificationType {
459        type Borrowed<'a> = Self;
460        #[inline(always)]
461        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
462            *value
463        }
464    }
465
466    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
467        for NotificationType
468    {
469        #[inline]
470        unsafe fn encode(
471            self,
472            encoder: &mut fidl::encoding::Encoder<'_, D>,
473            offset: usize,
474            _depth: fidl::encoding::Depth,
475        ) -> fidl::Result<()> {
476            encoder.debug_check_bounds::<Self>(offset);
477            encoder.write_num(self.into_primitive(), offset);
478            Ok(())
479        }
480    }
481
482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NotificationType {
483        #[inline(always)]
484        fn new_empty() -> Self {
485            Self::unknown()
486        }
487
488        #[inline]
489        unsafe fn decode(
490            &mut self,
491            decoder: &mut fidl::encoding::Decoder<'_, D>,
492            offset: usize,
493            _depth: fidl::encoding::Depth,
494        ) -> fidl::Result<()> {
495            decoder.debug_check_bounds::<Self>(offset);
496            let prim = decoder.read_num::<u32>(offset);
497
498            *self = Self::from_primitive_allow_unknown(prim);
499            Ok(())
500        }
501    }
502
503    impl fidl::encoding::ValueTypeMarker for AccessorListAllMasInstancesResponse {
504        type Borrowed<'a> = &'a Self;
505        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
506            value
507        }
508    }
509
510    unsafe impl fidl::encoding::TypeMarker for AccessorListAllMasInstancesResponse {
511        type Owned = Self;
512
513        #[inline(always)]
514        fn inline_align(_context: fidl::encoding::Context) -> usize {
515            8
516        }
517
518        #[inline(always)]
519        fn inline_size(_context: fidl::encoding::Context) -> usize {
520            16
521        }
522    }
523
524    unsafe impl<D: fidl::encoding::ResourceDialect>
525        fidl::encoding::Encode<AccessorListAllMasInstancesResponse, D>
526        for &AccessorListAllMasInstancesResponse
527    {
528        #[inline]
529        unsafe fn encode(
530            self,
531            encoder: &mut fidl::encoding::Encoder<'_, D>,
532            offset: usize,
533            _depth: fidl::encoding::Depth,
534        ) -> fidl::Result<()> {
535            encoder.debug_check_bounds::<AccessorListAllMasInstancesResponse>(offset);
536            // Delegate to tuple encoding.
537            fidl::encoding::Encode::<AccessorListAllMasInstancesResponse, D>::encode(
538                (
539                    <fidl::encoding::Vector<MasInstance, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.instances),
540                ),
541                encoder, offset, _depth
542            )
543        }
544    }
545    unsafe impl<
546            D: fidl::encoding::ResourceDialect,
547            T0: fidl::encoding::Encode<fidl::encoding::Vector<MasInstance, 256>, D>,
548        > fidl::encoding::Encode<AccessorListAllMasInstancesResponse, D> for (T0,)
549    {
550        #[inline]
551        unsafe fn encode(
552            self,
553            encoder: &mut fidl::encoding::Encoder<'_, D>,
554            offset: usize,
555            depth: fidl::encoding::Depth,
556        ) -> fidl::Result<()> {
557            encoder.debug_check_bounds::<AccessorListAllMasInstancesResponse>(offset);
558            // Zero out padding regions. There's no need to apply masks
559            // because the unmasked parts will be overwritten by fields.
560            // Write the fields.
561            self.0.encode(encoder, offset + 0, depth)?;
562            Ok(())
563        }
564    }
565
566    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
567        for AccessorListAllMasInstancesResponse
568    {
569        #[inline(always)]
570        fn new_empty() -> Self {
571            Self { instances: fidl::new_empty!(fidl::encoding::Vector<MasInstance, 256>, D) }
572        }
573
574        #[inline]
575        unsafe fn decode(
576            &mut self,
577            decoder: &mut fidl::encoding::Decoder<'_, D>,
578            offset: usize,
579            _depth: fidl::encoding::Depth,
580        ) -> fidl::Result<()> {
581            decoder.debug_check_bounds::<Self>(offset);
582            // Verify that padding bytes are zero.
583            fidl::decode!(fidl::encoding::Vector<MasInstance, 256>, D, &mut self.instances, decoder, offset + 0, _depth)?;
584            Ok(())
585        }
586    }
587
588    impl fidl::encoding::ValueTypeMarker for MessageControllerGetDetailsRequest {
589        type Borrowed<'a> = &'a Self;
590        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
591            value
592        }
593    }
594
595    unsafe impl fidl::encoding::TypeMarker for MessageControllerGetDetailsRequest {
596        type Owned = Self;
597
598        #[inline(always)]
599        fn inline_align(_context: fidl::encoding::Context) -> usize {
600            8
601        }
602
603        #[inline(always)]
604        fn inline_size(_context: fidl::encoding::Context) -> usize {
605            16
606        }
607    }
608
609    unsafe impl<D: fidl::encoding::ResourceDialect>
610        fidl::encoding::Encode<MessageControllerGetDetailsRequest, D>
611        for &MessageControllerGetDetailsRequest
612    {
613        #[inline]
614        unsafe fn encode(
615            self,
616            encoder: &mut fidl::encoding::Encoder<'_, D>,
617            offset: usize,
618            _depth: fidl::encoding::Depth,
619        ) -> fidl::Result<()> {
620            encoder.debug_check_bounds::<MessageControllerGetDetailsRequest>(offset);
621            // Delegate to tuple encoding.
622            fidl::encoding::Encode::<MessageControllerGetDetailsRequest, D>::encode(
623                (
624                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
625                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.include_attachment),
626                ),
627                encoder,
628                offset,
629                _depth,
630            )
631        }
632    }
633    unsafe impl<
634            D: fidl::encoding::ResourceDialect,
635            T0: fidl::encoding::Encode<u64, D>,
636            T1: fidl::encoding::Encode<bool, D>,
637        > fidl::encoding::Encode<MessageControllerGetDetailsRequest, D> for (T0, T1)
638    {
639        #[inline]
640        unsafe fn encode(
641            self,
642            encoder: &mut fidl::encoding::Encoder<'_, D>,
643            offset: usize,
644            depth: fidl::encoding::Depth,
645        ) -> fidl::Result<()> {
646            encoder.debug_check_bounds::<MessageControllerGetDetailsRequest>(offset);
647            // Zero out padding regions. There's no need to apply masks
648            // because the unmasked parts will be overwritten by fields.
649            unsafe {
650                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
651                (ptr as *mut u64).write_unaligned(0);
652            }
653            // Write the fields.
654            self.0.encode(encoder, offset + 0, depth)?;
655            self.1.encode(encoder, offset + 8, depth)?;
656            Ok(())
657        }
658    }
659
660    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
661        for MessageControllerGetDetailsRequest
662    {
663        #[inline(always)]
664        fn new_empty() -> Self {
665            Self { handle: fidl::new_empty!(u64, D), include_attachment: fidl::new_empty!(bool, D) }
666        }
667
668        #[inline]
669        unsafe fn decode(
670            &mut self,
671            decoder: &mut fidl::encoding::Decoder<'_, D>,
672            offset: usize,
673            _depth: fidl::encoding::Depth,
674        ) -> fidl::Result<()> {
675            decoder.debug_check_bounds::<Self>(offset);
676            // Verify that padding bytes are zero.
677            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
678            let padval = unsafe { (ptr as *const u64).read_unaligned() };
679            let mask = 0xffffffffffffff00u64;
680            let maskedval = padval & mask;
681            if maskedval != 0 {
682                return Err(fidl::Error::NonZeroPadding {
683                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
684                });
685            }
686            fidl::decode!(u64, D, &mut self.handle, decoder, offset + 0, _depth)?;
687            fidl::decode!(bool, D, &mut self.include_attachment, decoder, offset + 8, _depth)?;
688            Ok(())
689        }
690    }
691
692    impl Audience {
693        #[inline(always)]
694        fn max_ordinal_present(&self) -> u64 {
695            if let Some(_) = self.name {
696                return 2;
697            }
698            if let Some(_) = self.addressing {
699                return 1;
700            }
701            0
702        }
703    }
704
705    impl fidl::encoding::ValueTypeMarker for Audience {
706        type Borrowed<'a> = &'a Self;
707        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
708            value
709        }
710    }
711
712    unsafe impl fidl::encoding::TypeMarker for Audience {
713        type Owned = Self;
714
715        #[inline(always)]
716        fn inline_align(_context: fidl::encoding::Context) -> usize {
717            8
718        }
719
720        #[inline(always)]
721        fn inline_size(_context: fidl::encoding::Context) -> usize {
722            16
723        }
724    }
725
726    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Audience, D> for &Audience {
727        unsafe fn encode(
728            self,
729            encoder: &mut fidl::encoding::Encoder<'_, D>,
730            offset: usize,
731            mut depth: fidl::encoding::Depth,
732        ) -> fidl::Result<()> {
733            encoder.debug_check_bounds::<Audience>(offset);
734            // Vector header
735            let max_ordinal: u64 = self.max_ordinal_present();
736            encoder.write_num(max_ordinal, offset);
737            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
738            // Calling encoder.out_of_line_offset(0) is not allowed.
739            if max_ordinal == 0 {
740                return Ok(());
741            }
742            depth.increment()?;
743            let envelope_size = 8;
744            let bytes_len = max_ordinal as usize * envelope_size;
745            #[allow(unused_variables)]
746            let offset = encoder.out_of_line_offset(bytes_len);
747            let mut _prev_end_offset: usize = 0;
748            if 1 > max_ordinal {
749                return Ok(());
750            }
751
752            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
753            // are envelope_size bytes.
754            let cur_offset: usize = (1 - 1) * envelope_size;
755
756            // Zero reserved fields.
757            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
758
759            // Safety:
760            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
761            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
762            //   envelope_size bytes, there is always sufficient room.
763            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
764                self.addressing.as_ref().map(
765                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
766                ),
767                encoder,
768                offset + cur_offset,
769                depth,
770            )?;
771
772            _prev_end_offset = cur_offset + envelope_size;
773            if 2 > max_ordinal {
774                return Ok(());
775            }
776
777            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
778            // are envelope_size bytes.
779            let cur_offset: usize = (2 - 1) * envelope_size;
780
781            // Zero reserved fields.
782            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
783
784            // Safety:
785            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
786            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
787            //   envelope_size bytes, there is always sufficient room.
788            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
789                self.name.as_ref().map(
790                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
791                ),
792                encoder,
793                offset + cur_offset,
794                depth,
795            )?;
796
797            _prev_end_offset = cur_offset + envelope_size;
798
799            Ok(())
800        }
801    }
802
803    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Audience {
804        #[inline(always)]
805        fn new_empty() -> Self {
806            Self::default()
807        }
808
809        unsafe fn decode(
810            &mut self,
811            decoder: &mut fidl::encoding::Decoder<'_, D>,
812            offset: usize,
813            mut depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            decoder.debug_check_bounds::<Self>(offset);
816            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
817                None => return Err(fidl::Error::NotNullable),
818                Some(len) => len,
819            };
820            // Calling decoder.out_of_line_offset(0) is not allowed.
821            if len == 0 {
822                return Ok(());
823            };
824            depth.increment()?;
825            let envelope_size = 8;
826            let bytes_len = len * envelope_size;
827            let offset = decoder.out_of_line_offset(bytes_len)?;
828            // Decode the envelope for each type.
829            let mut _next_ordinal_to_read = 0;
830            let mut next_offset = offset;
831            let end_offset = offset + bytes_len;
832            _next_ordinal_to_read += 1;
833            if next_offset >= end_offset {
834                return Ok(());
835            }
836
837            // Decode unknown envelopes for gaps in ordinals.
838            while _next_ordinal_to_read < 1 {
839                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
840                _next_ordinal_to_read += 1;
841                next_offset += envelope_size;
842            }
843
844            let next_out_of_line = decoder.next_out_of_line();
845            let handles_before = decoder.remaining_handles();
846            if let Some((inlined, num_bytes, num_handles)) =
847                fidl::encoding::decode_envelope_header(decoder, next_offset)?
848            {
849                let member_inline_size =
850                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
851                        decoder.context,
852                    );
853                if inlined != (member_inline_size <= 4) {
854                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
855                }
856                let inner_offset;
857                let mut inner_depth = depth.clone();
858                if inlined {
859                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
860                    inner_offset = next_offset;
861                } else {
862                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
863                    inner_depth.increment()?;
864                }
865                let val_ref = self
866                    .addressing
867                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
868                fidl::decode!(
869                    fidl::encoding::BoundedString<256>,
870                    D,
871                    val_ref,
872                    decoder,
873                    inner_offset,
874                    inner_depth
875                )?;
876                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
877                {
878                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
879                }
880                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
881                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
882                }
883            }
884
885            next_offset += envelope_size;
886            _next_ordinal_to_read += 1;
887            if next_offset >= end_offset {
888                return Ok(());
889            }
890
891            // Decode unknown envelopes for gaps in ordinals.
892            while _next_ordinal_to_read < 2 {
893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
894                _next_ordinal_to_read += 1;
895                next_offset += envelope_size;
896            }
897
898            let next_out_of_line = decoder.next_out_of_line();
899            let handles_before = decoder.remaining_handles();
900            if let Some((inlined, num_bytes, num_handles)) =
901                fidl::encoding::decode_envelope_header(decoder, next_offset)?
902            {
903                let member_inline_size =
904                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
905                        decoder.context,
906                    );
907                if inlined != (member_inline_size <= 4) {
908                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
909                }
910                let inner_offset;
911                let mut inner_depth = depth.clone();
912                if inlined {
913                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
914                    inner_offset = next_offset;
915                } else {
916                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
917                    inner_depth.increment()?;
918                }
919                let val_ref = self
920                    .name
921                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
922                fidl::decode!(
923                    fidl::encoding::BoundedString<256>,
924                    D,
925                    val_ref,
926                    decoder,
927                    inner_offset,
928                    inner_depth
929                )?;
930                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
931                {
932                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
933                }
934                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
935                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
936                }
937            }
938
939            next_offset += envelope_size;
940
941            // Decode the remaining unknown envelopes.
942            while next_offset < end_offset {
943                _next_ordinal_to_read += 1;
944                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
945                next_offset += envelope_size;
946            }
947
948            Ok(())
949        }
950    }
951
952    impl MasInstance {
953        #[inline(always)]
954        fn max_ordinal_present(&self) -> u64 {
955            if let Some(_) = self.supports_notification {
956                return 3;
957            }
958            if let Some(_) = self.supported_message_types {
959                return 2;
960            }
961            if let Some(_) = self.id {
962                return 1;
963            }
964            0
965        }
966    }
967
968    impl fidl::encoding::ValueTypeMarker for MasInstance {
969        type Borrowed<'a> = &'a Self;
970        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
971            value
972        }
973    }
974
975    unsafe impl fidl::encoding::TypeMarker for MasInstance {
976        type Owned = Self;
977
978        #[inline(always)]
979        fn inline_align(_context: fidl::encoding::Context) -> usize {
980            8
981        }
982
983        #[inline(always)]
984        fn inline_size(_context: fidl::encoding::Context) -> usize {
985            16
986        }
987    }
988
989    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MasInstance, D>
990        for &MasInstance
991    {
992        unsafe fn encode(
993            self,
994            encoder: &mut fidl::encoding::Encoder<'_, D>,
995            offset: usize,
996            mut depth: fidl::encoding::Depth,
997        ) -> fidl::Result<()> {
998            encoder.debug_check_bounds::<MasInstance>(offset);
999            // Vector header
1000            let max_ordinal: u64 = self.max_ordinal_present();
1001            encoder.write_num(max_ordinal, offset);
1002            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1003            // Calling encoder.out_of_line_offset(0) is not allowed.
1004            if max_ordinal == 0 {
1005                return Ok(());
1006            }
1007            depth.increment()?;
1008            let envelope_size = 8;
1009            let bytes_len = max_ordinal as usize * envelope_size;
1010            #[allow(unused_variables)]
1011            let offset = encoder.out_of_line_offset(bytes_len);
1012            let mut _prev_end_offset: usize = 0;
1013            if 1 > max_ordinal {
1014                return Ok(());
1015            }
1016
1017            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1018            // are envelope_size bytes.
1019            let cur_offset: usize = (1 - 1) * envelope_size;
1020
1021            // Zero reserved fields.
1022            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1023
1024            // Safety:
1025            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1026            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1027            //   envelope_size bytes, there is always sufficient room.
1028            fidl::encoding::encode_in_envelope_optional::<u8, D>(
1029                self.id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1030                encoder,
1031                offset + cur_offset,
1032                depth,
1033            )?;
1034
1035            _prev_end_offset = cur_offset + envelope_size;
1036            if 2 > max_ordinal {
1037                return Ok(());
1038            }
1039
1040            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1041            // are envelope_size bytes.
1042            let cur_offset: usize = (2 - 1) * envelope_size;
1043
1044            // Zero reserved fields.
1045            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1046
1047            // Safety:
1048            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1049            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1050            //   envelope_size bytes, there is always sufficient room.
1051            fidl::encoding::encode_in_envelope_optional::<MessageType, D>(
1052                self.supported_message_types
1053                    .as_ref()
1054                    .map(<MessageType as fidl::encoding::ValueTypeMarker>::borrow),
1055                encoder,
1056                offset + cur_offset,
1057                depth,
1058            )?;
1059
1060            _prev_end_offset = cur_offset + envelope_size;
1061            if 3 > max_ordinal {
1062                return Ok(());
1063            }
1064
1065            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1066            // are envelope_size bytes.
1067            let cur_offset: usize = (3 - 1) * envelope_size;
1068
1069            // Zero reserved fields.
1070            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1071
1072            // Safety:
1073            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1074            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1075            //   envelope_size bytes, there is always sufficient room.
1076            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1077                self.supports_notification
1078                    .as_ref()
1079                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1080                encoder,
1081                offset + cur_offset,
1082                depth,
1083            )?;
1084
1085            _prev_end_offset = cur_offset + envelope_size;
1086
1087            Ok(())
1088        }
1089    }
1090
1091    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MasInstance {
1092        #[inline(always)]
1093        fn new_empty() -> Self {
1094            Self::default()
1095        }
1096
1097        unsafe fn decode(
1098            &mut self,
1099            decoder: &mut fidl::encoding::Decoder<'_, D>,
1100            offset: usize,
1101            mut depth: fidl::encoding::Depth,
1102        ) -> fidl::Result<()> {
1103            decoder.debug_check_bounds::<Self>(offset);
1104            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1105                None => return Err(fidl::Error::NotNullable),
1106                Some(len) => len,
1107            };
1108            // Calling decoder.out_of_line_offset(0) is not allowed.
1109            if len == 0 {
1110                return Ok(());
1111            };
1112            depth.increment()?;
1113            let envelope_size = 8;
1114            let bytes_len = len * envelope_size;
1115            let offset = decoder.out_of_line_offset(bytes_len)?;
1116            // Decode the envelope for each type.
1117            let mut _next_ordinal_to_read = 0;
1118            let mut next_offset = offset;
1119            let end_offset = offset + bytes_len;
1120            _next_ordinal_to_read += 1;
1121            if next_offset >= end_offset {
1122                return Ok(());
1123            }
1124
1125            // Decode unknown envelopes for gaps in ordinals.
1126            while _next_ordinal_to_read < 1 {
1127                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1128                _next_ordinal_to_read += 1;
1129                next_offset += envelope_size;
1130            }
1131
1132            let next_out_of_line = decoder.next_out_of_line();
1133            let handles_before = decoder.remaining_handles();
1134            if let Some((inlined, num_bytes, num_handles)) =
1135                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1136            {
1137                let member_inline_size =
1138                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1139                if inlined != (member_inline_size <= 4) {
1140                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1141                }
1142                let inner_offset;
1143                let mut inner_depth = depth.clone();
1144                if inlined {
1145                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1146                    inner_offset = next_offset;
1147                } else {
1148                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1149                    inner_depth.increment()?;
1150                }
1151                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u8, D));
1152                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1153                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1154                {
1155                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1156                }
1157                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1158                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1159                }
1160            }
1161
1162            next_offset += envelope_size;
1163            _next_ordinal_to_read += 1;
1164            if next_offset >= end_offset {
1165                return Ok(());
1166            }
1167
1168            // Decode unknown envelopes for gaps in ordinals.
1169            while _next_ordinal_to_read < 2 {
1170                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1171                _next_ordinal_to_read += 1;
1172                next_offset += envelope_size;
1173            }
1174
1175            let next_out_of_line = decoder.next_out_of_line();
1176            let handles_before = decoder.remaining_handles();
1177            if let Some((inlined, num_bytes, num_handles)) =
1178                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1179            {
1180                let member_inline_size =
1181                    <MessageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1182                if inlined != (member_inline_size <= 4) {
1183                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1184                }
1185                let inner_offset;
1186                let mut inner_depth = depth.clone();
1187                if inlined {
1188                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1189                    inner_offset = next_offset;
1190                } else {
1191                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1192                    inner_depth.increment()?;
1193                }
1194                let val_ref = self
1195                    .supported_message_types
1196                    .get_or_insert_with(|| fidl::new_empty!(MessageType, D));
1197                fidl::decode!(MessageType, D, val_ref, decoder, inner_offset, inner_depth)?;
1198                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1199                {
1200                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1201                }
1202                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1203                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1204                }
1205            }
1206
1207            next_offset += envelope_size;
1208            _next_ordinal_to_read += 1;
1209            if next_offset >= end_offset {
1210                return Ok(());
1211            }
1212
1213            // Decode unknown envelopes for gaps in ordinals.
1214            while _next_ordinal_to_read < 3 {
1215                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1216                _next_ordinal_to_read += 1;
1217                next_offset += envelope_size;
1218            }
1219
1220            let next_out_of_line = decoder.next_out_of_line();
1221            let handles_before = decoder.remaining_handles();
1222            if let Some((inlined, num_bytes, num_handles)) =
1223                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1224            {
1225                let member_inline_size =
1226                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1227                if inlined != (member_inline_size <= 4) {
1228                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1229                }
1230                let inner_offset;
1231                let mut inner_depth = depth.clone();
1232                if inlined {
1233                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1234                    inner_offset = next_offset;
1235                } else {
1236                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1237                    inner_depth.increment()?;
1238                }
1239                let val_ref =
1240                    self.supports_notification.get_or_insert_with(|| fidl::new_empty!(bool, D));
1241                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1242                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1243                {
1244                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1245                }
1246                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1247                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1248                }
1249            }
1250
1251            next_offset += envelope_size;
1252
1253            // Decode the remaining unknown envelopes.
1254            while next_offset < end_offset {
1255                _next_ordinal_to_read += 1;
1256                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1257                next_offset += envelope_size;
1258            }
1259
1260            Ok(())
1261        }
1262    }
1263
1264    impl Message {
1265        #[inline(always)]
1266        fn max_ordinal_present(&self) -> u64 {
1267            if let Some(_) = self.conversation_id {
1268                return 13;
1269            }
1270            if let Some(_) = self.protected {
1271                return 12;
1272            }
1273            if let Some(_) = self.sent {
1274                return 11;
1275            }
1276            if let Some(_) = self.read {
1277                return 10;
1278            }
1279            if let Some(_) = self.priority {
1280                return 9;
1281            }
1282            if let Some(_) = self.folder {
1283                return 8;
1284            }
1285            if let Some(_) = self.content {
1286                return 7;
1287            }
1288            if let Some(_) = self.type_ {
1289                return 6;
1290            }
1291            if let Some(_) = self.recipient {
1292                return 5;
1293            }
1294            if let Some(_) = self.sender {
1295                return 4;
1296            }
1297            if let Some(_) = self.timestamp {
1298                return 3;
1299            }
1300            if let Some(_) = self.subject {
1301                return 2;
1302            }
1303            if let Some(_) = self.handle {
1304                return 1;
1305            }
1306            0
1307        }
1308    }
1309
1310    impl fidl::encoding::ValueTypeMarker for Message {
1311        type Borrowed<'a> = &'a Self;
1312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1313            value
1314        }
1315    }
1316
1317    unsafe impl fidl::encoding::TypeMarker for Message {
1318        type Owned = Self;
1319
1320        #[inline(always)]
1321        fn inline_align(_context: fidl::encoding::Context) -> usize {
1322            8
1323        }
1324
1325        #[inline(always)]
1326        fn inline_size(_context: fidl::encoding::Context) -> usize {
1327            16
1328        }
1329    }
1330
1331    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Message, D> for &Message {
1332        unsafe fn encode(
1333            self,
1334            encoder: &mut fidl::encoding::Encoder<'_, D>,
1335            offset: usize,
1336            mut depth: fidl::encoding::Depth,
1337        ) -> fidl::Result<()> {
1338            encoder.debug_check_bounds::<Message>(offset);
1339            // Vector header
1340            let max_ordinal: u64 = self.max_ordinal_present();
1341            encoder.write_num(max_ordinal, offset);
1342            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1343            // Calling encoder.out_of_line_offset(0) is not allowed.
1344            if max_ordinal == 0 {
1345                return Ok(());
1346            }
1347            depth.increment()?;
1348            let envelope_size = 8;
1349            let bytes_len = max_ordinal as usize * envelope_size;
1350            #[allow(unused_variables)]
1351            let offset = encoder.out_of_line_offset(bytes_len);
1352            let mut _prev_end_offset: usize = 0;
1353            if 1 > max_ordinal {
1354                return Ok(());
1355            }
1356
1357            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1358            // are envelope_size bytes.
1359            let cur_offset: usize = (1 - 1) * envelope_size;
1360
1361            // Zero reserved fields.
1362            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1363
1364            // Safety:
1365            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1366            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1367            //   envelope_size bytes, there is always sufficient room.
1368            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1369                self.handle.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1370                encoder,
1371                offset + cur_offset,
1372                depth,
1373            )?;
1374
1375            _prev_end_offset = cur_offset + envelope_size;
1376            if 2 > max_ordinal {
1377                return Ok(());
1378            }
1379
1380            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1381            // are envelope_size bytes.
1382            let cur_offset: usize = (2 - 1) * envelope_size;
1383
1384            // Zero reserved fields.
1385            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1386
1387            // Safety:
1388            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1389            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1390            //   envelope_size bytes, there is always sufficient room.
1391            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
1392                self.subject.as_ref().map(
1393                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
1394                ),
1395                encoder,
1396                offset + cur_offset,
1397                depth,
1398            )?;
1399
1400            _prev_end_offset = cur_offset + envelope_size;
1401            if 3 > max_ordinal {
1402                return Ok(());
1403            }
1404
1405            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1406            // are envelope_size bytes.
1407            let cur_offset: usize = (3 - 1) * envelope_size;
1408
1409            // Zero reserved fields.
1410            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1411
1412            // Safety:
1413            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1414            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1415            //   envelope_size bytes, there is always sufficient room.
1416            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1417                self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1418                encoder,
1419                offset + cur_offset,
1420                depth,
1421            )?;
1422
1423            _prev_end_offset = cur_offset + envelope_size;
1424            if 4 > max_ordinal {
1425                return Ok(());
1426            }
1427
1428            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1429            // are envelope_size bytes.
1430            let cur_offset: usize = (4 - 1) * envelope_size;
1431
1432            // Zero reserved fields.
1433            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1434
1435            // Safety:
1436            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1437            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1438            //   envelope_size bytes, there is always sufficient room.
1439            fidl::encoding::encode_in_envelope_optional::<Audience, D>(
1440                self.sender.as_ref().map(<Audience as fidl::encoding::ValueTypeMarker>::borrow),
1441                encoder,
1442                offset + cur_offset,
1443                depth,
1444            )?;
1445
1446            _prev_end_offset = cur_offset + envelope_size;
1447            if 5 > max_ordinal {
1448                return Ok(());
1449            }
1450
1451            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1452            // are envelope_size bytes.
1453            let cur_offset: usize = (5 - 1) * envelope_size;
1454
1455            // Zero reserved fields.
1456            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1457
1458            // Safety:
1459            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1460            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1461            //   envelope_size bytes, there is always sufficient room.
1462            fidl::encoding::encode_in_envelope_optional::<Audience, D>(
1463                self.recipient.as_ref().map(<Audience as fidl::encoding::ValueTypeMarker>::borrow),
1464                encoder,
1465                offset + cur_offset,
1466                depth,
1467            )?;
1468
1469            _prev_end_offset = cur_offset + envelope_size;
1470            if 6 > max_ordinal {
1471                return Ok(());
1472            }
1473
1474            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1475            // are envelope_size bytes.
1476            let cur_offset: usize = (6 - 1) * envelope_size;
1477
1478            // Zero reserved fields.
1479            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1480
1481            // Safety:
1482            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1483            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1484            //   envelope_size bytes, there is always sufficient room.
1485            fidl::encoding::encode_in_envelope_optional::<MessageType, D>(
1486                self.type_.as_ref().map(<MessageType as fidl::encoding::ValueTypeMarker>::borrow),
1487                encoder,
1488                offset + cur_offset,
1489                depth,
1490            )?;
1491
1492            _prev_end_offset = cur_offset + envelope_size;
1493            if 7 > max_ordinal {
1494                return Ok(());
1495            }
1496
1497            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1498            // are envelope_size bytes.
1499            let cur_offset: usize = (7 - 1) * envelope_size;
1500
1501            // Zero reserved fields.
1502            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1503
1504            // Safety:
1505            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1506            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1507            //   envelope_size bytes, there is always sufficient room.
1508            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
1509                self.content.as_ref().map(
1510                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
1511                ),
1512                encoder,
1513                offset + cur_offset,
1514                depth,
1515            )?;
1516
1517            _prev_end_offset = cur_offset + envelope_size;
1518            if 8 > max_ordinal {
1519                return Ok(());
1520            }
1521
1522            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1523            // are envelope_size bytes.
1524            let cur_offset: usize = (8 - 1) * envelope_size;
1525
1526            // Zero reserved fields.
1527            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1528
1529            // Safety:
1530            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1531            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1532            //   envelope_size bytes, there is always sufficient room.
1533            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<512>, D>(
1534                self.folder.as_ref().map(
1535                    <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow,
1536                ),
1537                encoder,
1538                offset + cur_offset,
1539                depth,
1540            )?;
1541
1542            _prev_end_offset = cur_offset + envelope_size;
1543            if 9 > max_ordinal {
1544                return Ok(());
1545            }
1546
1547            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1548            // are envelope_size bytes.
1549            let cur_offset: usize = (9 - 1) * envelope_size;
1550
1551            // Zero reserved fields.
1552            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1553
1554            // Safety:
1555            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1556            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1557            //   envelope_size bytes, there is always sufficient room.
1558            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1559                self.priority.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1560                encoder,
1561                offset + cur_offset,
1562                depth,
1563            )?;
1564
1565            _prev_end_offset = cur_offset + envelope_size;
1566            if 10 > max_ordinal {
1567                return Ok(());
1568            }
1569
1570            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1571            // are envelope_size bytes.
1572            let cur_offset: usize = (10 - 1) * envelope_size;
1573
1574            // Zero reserved fields.
1575            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1576
1577            // Safety:
1578            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1579            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1580            //   envelope_size bytes, there is always sufficient room.
1581            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1582                self.read.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1583                encoder,
1584                offset + cur_offset,
1585                depth,
1586            )?;
1587
1588            _prev_end_offset = cur_offset + envelope_size;
1589            if 11 > max_ordinal {
1590                return Ok(());
1591            }
1592
1593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1594            // are envelope_size bytes.
1595            let cur_offset: usize = (11 - 1) * envelope_size;
1596
1597            // Zero reserved fields.
1598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1599
1600            // Safety:
1601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1603            //   envelope_size bytes, there is always sufficient room.
1604            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1605                self.sent.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1606                encoder,
1607                offset + cur_offset,
1608                depth,
1609            )?;
1610
1611            _prev_end_offset = cur_offset + envelope_size;
1612            if 12 > max_ordinal {
1613                return Ok(());
1614            }
1615
1616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1617            // are envelope_size bytes.
1618            let cur_offset: usize = (12 - 1) * envelope_size;
1619
1620            // Zero reserved fields.
1621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1622
1623            // Safety:
1624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1626            //   envelope_size bytes, there is always sufficient room.
1627            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1628                self.protected.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1629                encoder,
1630                offset + cur_offset,
1631                depth,
1632            )?;
1633
1634            _prev_end_offset = cur_offset + envelope_size;
1635            if 13 > max_ordinal {
1636                return Ok(());
1637            }
1638
1639            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1640            // are envelope_size bytes.
1641            let cur_offset: usize = (13 - 1) * envelope_size;
1642
1643            // Zero reserved fields.
1644            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1645
1646            // Safety:
1647            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1648            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1649            //   envelope_size bytes, there is always sufficient room.
1650            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
1651                self.conversation_id.as_ref().map(
1652                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
1653                ),
1654                encoder,
1655                offset + cur_offset,
1656                depth,
1657            )?;
1658
1659            _prev_end_offset = cur_offset + envelope_size;
1660
1661            Ok(())
1662        }
1663    }
1664
1665    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Message {
1666        #[inline(always)]
1667        fn new_empty() -> Self {
1668            Self::default()
1669        }
1670
1671        unsafe fn decode(
1672            &mut self,
1673            decoder: &mut fidl::encoding::Decoder<'_, D>,
1674            offset: usize,
1675            mut depth: fidl::encoding::Depth,
1676        ) -> fidl::Result<()> {
1677            decoder.debug_check_bounds::<Self>(offset);
1678            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1679                None => return Err(fidl::Error::NotNullable),
1680                Some(len) => len,
1681            };
1682            // Calling decoder.out_of_line_offset(0) is not allowed.
1683            if len == 0 {
1684                return Ok(());
1685            };
1686            depth.increment()?;
1687            let envelope_size = 8;
1688            let bytes_len = len * envelope_size;
1689            let offset = decoder.out_of_line_offset(bytes_len)?;
1690            // Decode the envelope for each type.
1691            let mut _next_ordinal_to_read = 0;
1692            let mut next_offset = offset;
1693            let end_offset = offset + bytes_len;
1694            _next_ordinal_to_read += 1;
1695            if next_offset >= end_offset {
1696                return Ok(());
1697            }
1698
1699            // Decode unknown envelopes for gaps in ordinals.
1700            while _next_ordinal_to_read < 1 {
1701                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1702                _next_ordinal_to_read += 1;
1703                next_offset += envelope_size;
1704            }
1705
1706            let next_out_of_line = decoder.next_out_of_line();
1707            let handles_before = decoder.remaining_handles();
1708            if let Some((inlined, num_bytes, num_handles)) =
1709                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1710            {
1711                let member_inline_size =
1712                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1713                if inlined != (member_inline_size <= 4) {
1714                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1715                }
1716                let inner_offset;
1717                let mut inner_depth = depth.clone();
1718                if inlined {
1719                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1720                    inner_offset = next_offset;
1721                } else {
1722                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1723                    inner_depth.increment()?;
1724                }
1725                let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(u64, D));
1726                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1727                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1728                {
1729                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1730                }
1731                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1732                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1733                }
1734            }
1735
1736            next_offset += envelope_size;
1737            _next_ordinal_to_read += 1;
1738            if next_offset >= end_offset {
1739                return Ok(());
1740            }
1741
1742            // Decode unknown envelopes for gaps in ordinals.
1743            while _next_ordinal_to_read < 2 {
1744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1745                _next_ordinal_to_read += 1;
1746                next_offset += envelope_size;
1747            }
1748
1749            let next_out_of_line = decoder.next_out_of_line();
1750            let handles_before = decoder.remaining_handles();
1751            if let Some((inlined, num_bytes, num_handles)) =
1752                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1753            {
1754                let member_inline_size =
1755                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
1756                        decoder.context,
1757                    );
1758                if inlined != (member_inline_size <= 4) {
1759                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1760                }
1761                let inner_offset;
1762                let mut inner_depth = depth.clone();
1763                if inlined {
1764                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1765                    inner_offset = next_offset;
1766                } else {
1767                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1768                    inner_depth.increment()?;
1769                }
1770                let val_ref = self
1771                    .subject
1772                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
1773                fidl::decode!(
1774                    fidl::encoding::BoundedString<256>,
1775                    D,
1776                    val_ref,
1777                    decoder,
1778                    inner_offset,
1779                    inner_depth
1780                )?;
1781                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1782                {
1783                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1784                }
1785                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1786                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1787                }
1788            }
1789
1790            next_offset += envelope_size;
1791            _next_ordinal_to_read += 1;
1792            if next_offset >= end_offset {
1793                return Ok(());
1794            }
1795
1796            // Decode unknown envelopes for gaps in ordinals.
1797            while _next_ordinal_to_read < 3 {
1798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1799                _next_ordinal_to_read += 1;
1800                next_offset += envelope_size;
1801            }
1802
1803            let next_out_of_line = decoder.next_out_of_line();
1804            let handles_before = decoder.remaining_handles();
1805            if let Some((inlined, num_bytes, num_handles)) =
1806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1807            {
1808                let member_inline_size =
1809                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1810                if inlined != (member_inline_size <= 4) {
1811                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1812                }
1813                let inner_offset;
1814                let mut inner_depth = depth.clone();
1815                if inlined {
1816                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1817                    inner_offset = next_offset;
1818                } else {
1819                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1820                    inner_depth.increment()?;
1821                }
1822                let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
1823                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1824                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1825                {
1826                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1827                }
1828                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1829                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1830                }
1831            }
1832
1833            next_offset += envelope_size;
1834            _next_ordinal_to_read += 1;
1835            if next_offset >= end_offset {
1836                return Ok(());
1837            }
1838
1839            // Decode unknown envelopes for gaps in ordinals.
1840            while _next_ordinal_to_read < 4 {
1841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1842                _next_ordinal_to_read += 1;
1843                next_offset += envelope_size;
1844            }
1845
1846            let next_out_of_line = decoder.next_out_of_line();
1847            let handles_before = decoder.remaining_handles();
1848            if let Some((inlined, num_bytes, num_handles)) =
1849                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1850            {
1851                let member_inline_size =
1852                    <Audience as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1853                if inlined != (member_inline_size <= 4) {
1854                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1855                }
1856                let inner_offset;
1857                let mut inner_depth = depth.clone();
1858                if inlined {
1859                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1860                    inner_offset = next_offset;
1861                } else {
1862                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1863                    inner_depth.increment()?;
1864                }
1865                let val_ref = self.sender.get_or_insert_with(|| fidl::new_empty!(Audience, D));
1866                fidl::decode!(Audience, D, val_ref, decoder, inner_offset, inner_depth)?;
1867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1868                {
1869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1870                }
1871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1873                }
1874            }
1875
1876            next_offset += envelope_size;
1877            _next_ordinal_to_read += 1;
1878            if next_offset >= end_offset {
1879                return Ok(());
1880            }
1881
1882            // Decode unknown envelopes for gaps in ordinals.
1883            while _next_ordinal_to_read < 5 {
1884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1885                _next_ordinal_to_read += 1;
1886                next_offset += envelope_size;
1887            }
1888
1889            let next_out_of_line = decoder.next_out_of_line();
1890            let handles_before = decoder.remaining_handles();
1891            if let Some((inlined, num_bytes, num_handles)) =
1892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1893            {
1894                let member_inline_size =
1895                    <Audience as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1896                if inlined != (member_inline_size <= 4) {
1897                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1898                }
1899                let inner_offset;
1900                let mut inner_depth = depth.clone();
1901                if inlined {
1902                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1903                    inner_offset = next_offset;
1904                } else {
1905                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1906                    inner_depth.increment()?;
1907                }
1908                let val_ref = self.recipient.get_or_insert_with(|| fidl::new_empty!(Audience, D));
1909                fidl::decode!(Audience, D, val_ref, decoder, inner_offset, inner_depth)?;
1910                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1911                {
1912                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1913                }
1914                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1915                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1916                }
1917            }
1918
1919            next_offset += envelope_size;
1920            _next_ordinal_to_read += 1;
1921            if next_offset >= end_offset {
1922                return Ok(());
1923            }
1924
1925            // Decode unknown envelopes for gaps in ordinals.
1926            while _next_ordinal_to_read < 6 {
1927                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1928                _next_ordinal_to_read += 1;
1929                next_offset += envelope_size;
1930            }
1931
1932            let next_out_of_line = decoder.next_out_of_line();
1933            let handles_before = decoder.remaining_handles();
1934            if let Some((inlined, num_bytes, num_handles)) =
1935                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1936            {
1937                let member_inline_size =
1938                    <MessageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1939                if inlined != (member_inline_size <= 4) {
1940                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1941                }
1942                let inner_offset;
1943                let mut inner_depth = depth.clone();
1944                if inlined {
1945                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1946                    inner_offset = next_offset;
1947                } else {
1948                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1949                    inner_depth.increment()?;
1950                }
1951                let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(MessageType, D));
1952                fidl::decode!(MessageType, D, val_ref, decoder, inner_offset, inner_depth)?;
1953                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1954                {
1955                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1956                }
1957                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1958                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1959                }
1960            }
1961
1962            next_offset += envelope_size;
1963            _next_ordinal_to_read += 1;
1964            if next_offset >= end_offset {
1965                return Ok(());
1966            }
1967
1968            // Decode unknown envelopes for gaps in ordinals.
1969            while _next_ordinal_to_read < 7 {
1970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1971                _next_ordinal_to_read += 1;
1972                next_offset += envelope_size;
1973            }
1974
1975            let next_out_of_line = decoder.next_out_of_line();
1976            let handles_before = decoder.remaining_handles();
1977            if let Some((inlined, num_bytes, num_handles)) =
1978                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1979            {
1980                let member_inline_size =
1981                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1982                        decoder.context,
1983                    );
1984                if inlined != (member_inline_size <= 4) {
1985                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1986                }
1987                let inner_offset;
1988                let mut inner_depth = depth.clone();
1989                if inlined {
1990                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1991                    inner_offset = next_offset;
1992                } else {
1993                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1994                    inner_depth.increment()?;
1995                }
1996                let val_ref = self
1997                    .content
1998                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
1999                fidl::decode!(
2000                    fidl::encoding::UnboundedString,
2001                    D,
2002                    val_ref,
2003                    decoder,
2004                    inner_offset,
2005                    inner_depth
2006                )?;
2007                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2008                {
2009                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2010                }
2011                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2012                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2013                }
2014            }
2015
2016            next_offset += envelope_size;
2017            _next_ordinal_to_read += 1;
2018            if next_offset >= end_offset {
2019                return Ok(());
2020            }
2021
2022            // Decode unknown envelopes for gaps in ordinals.
2023            while _next_ordinal_to_read < 8 {
2024                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2025                _next_ordinal_to_read += 1;
2026                next_offset += envelope_size;
2027            }
2028
2029            let next_out_of_line = decoder.next_out_of_line();
2030            let handles_before = decoder.remaining_handles();
2031            if let Some((inlined, num_bytes, num_handles)) =
2032                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2033            {
2034                let member_inline_size =
2035                    <fidl::encoding::BoundedString<512> as fidl::encoding::TypeMarker>::inline_size(
2036                        decoder.context,
2037                    );
2038                if inlined != (member_inline_size <= 4) {
2039                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2040                }
2041                let inner_offset;
2042                let mut inner_depth = depth.clone();
2043                if inlined {
2044                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2045                    inner_offset = next_offset;
2046                } else {
2047                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2048                    inner_depth.increment()?;
2049                }
2050                let val_ref = self
2051                    .folder
2052                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<512>, D));
2053                fidl::decode!(
2054                    fidl::encoding::BoundedString<512>,
2055                    D,
2056                    val_ref,
2057                    decoder,
2058                    inner_offset,
2059                    inner_depth
2060                )?;
2061                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2062                {
2063                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2064                }
2065                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2066                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2067                }
2068            }
2069
2070            next_offset += envelope_size;
2071            _next_ordinal_to_read += 1;
2072            if next_offset >= end_offset {
2073                return Ok(());
2074            }
2075
2076            // Decode unknown envelopes for gaps in ordinals.
2077            while _next_ordinal_to_read < 9 {
2078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2079                _next_ordinal_to_read += 1;
2080                next_offset += envelope_size;
2081            }
2082
2083            let next_out_of_line = decoder.next_out_of_line();
2084            let handles_before = decoder.remaining_handles();
2085            if let Some((inlined, num_bytes, num_handles)) =
2086                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2087            {
2088                let member_inline_size =
2089                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2090                if inlined != (member_inline_size <= 4) {
2091                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2092                }
2093                let inner_offset;
2094                let mut inner_depth = depth.clone();
2095                if inlined {
2096                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2097                    inner_offset = next_offset;
2098                } else {
2099                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2100                    inner_depth.increment()?;
2101                }
2102                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(bool, D));
2103                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2104                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2105                {
2106                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2107                }
2108                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2109                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2110                }
2111            }
2112
2113            next_offset += envelope_size;
2114            _next_ordinal_to_read += 1;
2115            if next_offset >= end_offset {
2116                return Ok(());
2117            }
2118
2119            // Decode unknown envelopes for gaps in ordinals.
2120            while _next_ordinal_to_read < 10 {
2121                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2122                _next_ordinal_to_read += 1;
2123                next_offset += envelope_size;
2124            }
2125
2126            let next_out_of_line = decoder.next_out_of_line();
2127            let handles_before = decoder.remaining_handles();
2128            if let Some((inlined, num_bytes, num_handles)) =
2129                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2130            {
2131                let member_inline_size =
2132                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2133                if inlined != (member_inline_size <= 4) {
2134                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2135                }
2136                let inner_offset;
2137                let mut inner_depth = depth.clone();
2138                if inlined {
2139                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2140                    inner_offset = next_offset;
2141                } else {
2142                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2143                    inner_depth.increment()?;
2144                }
2145                let val_ref = self.read.get_or_insert_with(|| fidl::new_empty!(bool, D));
2146                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2147                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2148                {
2149                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2150                }
2151                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2152                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2153                }
2154            }
2155
2156            next_offset += envelope_size;
2157            _next_ordinal_to_read += 1;
2158            if next_offset >= end_offset {
2159                return Ok(());
2160            }
2161
2162            // Decode unknown envelopes for gaps in ordinals.
2163            while _next_ordinal_to_read < 11 {
2164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2165                _next_ordinal_to_read += 1;
2166                next_offset += envelope_size;
2167            }
2168
2169            let next_out_of_line = decoder.next_out_of_line();
2170            let handles_before = decoder.remaining_handles();
2171            if let Some((inlined, num_bytes, num_handles)) =
2172                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2173            {
2174                let member_inline_size =
2175                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2176                if inlined != (member_inline_size <= 4) {
2177                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2178                }
2179                let inner_offset;
2180                let mut inner_depth = depth.clone();
2181                if inlined {
2182                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2183                    inner_offset = next_offset;
2184                } else {
2185                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2186                    inner_depth.increment()?;
2187                }
2188                let val_ref = self.sent.get_or_insert_with(|| fidl::new_empty!(bool, D));
2189                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2190                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2191                {
2192                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2193                }
2194                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2195                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2196                }
2197            }
2198
2199            next_offset += envelope_size;
2200            _next_ordinal_to_read += 1;
2201            if next_offset >= end_offset {
2202                return Ok(());
2203            }
2204
2205            // Decode unknown envelopes for gaps in ordinals.
2206            while _next_ordinal_to_read < 12 {
2207                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2208                _next_ordinal_to_read += 1;
2209                next_offset += envelope_size;
2210            }
2211
2212            let next_out_of_line = decoder.next_out_of_line();
2213            let handles_before = decoder.remaining_handles();
2214            if let Some((inlined, num_bytes, num_handles)) =
2215                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2216            {
2217                let member_inline_size =
2218                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2219                if inlined != (member_inline_size <= 4) {
2220                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2221                }
2222                let inner_offset;
2223                let mut inner_depth = depth.clone();
2224                if inlined {
2225                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2226                    inner_offset = next_offset;
2227                } else {
2228                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2229                    inner_depth.increment()?;
2230                }
2231                let val_ref = self.protected.get_or_insert_with(|| fidl::new_empty!(bool, D));
2232                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2233                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2234                {
2235                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2236                }
2237                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2238                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2239                }
2240            }
2241
2242            next_offset += envelope_size;
2243            _next_ordinal_to_read += 1;
2244            if next_offset >= end_offset {
2245                return Ok(());
2246            }
2247
2248            // Decode unknown envelopes for gaps in ordinals.
2249            while _next_ordinal_to_read < 13 {
2250                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2251                _next_ordinal_to_read += 1;
2252                next_offset += envelope_size;
2253            }
2254
2255            let next_out_of_line = decoder.next_out_of_line();
2256            let handles_before = decoder.remaining_handles();
2257            if let Some((inlined, num_bytes, num_handles)) =
2258                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2259            {
2260                let member_inline_size =
2261                    <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
2262                        decoder.context,
2263                    );
2264                if inlined != (member_inline_size <= 4) {
2265                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2266                }
2267                let inner_offset;
2268                let mut inner_depth = depth.clone();
2269                if inlined {
2270                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2271                    inner_offset = next_offset;
2272                } else {
2273                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2274                    inner_depth.increment()?;
2275                }
2276                let val_ref = self
2277                    .conversation_id
2278                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
2279                fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
2280                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2281                {
2282                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2283                }
2284                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2285                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2286                }
2287            }
2288
2289            next_offset += envelope_size;
2290
2291            // Decode the remaining unknown envelopes.
2292            while next_offset < end_offset {
2293                _next_ordinal_to_read += 1;
2294                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2295                next_offset += envelope_size;
2296            }
2297
2298            Ok(())
2299        }
2300    }
2301
2302    impl Notification {
2303        #[inline(always)]
2304        fn max_ordinal_present(&self) -> u64 {
2305            if let Some(_) = self.priority {
2306                return 9;
2307            }
2308            if let Some(_) = self.sender {
2309                return 8;
2310            }
2311            if let Some(_) = self.subject {
2312                return 7;
2313            }
2314            if let Some(_) = self.timestamp {
2315                return 6;
2316            }
2317            if let Some(_) = self.message_type {
2318                return 5;
2319            }
2320            if let Some(_) = self.folder {
2321                return 4;
2322            }
2323            if let Some(_) = self.message_handle {
2324                return 3;
2325            }
2326            if let Some(_) = self.mas_instance_id {
2327                return 2;
2328            }
2329            if let Some(_) = self.type_ {
2330                return 1;
2331            }
2332            0
2333        }
2334    }
2335
2336    impl fidl::encoding::ValueTypeMarker for Notification {
2337        type Borrowed<'a> = &'a Self;
2338        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2339            value
2340        }
2341    }
2342
2343    unsafe impl fidl::encoding::TypeMarker for Notification {
2344        type Owned = Self;
2345
2346        #[inline(always)]
2347        fn inline_align(_context: fidl::encoding::Context) -> usize {
2348            8
2349        }
2350
2351        #[inline(always)]
2352        fn inline_size(_context: fidl::encoding::Context) -> usize {
2353            16
2354        }
2355    }
2356
2357    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Notification, D>
2358        for &Notification
2359    {
2360        unsafe fn encode(
2361            self,
2362            encoder: &mut fidl::encoding::Encoder<'_, D>,
2363            offset: usize,
2364            mut depth: fidl::encoding::Depth,
2365        ) -> fidl::Result<()> {
2366            encoder.debug_check_bounds::<Notification>(offset);
2367            // Vector header
2368            let max_ordinal: u64 = self.max_ordinal_present();
2369            encoder.write_num(max_ordinal, offset);
2370            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2371            // Calling encoder.out_of_line_offset(0) is not allowed.
2372            if max_ordinal == 0 {
2373                return Ok(());
2374            }
2375            depth.increment()?;
2376            let envelope_size = 8;
2377            let bytes_len = max_ordinal as usize * envelope_size;
2378            #[allow(unused_variables)]
2379            let offset = encoder.out_of_line_offset(bytes_len);
2380            let mut _prev_end_offset: usize = 0;
2381            if 1 > max_ordinal {
2382                return Ok(());
2383            }
2384
2385            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2386            // are envelope_size bytes.
2387            let cur_offset: usize = (1 - 1) * envelope_size;
2388
2389            // Zero reserved fields.
2390            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2391
2392            // Safety:
2393            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2394            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2395            //   envelope_size bytes, there is always sufficient room.
2396            fidl::encoding::encode_in_envelope_optional::<NotificationType, D>(
2397                self.type_
2398                    .as_ref()
2399                    .map(<NotificationType as fidl::encoding::ValueTypeMarker>::borrow),
2400                encoder,
2401                offset + cur_offset,
2402                depth,
2403            )?;
2404
2405            _prev_end_offset = cur_offset + envelope_size;
2406            if 2 > max_ordinal {
2407                return Ok(());
2408            }
2409
2410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2411            // are envelope_size bytes.
2412            let cur_offset: usize = (2 - 1) * envelope_size;
2413
2414            // Zero reserved fields.
2415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2416
2417            // Safety:
2418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2420            //   envelope_size bytes, there is always sufficient room.
2421            fidl::encoding::encode_in_envelope_optional::<u8, D>(
2422                self.mas_instance_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
2423                encoder,
2424                offset + cur_offset,
2425                depth,
2426            )?;
2427
2428            _prev_end_offset = cur_offset + envelope_size;
2429            if 3 > max_ordinal {
2430                return Ok(());
2431            }
2432
2433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2434            // are envelope_size bytes.
2435            let cur_offset: usize = (3 - 1) * envelope_size;
2436
2437            // Zero reserved fields.
2438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2439
2440            // Safety:
2441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2443            //   envelope_size bytes, there is always sufficient room.
2444            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2445                self.message_handle.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2446                encoder,
2447                offset + cur_offset,
2448                depth,
2449            )?;
2450
2451            _prev_end_offset = cur_offset + envelope_size;
2452            if 4 > max_ordinal {
2453                return Ok(());
2454            }
2455
2456            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2457            // are envelope_size bytes.
2458            let cur_offset: usize = (4 - 1) * envelope_size;
2459
2460            // Zero reserved fields.
2461            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2462
2463            // Safety:
2464            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2465            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2466            //   envelope_size bytes, there is always sufficient room.
2467            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<512>, D>(
2468                self.folder.as_ref().map(
2469                    <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow,
2470                ),
2471                encoder,
2472                offset + cur_offset,
2473                depth,
2474            )?;
2475
2476            _prev_end_offset = cur_offset + envelope_size;
2477            if 5 > max_ordinal {
2478                return Ok(());
2479            }
2480
2481            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2482            // are envelope_size bytes.
2483            let cur_offset: usize = (5 - 1) * envelope_size;
2484
2485            // Zero reserved fields.
2486            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2487
2488            // Safety:
2489            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2490            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2491            //   envelope_size bytes, there is always sufficient room.
2492            fidl::encoding::encode_in_envelope_optional::<MessageType, D>(
2493                self.message_type
2494                    .as_ref()
2495                    .map(<MessageType as fidl::encoding::ValueTypeMarker>::borrow),
2496                encoder,
2497                offset + cur_offset,
2498                depth,
2499            )?;
2500
2501            _prev_end_offset = cur_offset + envelope_size;
2502            if 6 > max_ordinal {
2503                return Ok(());
2504            }
2505
2506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2507            // are envelope_size bytes.
2508            let cur_offset: usize = (6 - 1) * envelope_size;
2509
2510            // Zero reserved fields.
2511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2512
2513            // Safety:
2514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2516            //   envelope_size bytes, there is always sufficient room.
2517            fidl::encoding::encode_in_envelope_optional::<i64, D>(
2518                self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2519                encoder,
2520                offset + cur_offset,
2521                depth,
2522            )?;
2523
2524            _prev_end_offset = cur_offset + envelope_size;
2525            if 7 > max_ordinal {
2526                return Ok(());
2527            }
2528
2529            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2530            // are envelope_size bytes.
2531            let cur_offset: usize = (7 - 1) * envelope_size;
2532
2533            // Zero reserved fields.
2534            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2535
2536            // Safety:
2537            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2538            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2539            //   envelope_size bytes, there is always sufficient room.
2540            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
2541                self.subject.as_ref().map(
2542                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
2543                ),
2544                encoder,
2545                offset + cur_offset,
2546                depth,
2547            )?;
2548
2549            _prev_end_offset = cur_offset + envelope_size;
2550            if 8 > max_ordinal {
2551                return Ok(());
2552            }
2553
2554            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2555            // are envelope_size bytes.
2556            let cur_offset: usize = (8 - 1) * envelope_size;
2557
2558            // Zero reserved fields.
2559            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2560
2561            // Safety:
2562            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2563            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2564            //   envelope_size bytes, there is always sufficient room.
2565            fidl::encoding::encode_in_envelope_optional::<Audience, D>(
2566                self.sender.as_ref().map(<Audience as fidl::encoding::ValueTypeMarker>::borrow),
2567                encoder,
2568                offset + cur_offset,
2569                depth,
2570            )?;
2571
2572            _prev_end_offset = cur_offset + envelope_size;
2573            if 9 > max_ordinal {
2574                return Ok(());
2575            }
2576
2577            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2578            // are envelope_size bytes.
2579            let cur_offset: usize = (9 - 1) * envelope_size;
2580
2581            // Zero reserved fields.
2582            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2583
2584            // Safety:
2585            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2586            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2587            //   envelope_size bytes, there is always sufficient room.
2588            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2589                self.priority.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2590                encoder,
2591                offset + cur_offset,
2592                depth,
2593            )?;
2594
2595            _prev_end_offset = cur_offset + envelope_size;
2596
2597            Ok(())
2598        }
2599    }
2600
2601    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Notification {
2602        #[inline(always)]
2603        fn new_empty() -> Self {
2604            Self::default()
2605        }
2606
2607        unsafe fn decode(
2608            &mut self,
2609            decoder: &mut fidl::encoding::Decoder<'_, D>,
2610            offset: usize,
2611            mut depth: fidl::encoding::Depth,
2612        ) -> fidl::Result<()> {
2613            decoder.debug_check_bounds::<Self>(offset);
2614            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2615                None => return Err(fidl::Error::NotNullable),
2616                Some(len) => len,
2617            };
2618            // Calling decoder.out_of_line_offset(0) is not allowed.
2619            if len == 0 {
2620                return Ok(());
2621            };
2622            depth.increment()?;
2623            let envelope_size = 8;
2624            let bytes_len = len * envelope_size;
2625            let offset = decoder.out_of_line_offset(bytes_len)?;
2626            // Decode the envelope for each type.
2627            let mut _next_ordinal_to_read = 0;
2628            let mut next_offset = offset;
2629            let end_offset = offset + bytes_len;
2630            _next_ordinal_to_read += 1;
2631            if next_offset >= end_offset {
2632                return Ok(());
2633            }
2634
2635            // Decode unknown envelopes for gaps in ordinals.
2636            while _next_ordinal_to_read < 1 {
2637                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2638                _next_ordinal_to_read += 1;
2639                next_offset += envelope_size;
2640            }
2641
2642            let next_out_of_line = decoder.next_out_of_line();
2643            let handles_before = decoder.remaining_handles();
2644            if let Some((inlined, num_bytes, num_handles)) =
2645                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2646            {
2647                let member_inline_size =
2648                    <NotificationType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2649                if inlined != (member_inline_size <= 4) {
2650                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2651                }
2652                let inner_offset;
2653                let mut inner_depth = depth.clone();
2654                if inlined {
2655                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2656                    inner_offset = next_offset;
2657                } else {
2658                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2659                    inner_depth.increment()?;
2660                }
2661                let val_ref =
2662                    self.type_.get_or_insert_with(|| fidl::new_empty!(NotificationType, D));
2663                fidl::decode!(NotificationType, D, val_ref, decoder, inner_offset, inner_depth)?;
2664                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2665                {
2666                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2667                }
2668                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2669                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2670                }
2671            }
2672
2673            next_offset += envelope_size;
2674            _next_ordinal_to_read += 1;
2675            if next_offset >= end_offset {
2676                return Ok(());
2677            }
2678
2679            // Decode unknown envelopes for gaps in ordinals.
2680            while _next_ordinal_to_read < 2 {
2681                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2682                _next_ordinal_to_read += 1;
2683                next_offset += envelope_size;
2684            }
2685
2686            let next_out_of_line = decoder.next_out_of_line();
2687            let handles_before = decoder.remaining_handles();
2688            if let Some((inlined, num_bytes, num_handles)) =
2689                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2690            {
2691                let member_inline_size =
2692                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2693                if inlined != (member_inline_size <= 4) {
2694                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2695                }
2696                let inner_offset;
2697                let mut inner_depth = depth.clone();
2698                if inlined {
2699                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2700                    inner_offset = next_offset;
2701                } else {
2702                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2703                    inner_depth.increment()?;
2704                }
2705                let val_ref = self.mas_instance_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
2706                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
2707                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2708                {
2709                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2710                }
2711                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2712                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2713                }
2714            }
2715
2716            next_offset += envelope_size;
2717            _next_ordinal_to_read += 1;
2718            if next_offset >= end_offset {
2719                return Ok(());
2720            }
2721
2722            // Decode unknown envelopes for gaps in ordinals.
2723            while _next_ordinal_to_read < 3 {
2724                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2725                _next_ordinal_to_read += 1;
2726                next_offset += envelope_size;
2727            }
2728
2729            let next_out_of_line = decoder.next_out_of_line();
2730            let handles_before = decoder.remaining_handles();
2731            if let Some((inlined, num_bytes, num_handles)) =
2732                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2733            {
2734                let member_inline_size =
2735                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2736                if inlined != (member_inline_size <= 4) {
2737                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2738                }
2739                let inner_offset;
2740                let mut inner_depth = depth.clone();
2741                if inlined {
2742                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2743                    inner_offset = next_offset;
2744                } else {
2745                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2746                    inner_depth.increment()?;
2747                }
2748                let val_ref = self.message_handle.get_or_insert_with(|| fidl::new_empty!(u64, D));
2749                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2750                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2751                {
2752                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2753                }
2754                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2755                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2756                }
2757            }
2758
2759            next_offset += envelope_size;
2760            _next_ordinal_to_read += 1;
2761            if next_offset >= end_offset {
2762                return Ok(());
2763            }
2764
2765            // Decode unknown envelopes for gaps in ordinals.
2766            while _next_ordinal_to_read < 4 {
2767                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2768                _next_ordinal_to_read += 1;
2769                next_offset += envelope_size;
2770            }
2771
2772            let next_out_of_line = decoder.next_out_of_line();
2773            let handles_before = decoder.remaining_handles();
2774            if let Some((inlined, num_bytes, num_handles)) =
2775                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2776            {
2777                let member_inline_size =
2778                    <fidl::encoding::BoundedString<512> as fidl::encoding::TypeMarker>::inline_size(
2779                        decoder.context,
2780                    );
2781                if inlined != (member_inline_size <= 4) {
2782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2783                }
2784                let inner_offset;
2785                let mut inner_depth = depth.clone();
2786                if inlined {
2787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2788                    inner_offset = next_offset;
2789                } else {
2790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2791                    inner_depth.increment()?;
2792                }
2793                let val_ref = self
2794                    .folder
2795                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<512>, D));
2796                fidl::decode!(
2797                    fidl::encoding::BoundedString<512>,
2798                    D,
2799                    val_ref,
2800                    decoder,
2801                    inner_offset,
2802                    inner_depth
2803                )?;
2804                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2805                {
2806                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2807                }
2808                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2809                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2810                }
2811            }
2812
2813            next_offset += envelope_size;
2814            _next_ordinal_to_read += 1;
2815            if next_offset >= end_offset {
2816                return Ok(());
2817            }
2818
2819            // Decode unknown envelopes for gaps in ordinals.
2820            while _next_ordinal_to_read < 5 {
2821                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2822                _next_ordinal_to_read += 1;
2823                next_offset += envelope_size;
2824            }
2825
2826            let next_out_of_line = decoder.next_out_of_line();
2827            let handles_before = decoder.remaining_handles();
2828            if let Some((inlined, num_bytes, num_handles)) =
2829                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2830            {
2831                let member_inline_size =
2832                    <MessageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2833                if inlined != (member_inline_size <= 4) {
2834                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2835                }
2836                let inner_offset;
2837                let mut inner_depth = depth.clone();
2838                if inlined {
2839                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2840                    inner_offset = next_offset;
2841                } else {
2842                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2843                    inner_depth.increment()?;
2844                }
2845                let val_ref =
2846                    self.message_type.get_or_insert_with(|| fidl::new_empty!(MessageType, D));
2847                fidl::decode!(MessageType, D, val_ref, decoder, inner_offset, inner_depth)?;
2848                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2849                {
2850                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2851                }
2852                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2853                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2854                }
2855            }
2856
2857            next_offset += envelope_size;
2858            _next_ordinal_to_read += 1;
2859            if next_offset >= end_offset {
2860                return Ok(());
2861            }
2862
2863            // Decode unknown envelopes for gaps in ordinals.
2864            while _next_ordinal_to_read < 6 {
2865                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2866                _next_ordinal_to_read += 1;
2867                next_offset += envelope_size;
2868            }
2869
2870            let next_out_of_line = decoder.next_out_of_line();
2871            let handles_before = decoder.remaining_handles();
2872            if let Some((inlined, num_bytes, num_handles)) =
2873                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2874            {
2875                let member_inline_size =
2876                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2877                if inlined != (member_inline_size <= 4) {
2878                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2879                }
2880                let inner_offset;
2881                let mut inner_depth = depth.clone();
2882                if inlined {
2883                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2884                    inner_offset = next_offset;
2885                } else {
2886                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2887                    inner_depth.increment()?;
2888                }
2889                let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
2890                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2891                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2892                {
2893                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2894                }
2895                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2896                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2897                }
2898            }
2899
2900            next_offset += envelope_size;
2901            _next_ordinal_to_read += 1;
2902            if next_offset >= end_offset {
2903                return Ok(());
2904            }
2905
2906            // Decode unknown envelopes for gaps in ordinals.
2907            while _next_ordinal_to_read < 7 {
2908                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2909                _next_ordinal_to_read += 1;
2910                next_offset += envelope_size;
2911            }
2912
2913            let next_out_of_line = decoder.next_out_of_line();
2914            let handles_before = decoder.remaining_handles();
2915            if let Some((inlined, num_bytes, num_handles)) =
2916                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2917            {
2918                let member_inline_size =
2919                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2920                        decoder.context,
2921                    );
2922                if inlined != (member_inline_size <= 4) {
2923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2924                }
2925                let inner_offset;
2926                let mut inner_depth = depth.clone();
2927                if inlined {
2928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2929                    inner_offset = next_offset;
2930                } else {
2931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2932                    inner_depth.increment()?;
2933                }
2934                let val_ref = self
2935                    .subject
2936                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
2937                fidl::decode!(
2938                    fidl::encoding::BoundedString<256>,
2939                    D,
2940                    val_ref,
2941                    decoder,
2942                    inner_offset,
2943                    inner_depth
2944                )?;
2945                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2946                {
2947                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2948                }
2949                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2950                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2951                }
2952            }
2953
2954            next_offset += envelope_size;
2955            _next_ordinal_to_read += 1;
2956            if next_offset >= end_offset {
2957                return Ok(());
2958            }
2959
2960            // Decode unknown envelopes for gaps in ordinals.
2961            while _next_ordinal_to_read < 8 {
2962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2963                _next_ordinal_to_read += 1;
2964                next_offset += envelope_size;
2965            }
2966
2967            let next_out_of_line = decoder.next_out_of_line();
2968            let handles_before = decoder.remaining_handles();
2969            if let Some((inlined, num_bytes, num_handles)) =
2970                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2971            {
2972                let member_inline_size =
2973                    <Audience as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2974                if inlined != (member_inline_size <= 4) {
2975                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2976                }
2977                let inner_offset;
2978                let mut inner_depth = depth.clone();
2979                if inlined {
2980                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2981                    inner_offset = next_offset;
2982                } else {
2983                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2984                    inner_depth.increment()?;
2985                }
2986                let val_ref = self.sender.get_or_insert_with(|| fidl::new_empty!(Audience, D));
2987                fidl::decode!(Audience, D, val_ref, decoder, inner_offset, inner_depth)?;
2988                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2989                {
2990                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2991                }
2992                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2993                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2994                }
2995            }
2996
2997            next_offset += envelope_size;
2998            _next_ordinal_to_read += 1;
2999            if next_offset >= end_offset {
3000                return Ok(());
3001            }
3002
3003            // Decode unknown envelopes for gaps in ordinals.
3004            while _next_ordinal_to_read < 9 {
3005                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3006                _next_ordinal_to_read += 1;
3007                next_offset += envelope_size;
3008            }
3009
3010            let next_out_of_line = decoder.next_out_of_line();
3011            let handles_before = decoder.remaining_handles();
3012            if let Some((inlined, num_bytes, num_handles)) =
3013                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3014            {
3015                let member_inline_size =
3016                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3017                if inlined != (member_inline_size <= 4) {
3018                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3019                }
3020                let inner_offset;
3021                let mut inner_depth = depth.clone();
3022                if inlined {
3023                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3024                    inner_offset = next_offset;
3025                } else {
3026                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3027                    inner_depth.increment()?;
3028                }
3029                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(bool, D));
3030                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3031                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3032                {
3033                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3034                }
3035                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3036                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3037                }
3038            }
3039
3040            next_offset += envelope_size;
3041
3042            // Decode the remaining unknown envelopes.
3043            while next_offset < end_offset {
3044                _next_ordinal_to_read += 1;
3045                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3046                next_offset += envelope_size;
3047            }
3048
3049            Ok(())
3050        }
3051    }
3052
3053    impl NotificationRegistrationNewEventReportRequest {
3054        #[inline(always)]
3055        fn max_ordinal_present(&self) -> u64 {
3056            if let Some(_) = self.received {
3057                return 2;
3058            }
3059            if let Some(_) = self.notification {
3060                return 1;
3061            }
3062            0
3063        }
3064    }
3065
3066    impl fidl::encoding::ValueTypeMarker for NotificationRegistrationNewEventReportRequest {
3067        type Borrowed<'a> = &'a Self;
3068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3069            value
3070        }
3071    }
3072
3073    unsafe impl fidl::encoding::TypeMarker for NotificationRegistrationNewEventReportRequest {
3074        type Owned = Self;
3075
3076        #[inline(always)]
3077        fn inline_align(_context: fidl::encoding::Context) -> usize {
3078            8
3079        }
3080
3081        #[inline(always)]
3082        fn inline_size(_context: fidl::encoding::Context) -> usize {
3083            16
3084        }
3085    }
3086
3087    unsafe impl<D: fidl::encoding::ResourceDialect>
3088        fidl::encoding::Encode<NotificationRegistrationNewEventReportRequest, D>
3089        for &NotificationRegistrationNewEventReportRequest
3090    {
3091        unsafe fn encode(
3092            self,
3093            encoder: &mut fidl::encoding::Encoder<'_, D>,
3094            offset: usize,
3095            mut depth: fidl::encoding::Depth,
3096        ) -> fidl::Result<()> {
3097            encoder.debug_check_bounds::<NotificationRegistrationNewEventReportRequest>(offset);
3098            // Vector header
3099            let max_ordinal: u64 = self.max_ordinal_present();
3100            encoder.write_num(max_ordinal, offset);
3101            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3102            // Calling encoder.out_of_line_offset(0) is not allowed.
3103            if max_ordinal == 0 {
3104                return Ok(());
3105            }
3106            depth.increment()?;
3107            let envelope_size = 8;
3108            let bytes_len = max_ordinal as usize * envelope_size;
3109            #[allow(unused_variables)]
3110            let offset = encoder.out_of_line_offset(bytes_len);
3111            let mut _prev_end_offset: usize = 0;
3112            if 1 > max_ordinal {
3113                return Ok(());
3114            }
3115
3116            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3117            // are envelope_size bytes.
3118            let cur_offset: usize = (1 - 1) * envelope_size;
3119
3120            // Zero reserved fields.
3121            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3122
3123            // Safety:
3124            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3125            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3126            //   envelope_size bytes, there is always sufficient room.
3127            fidl::encoding::encode_in_envelope_optional::<Notification, D>(
3128                self.notification
3129                    .as_ref()
3130                    .map(<Notification as fidl::encoding::ValueTypeMarker>::borrow),
3131                encoder,
3132                offset + cur_offset,
3133                depth,
3134            )?;
3135
3136            _prev_end_offset = cur_offset + envelope_size;
3137            if 2 > max_ordinal {
3138                return Ok(());
3139            }
3140
3141            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3142            // are envelope_size bytes.
3143            let cur_offset: usize = (2 - 1) * envelope_size;
3144
3145            // Zero reserved fields.
3146            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3147
3148            // Safety:
3149            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3150            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3151            //   envelope_size bytes, there is always sufficient room.
3152            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3153                self.received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3154                encoder,
3155                offset + cur_offset,
3156                depth,
3157            )?;
3158
3159            _prev_end_offset = cur_offset + envelope_size;
3160
3161            Ok(())
3162        }
3163    }
3164
3165    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3166        for NotificationRegistrationNewEventReportRequest
3167    {
3168        #[inline(always)]
3169        fn new_empty() -> Self {
3170            Self::default()
3171        }
3172
3173        unsafe fn decode(
3174            &mut self,
3175            decoder: &mut fidl::encoding::Decoder<'_, D>,
3176            offset: usize,
3177            mut depth: fidl::encoding::Depth,
3178        ) -> fidl::Result<()> {
3179            decoder.debug_check_bounds::<Self>(offset);
3180            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3181                None => return Err(fidl::Error::NotNullable),
3182                Some(len) => len,
3183            };
3184            // Calling decoder.out_of_line_offset(0) is not allowed.
3185            if len == 0 {
3186                return Ok(());
3187            };
3188            depth.increment()?;
3189            let envelope_size = 8;
3190            let bytes_len = len * envelope_size;
3191            let offset = decoder.out_of_line_offset(bytes_len)?;
3192            // Decode the envelope for each type.
3193            let mut _next_ordinal_to_read = 0;
3194            let mut next_offset = offset;
3195            let end_offset = offset + bytes_len;
3196            _next_ordinal_to_read += 1;
3197            if next_offset >= end_offset {
3198                return Ok(());
3199            }
3200
3201            // Decode unknown envelopes for gaps in ordinals.
3202            while _next_ordinal_to_read < 1 {
3203                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3204                _next_ordinal_to_read += 1;
3205                next_offset += envelope_size;
3206            }
3207
3208            let next_out_of_line = decoder.next_out_of_line();
3209            let handles_before = decoder.remaining_handles();
3210            if let Some((inlined, num_bytes, num_handles)) =
3211                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3212            {
3213                let member_inline_size =
3214                    <Notification as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3215                if inlined != (member_inline_size <= 4) {
3216                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3217                }
3218                let inner_offset;
3219                let mut inner_depth = depth.clone();
3220                if inlined {
3221                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3222                    inner_offset = next_offset;
3223                } else {
3224                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3225                    inner_depth.increment()?;
3226                }
3227                let val_ref =
3228                    self.notification.get_or_insert_with(|| fidl::new_empty!(Notification, D));
3229                fidl::decode!(Notification, D, val_ref, decoder, inner_offset, inner_depth)?;
3230                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3231                {
3232                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3233                }
3234                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3235                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3236                }
3237            }
3238
3239            next_offset += envelope_size;
3240            _next_ordinal_to_read += 1;
3241            if next_offset >= end_offset {
3242                return Ok(());
3243            }
3244
3245            // Decode unknown envelopes for gaps in ordinals.
3246            while _next_ordinal_to_read < 2 {
3247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3248                _next_ordinal_to_read += 1;
3249                next_offset += envelope_size;
3250            }
3251
3252            let next_out_of_line = decoder.next_out_of_line();
3253            let handles_before = decoder.remaining_handles();
3254            if let Some((inlined, num_bytes, num_handles)) =
3255                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3256            {
3257                let member_inline_size =
3258                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3259                if inlined != (member_inline_size <= 4) {
3260                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3261                }
3262                let inner_offset;
3263                let mut inner_depth = depth.clone();
3264                if inlined {
3265                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3266                    inner_offset = next_offset;
3267                } else {
3268                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3269                    inner_depth.increment()?;
3270                }
3271                let val_ref = self.received.get_or_insert_with(|| fidl::new_empty!(i64, D));
3272                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3273                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3274                {
3275                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3276                }
3277                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3278                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3279                }
3280            }
3281
3282            next_offset += envelope_size;
3283
3284            // Decode the remaining unknown envelopes.
3285            while next_offset < end_offset {
3286                _next_ordinal_to_read += 1;
3287                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3288                next_offset += envelope_size;
3289            }
3290
3291            Ok(())
3292        }
3293    }
3294}