fidl_fuchsia_bluetooth_hfp__common/
fidl_fuchsia_bluetooth_hfp__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Represents a specific phone book memory location.
12pub type Memory = String;
13
14/// Represents a text string of V.250 dialing digits.
15/// See TS 127.007v06.08.00, Section 6.2 for more information.
16pub type Number = String;
17
18pub const MAX_PICONET_SIZE: u64 = 8;
19
20/// The direction of call initiation.
21#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
22#[repr(u32)]
23pub enum CallDirection {
24    /// Call originated on this device. This is also known as an Outgoing call.
25    MobileOriginated = 1,
26    /// Call is terminated on this device. This is also known as an Incoming call.
27    MobileTerminated = 2,
28}
29
30impl CallDirection {
31    #[inline]
32    pub fn from_primitive(prim: u32) -> Option<Self> {
33        match prim {
34            1 => Some(Self::MobileOriginated),
35            2 => Some(Self::MobileTerminated),
36            _ => None,
37        }
38    }
39
40    #[inline]
41    pub const fn into_primitive(self) -> u32 {
42        self as u32
43    }
44}
45
46/// Represents the valid states of a call.
47#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
48pub enum CallState {
49    /// There is a callsetup procedure in progress for an outgoing call.
50    /// This state should not be set by the Call protocol client.
51    /// It is the initial state of an unanswered outgoing call.
52    OutgoingDialing,
53    /// There is a callsetup procedure in progress for an outgoing call and the
54    /// remote party has been alerted to the callsetup. This state is an
55    /// optional transition from OUTGOING_DIALING.
56    OutgoingAlerting,
57    /// There is a callsetup procedure in progress for an incoming call.
58    IncomingRinging,
59    /// There is a callsetup procedure in progress for an incoming call.
60    IncomingWaiting,
61    /// A call is in progress but another call is active.
62    OngoingHeld,
63    /// A call is active.
64    OngoingActive,
65    /// The call has been termianted.
66    Terminated,
67    /// The call has been transferred to the AG, after which the HF is no longer
68    /// tracking its state.
69    TransferredToAg,
70    #[doc(hidden)]
71    __SourceBreaking { unknown_ordinal: u32 },
72}
73
74/// Pattern that matches an unknown `CallState` member.
75#[macro_export]
76macro_rules! CallStateUnknown {
77    () => {
78        _
79    };
80}
81
82impl CallState {
83    #[inline]
84    pub fn from_primitive(prim: u32) -> Option<Self> {
85        match prim {
86            1 => Some(Self::OutgoingDialing),
87            2 => Some(Self::OutgoingAlerting),
88            3 => Some(Self::IncomingRinging),
89            4 => Some(Self::IncomingWaiting),
90            5 => Some(Self::OngoingHeld),
91            6 => Some(Self::OngoingActive),
92            7 => Some(Self::Terminated),
93            8 => Some(Self::TransferredToAg),
94            _ => None,
95        }
96    }
97
98    #[inline]
99    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
100        match prim {
101            1 => Self::OutgoingDialing,
102            2 => Self::OutgoingAlerting,
103            3 => Self::IncomingRinging,
104            4 => Self::IncomingWaiting,
105            5 => Self::OngoingHeld,
106            6 => Self::OngoingActive,
107            7 => Self::Terminated,
108            8 => Self::TransferredToAg,
109            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
110        }
111    }
112
113    #[inline]
114    pub fn unknown() -> Self {
115        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
116    }
117
118    #[inline]
119    pub const fn into_primitive(self) -> u32 {
120        match self {
121            Self::OutgoingDialing => 1,
122            Self::OutgoingAlerting => 2,
123            Self::IncomingRinging => 3,
124            Self::IncomingWaiting => 4,
125            Self::OngoingHeld => 5,
126            Self::OngoingActive => 6,
127            Self::Terminated => 7,
128            Self::TransferredToAg => 8,
129            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
130        }
131    }
132
133    #[inline]
134    pub fn is_unknown(&self) -> bool {
135        match self {
136            Self::__SourceBreaking { unknown_ordinal: _ } => true,
137            _ => false,
138        }
139    }
140}
141
142/// Dual-tone multi-frequency signaling codes.
143#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
144#[repr(u8)]
145pub enum DtmfCode {
146    /// Represented by ASCII "1" in AT commands.
147    One = 49,
148    /// Represented by ASCII "2" in AT commands.
149    Two = 50,
150    /// Represented by ASCII "3" in AT commands.
151    Three = 51,
152    /// Represented by ASCII "4" in AT commands.
153    Four = 52,
154    /// Represented by ASCII "5" in AT commands.
155    Five = 53,
156    /// Represented by ASCII "6" in AT commands.
157    Six = 54,
158    /// Represented by ASCII "7" in AT commands.
159    Seven = 55,
160    /// Represented by ASCII "8" in AT commands.
161    Eight = 56,
162    /// Represented by ASCII "9" in AT commands.
163    Nine = 57,
164    /// Represented by ASCII "#" in AT commands.
165    NumberSign = 35,
166    /// Represented by ASCII "0" in AT commands.
167    Zero = 48,
168    /// Represented by ASCII "*" in AT commands.
169    Asterisk = 42,
170    /// Represented by ASCII "A" in AT commands.
171    A = 65,
172    /// Represented by ASCII "B" in AT commands.
173    B = 66,
174    /// Represented by ASCII "C" in AT commands.
175    C = 67,
176    /// Represented by ASCII "D" in AT commands.
177    D = 68,
178}
179
180impl DtmfCode {
181    #[inline]
182    pub fn from_primitive(prim: u8) -> Option<Self> {
183        match prim {
184            49 => Some(Self::One),
185            50 => Some(Self::Two),
186            51 => Some(Self::Three),
187            52 => Some(Self::Four),
188            53 => Some(Self::Five),
189            54 => Some(Self::Six),
190            55 => Some(Self::Seven),
191            56 => Some(Self::Eight),
192            57 => Some(Self::Nine),
193            35 => Some(Self::NumberSign),
194            48 => Some(Self::Zero),
195            42 => Some(Self::Asterisk),
196            65 => Some(Self::A),
197            66 => Some(Self::B),
198            67 => Some(Self::C),
199            68 => Some(Self::D),
200            _ => None,
201        }
202    }
203
204    #[inline]
205    pub const fn into_primitive(self) -> u8 {
206        self as u8
207    }
208}
209
210/// Represents the signal strength of a connection between the Audio Gateway and
211/// a network.
212#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
213#[repr(i8)]
214pub enum SignalStrength {
215    None = 1,
216    VeryLow = 2,
217    Low = 3,
218    Medium = 4,
219    High = 5,
220    VeryHigh = 6,
221}
222
223impl SignalStrength {
224    #[inline]
225    pub fn from_primitive(prim: i8) -> Option<Self> {
226        match prim {
227            1 => Some(Self::None),
228            2 => Some(Self::VeryLow),
229            3 => Some(Self::Low),
230            4 => Some(Self::Medium),
231            5 => Some(Self::High),
232            6 => Some(Self::VeryHigh),
233            _ => None,
234        }
235    }
236
237    #[inline]
238    pub const fn into_primitive(self) -> i8 {
239        self as i8
240    }
241}
242
243#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
244pub struct CallSendDtmfCodeRequest {
245    pub code: DtmfCode,
246}
247
248impl fidl::Persistable for CallSendDtmfCodeRequest {}
249
250#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
251pub struct CallWatchStateResponse {
252    pub state: CallState,
253}
254
255impl fidl::Persistable for CallWatchStateResponse {}
256
257#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
258#[repr(C)]
259pub struct HeadsetGainSetMicrophoneGainRequest {
260    pub requested: u8,
261}
262
263impl fidl::Persistable for HeadsetGainSetMicrophoneGainRequest {}
264
265#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
266#[repr(C)]
267pub struct HeadsetGainSetSpeakerGainRequest {
268    pub requested: u8,
269}
270
271impl fidl::Persistable for HeadsetGainSetSpeakerGainRequest {}
272
273#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
274#[repr(C)]
275pub struct HeadsetGainWatchMicrophoneGainResponse {
276    pub gain: u8,
277}
278
279impl fidl::Persistable for HeadsetGainWatchMicrophoneGainResponse {}
280
281#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
282#[repr(C)]
283pub struct HeadsetGainWatchSpeakerGainResponse {
284    pub gain: u8,
285}
286
287impl fidl::Persistable for HeadsetGainWatchSpeakerGainResponse {}
288
289#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
290pub struct PeerHandlerQueryOperatorResponse {
291    pub operator: Option<String>,
292}
293
294impl fidl::Persistable for PeerHandlerQueryOperatorResponse {}
295
296#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
297#[repr(C)]
298pub struct PeerHandlerReportHeadsetBatteryLevelRequest {
299    pub level: u8,
300}
301
302impl fidl::Persistable for PeerHandlerReportHeadsetBatteryLevelRequest {}
303
304#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
305pub struct PeerHandlerRequestOutgoingCallRequest {
306    pub action: CallAction,
307}
308
309impl fidl::Persistable for PeerHandlerRequestOutgoingCallRequest {}
310
311#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
312pub struct PeerHandlerSetNrecModeRequest {
313    pub enabled: bool,
314}
315
316impl fidl::Persistable for PeerHandlerSetNrecModeRequest {}
317
318#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
319pub struct PeerHandlerSubscriberNumberInformationResponse {
320    pub numbers: Vec<String>,
321}
322
323impl fidl::Persistable for PeerHandlerSubscriberNumberInformationResponse {}
324
325#[derive(Clone, Debug, PartialEq)]
326pub struct PeerHandlerWatchNetworkInformationResponse {
327    pub update: NetworkInformation,
328}
329
330impl fidl::Persistable for PeerHandlerWatchNetworkInformationResponse {}
331
332/// Represents the action of redialing the last dialed number.
333#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
334pub struct RedialLast;
335
336impl fidl::Persistable for RedialLast {}
337
338/// Represents the action of transferring an active call to the Headset.
339#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
340pub struct TransferActive;
341
342impl fidl::Persistable for TransferActive {}
343
344/// Network information for the Audio Gateway. Typically this represents
345/// information regarding the state of connectivity to a telephony network.
346#[derive(Clone, Debug, Default, PartialEq)]
347pub struct NetworkInformation {
348    /// Report the status of registration with the network. See HFP v1.8,
349    /// Section 4.4
350    pub service_available: Option<bool>,
351    /// Report the signal strength of the connection to the network. See
352    /// the HFP v1.8, Section 4.5.
353    pub signal_strength: Option<SignalStrength>,
354    /// Report the roaming status of the connection to the network. See
355    /// HFP v1.8, Section 4.6
356    pub roaming: Option<bool>,
357    #[doc(hidden)]
358    pub __source_breaking: fidl::marker::SourceBreaking,
359}
360
361impl fidl::Persistable for NetworkInformation {}
362
363/// A command from the HF with a value representing what number to dial.
364#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
365pub enum CallAction {
366    /// A complete number to be dialed by the call handler service. See HFP v1.8
367    /// Section 4.18.
368    DialFromNumber(String),
369    /// A phone book memory location from which a number to be dialed should be
370    /// looked up. See HFP v1.8 Section 4.19.
371    DialFromLocation(String),
372    /// The call handler service should dial the last used number. See HFP v1.8
373    /// Section 4.20.
374    RedialLast(RedialLast),
375    /// Request to transfer an active call to the headset rather than initiating
376    /// a new outgoing call. A call must already be in progress on the Audio
377    /// Gateway in order for a transfer of audio to the Hands-Free device to take
378    /// place. See HFP v1.8 Section 4.16.
379    TransferActive(TransferActive),
380}
381
382impl CallAction {
383    #[inline]
384    pub fn ordinal(&self) -> u64 {
385        match *self {
386            Self::DialFromNumber(_) => 1,
387            Self::DialFromLocation(_) => 2,
388            Self::RedialLast(_) => 3,
389            Self::TransferActive(_) => 4,
390        }
391    }
392}
393
394impl fidl::Persistable for CallAction {}
395
396mod internal {
397    use super::*;
398    unsafe impl fidl::encoding::TypeMarker for CallDirection {
399        type Owned = Self;
400
401        #[inline(always)]
402        fn inline_align(_context: fidl::encoding::Context) -> usize {
403            std::mem::align_of::<u32>()
404        }
405
406        #[inline(always)]
407        fn inline_size(_context: fidl::encoding::Context) -> usize {
408            std::mem::size_of::<u32>()
409        }
410
411        #[inline(always)]
412        fn encode_is_copy() -> bool {
413            true
414        }
415
416        #[inline(always)]
417        fn decode_is_copy() -> bool {
418            false
419        }
420    }
421
422    impl fidl::encoding::ValueTypeMarker for CallDirection {
423        type Borrowed<'a> = Self;
424        #[inline(always)]
425        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
426            *value
427        }
428    }
429
430    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CallDirection {
431        #[inline]
432        unsafe fn encode(
433            self,
434            encoder: &mut fidl::encoding::Encoder<'_, D>,
435            offset: usize,
436            _depth: fidl::encoding::Depth,
437        ) -> fidl::Result<()> {
438            encoder.debug_check_bounds::<Self>(offset);
439            encoder.write_num(self.into_primitive(), offset);
440            Ok(())
441        }
442    }
443
444    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallDirection {
445        #[inline(always)]
446        fn new_empty() -> Self {
447            Self::MobileOriginated
448        }
449
450        #[inline]
451        unsafe fn decode(
452            &mut self,
453            decoder: &mut fidl::encoding::Decoder<'_, D>,
454            offset: usize,
455            _depth: fidl::encoding::Depth,
456        ) -> fidl::Result<()> {
457            decoder.debug_check_bounds::<Self>(offset);
458            let prim = decoder.read_num::<u32>(offset);
459
460            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
461            Ok(())
462        }
463    }
464    unsafe impl fidl::encoding::TypeMarker for CallState {
465        type Owned = Self;
466
467        #[inline(always)]
468        fn inline_align(_context: fidl::encoding::Context) -> usize {
469            std::mem::align_of::<u32>()
470        }
471
472        #[inline(always)]
473        fn inline_size(_context: fidl::encoding::Context) -> usize {
474            std::mem::size_of::<u32>()
475        }
476
477        #[inline(always)]
478        fn encode_is_copy() -> bool {
479            false
480        }
481
482        #[inline(always)]
483        fn decode_is_copy() -> bool {
484            false
485        }
486    }
487
488    impl fidl::encoding::ValueTypeMarker for CallState {
489        type Borrowed<'a> = Self;
490        #[inline(always)]
491        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
492            *value
493        }
494    }
495
496    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CallState {
497        #[inline]
498        unsafe fn encode(
499            self,
500            encoder: &mut fidl::encoding::Encoder<'_, D>,
501            offset: usize,
502            _depth: fidl::encoding::Depth,
503        ) -> fidl::Result<()> {
504            encoder.debug_check_bounds::<Self>(offset);
505            encoder.write_num(self.into_primitive(), offset);
506            Ok(())
507        }
508    }
509
510    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallState {
511        #[inline(always)]
512        fn new_empty() -> Self {
513            Self::unknown()
514        }
515
516        #[inline]
517        unsafe fn decode(
518            &mut self,
519            decoder: &mut fidl::encoding::Decoder<'_, D>,
520            offset: usize,
521            _depth: fidl::encoding::Depth,
522        ) -> fidl::Result<()> {
523            decoder.debug_check_bounds::<Self>(offset);
524            let prim = decoder.read_num::<u32>(offset);
525
526            *self = Self::from_primitive_allow_unknown(prim);
527            Ok(())
528        }
529    }
530    unsafe impl fidl::encoding::TypeMarker for DtmfCode {
531        type Owned = Self;
532
533        #[inline(always)]
534        fn inline_align(_context: fidl::encoding::Context) -> usize {
535            std::mem::align_of::<u8>()
536        }
537
538        #[inline(always)]
539        fn inline_size(_context: fidl::encoding::Context) -> usize {
540            std::mem::size_of::<u8>()
541        }
542
543        #[inline(always)]
544        fn encode_is_copy() -> bool {
545            true
546        }
547
548        #[inline(always)]
549        fn decode_is_copy() -> bool {
550            false
551        }
552    }
553
554    impl fidl::encoding::ValueTypeMarker for DtmfCode {
555        type Borrowed<'a> = Self;
556        #[inline(always)]
557        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
558            *value
559        }
560    }
561
562    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DtmfCode {
563        #[inline]
564        unsafe fn encode(
565            self,
566            encoder: &mut fidl::encoding::Encoder<'_, D>,
567            offset: usize,
568            _depth: fidl::encoding::Depth,
569        ) -> fidl::Result<()> {
570            encoder.debug_check_bounds::<Self>(offset);
571            encoder.write_num(self.into_primitive(), offset);
572            Ok(())
573        }
574    }
575
576    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DtmfCode {
577        #[inline(always)]
578        fn new_empty() -> Self {
579            Self::NumberSign
580        }
581
582        #[inline]
583        unsafe fn decode(
584            &mut self,
585            decoder: &mut fidl::encoding::Decoder<'_, D>,
586            offset: usize,
587            _depth: fidl::encoding::Depth,
588        ) -> fidl::Result<()> {
589            decoder.debug_check_bounds::<Self>(offset);
590            let prim = decoder.read_num::<u8>(offset);
591
592            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
593            Ok(())
594        }
595    }
596    unsafe impl fidl::encoding::TypeMarker for SignalStrength {
597        type Owned = Self;
598
599        #[inline(always)]
600        fn inline_align(_context: fidl::encoding::Context) -> usize {
601            std::mem::align_of::<i8>()
602        }
603
604        #[inline(always)]
605        fn inline_size(_context: fidl::encoding::Context) -> usize {
606            std::mem::size_of::<i8>()
607        }
608
609        #[inline(always)]
610        fn encode_is_copy() -> bool {
611            true
612        }
613
614        #[inline(always)]
615        fn decode_is_copy() -> bool {
616            false
617        }
618    }
619
620    impl fidl::encoding::ValueTypeMarker for SignalStrength {
621        type Borrowed<'a> = Self;
622        #[inline(always)]
623        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
624            *value
625        }
626    }
627
628    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SignalStrength {
629        #[inline]
630        unsafe fn encode(
631            self,
632            encoder: &mut fidl::encoding::Encoder<'_, D>,
633            offset: usize,
634            _depth: fidl::encoding::Depth,
635        ) -> fidl::Result<()> {
636            encoder.debug_check_bounds::<Self>(offset);
637            encoder.write_num(self.into_primitive(), offset);
638            Ok(())
639        }
640    }
641
642    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignalStrength {
643        #[inline(always)]
644        fn new_empty() -> Self {
645            Self::None
646        }
647
648        #[inline]
649        unsafe fn decode(
650            &mut self,
651            decoder: &mut fidl::encoding::Decoder<'_, D>,
652            offset: usize,
653            _depth: fidl::encoding::Depth,
654        ) -> fidl::Result<()> {
655            decoder.debug_check_bounds::<Self>(offset);
656            let prim = decoder.read_num::<i8>(offset);
657
658            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
659            Ok(())
660        }
661    }
662
663    impl fidl::encoding::ValueTypeMarker for CallSendDtmfCodeRequest {
664        type Borrowed<'a> = &'a Self;
665        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
666            value
667        }
668    }
669
670    unsafe impl fidl::encoding::TypeMarker for CallSendDtmfCodeRequest {
671        type Owned = Self;
672
673        #[inline(always)]
674        fn inline_align(_context: fidl::encoding::Context) -> usize {
675            1
676        }
677
678        #[inline(always)]
679        fn inline_size(_context: fidl::encoding::Context) -> usize {
680            1
681        }
682    }
683
684    unsafe impl<D: fidl::encoding::ResourceDialect>
685        fidl::encoding::Encode<CallSendDtmfCodeRequest, D> for &CallSendDtmfCodeRequest
686    {
687        #[inline]
688        unsafe fn encode(
689            self,
690            encoder: &mut fidl::encoding::Encoder<'_, D>,
691            offset: usize,
692            _depth: fidl::encoding::Depth,
693        ) -> fidl::Result<()> {
694            encoder.debug_check_bounds::<CallSendDtmfCodeRequest>(offset);
695            // Delegate to tuple encoding.
696            fidl::encoding::Encode::<CallSendDtmfCodeRequest, D>::encode(
697                (<DtmfCode as fidl::encoding::ValueTypeMarker>::borrow(&self.code),),
698                encoder,
699                offset,
700                _depth,
701            )
702        }
703    }
704    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DtmfCode, D>>
705        fidl::encoding::Encode<CallSendDtmfCodeRequest, D> for (T0,)
706    {
707        #[inline]
708        unsafe fn encode(
709            self,
710            encoder: &mut fidl::encoding::Encoder<'_, D>,
711            offset: usize,
712            depth: fidl::encoding::Depth,
713        ) -> fidl::Result<()> {
714            encoder.debug_check_bounds::<CallSendDtmfCodeRequest>(offset);
715            // Zero out padding regions. There's no need to apply masks
716            // because the unmasked parts will be overwritten by fields.
717            // Write the fields.
718            self.0.encode(encoder, offset + 0, depth)?;
719            Ok(())
720        }
721    }
722
723    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
724        for CallSendDtmfCodeRequest
725    {
726        #[inline(always)]
727        fn new_empty() -> Self {
728            Self { code: fidl::new_empty!(DtmfCode, D) }
729        }
730
731        #[inline]
732        unsafe fn decode(
733            &mut self,
734            decoder: &mut fidl::encoding::Decoder<'_, D>,
735            offset: usize,
736            _depth: fidl::encoding::Depth,
737        ) -> fidl::Result<()> {
738            decoder.debug_check_bounds::<Self>(offset);
739            // Verify that padding bytes are zero.
740            fidl::decode!(DtmfCode, D, &mut self.code, decoder, offset + 0, _depth)?;
741            Ok(())
742        }
743    }
744
745    impl fidl::encoding::ValueTypeMarker for CallWatchStateResponse {
746        type Borrowed<'a> = &'a Self;
747        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
748            value
749        }
750    }
751
752    unsafe impl fidl::encoding::TypeMarker for CallWatchStateResponse {
753        type Owned = Self;
754
755        #[inline(always)]
756        fn inline_align(_context: fidl::encoding::Context) -> usize {
757            4
758        }
759
760        #[inline(always)]
761        fn inline_size(_context: fidl::encoding::Context) -> usize {
762            4
763        }
764    }
765
766    unsafe impl<D: fidl::encoding::ResourceDialect>
767        fidl::encoding::Encode<CallWatchStateResponse, D> for &CallWatchStateResponse
768    {
769        #[inline]
770        unsafe fn encode(
771            self,
772            encoder: &mut fidl::encoding::Encoder<'_, D>,
773            offset: usize,
774            _depth: fidl::encoding::Depth,
775        ) -> fidl::Result<()> {
776            encoder.debug_check_bounds::<CallWatchStateResponse>(offset);
777            // Delegate to tuple encoding.
778            fidl::encoding::Encode::<CallWatchStateResponse, D>::encode(
779                (<CallState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
780                encoder,
781                offset,
782                _depth,
783            )
784        }
785    }
786    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CallState, D>>
787        fidl::encoding::Encode<CallWatchStateResponse, D> for (T0,)
788    {
789        #[inline]
790        unsafe fn encode(
791            self,
792            encoder: &mut fidl::encoding::Encoder<'_, D>,
793            offset: usize,
794            depth: fidl::encoding::Depth,
795        ) -> fidl::Result<()> {
796            encoder.debug_check_bounds::<CallWatchStateResponse>(offset);
797            // Zero out padding regions. There's no need to apply masks
798            // because the unmasked parts will be overwritten by fields.
799            // Write the fields.
800            self.0.encode(encoder, offset + 0, depth)?;
801            Ok(())
802        }
803    }
804
805    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
806        for CallWatchStateResponse
807    {
808        #[inline(always)]
809        fn new_empty() -> Self {
810            Self { state: fidl::new_empty!(CallState, D) }
811        }
812
813        #[inline]
814        unsafe fn decode(
815            &mut self,
816            decoder: &mut fidl::encoding::Decoder<'_, D>,
817            offset: usize,
818            _depth: fidl::encoding::Depth,
819        ) -> fidl::Result<()> {
820            decoder.debug_check_bounds::<Self>(offset);
821            // Verify that padding bytes are zero.
822            fidl::decode!(CallState, D, &mut self.state, decoder, offset + 0, _depth)?;
823            Ok(())
824        }
825    }
826
827    impl fidl::encoding::ValueTypeMarker for HeadsetGainSetMicrophoneGainRequest {
828        type Borrowed<'a> = &'a Self;
829        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
830            value
831        }
832    }
833
834    unsafe impl fidl::encoding::TypeMarker for HeadsetGainSetMicrophoneGainRequest {
835        type Owned = Self;
836
837        #[inline(always)]
838        fn inline_align(_context: fidl::encoding::Context) -> usize {
839            1
840        }
841
842        #[inline(always)]
843        fn inline_size(_context: fidl::encoding::Context) -> usize {
844            1
845        }
846        #[inline(always)]
847        fn encode_is_copy() -> bool {
848            true
849        }
850
851        #[inline(always)]
852        fn decode_is_copy() -> bool {
853            true
854        }
855    }
856
857    unsafe impl<D: fidl::encoding::ResourceDialect>
858        fidl::encoding::Encode<HeadsetGainSetMicrophoneGainRequest, D>
859        for &HeadsetGainSetMicrophoneGainRequest
860    {
861        #[inline]
862        unsafe fn encode(
863            self,
864            encoder: &mut fidl::encoding::Encoder<'_, D>,
865            offset: usize,
866            _depth: fidl::encoding::Depth,
867        ) -> fidl::Result<()> {
868            encoder.debug_check_bounds::<HeadsetGainSetMicrophoneGainRequest>(offset);
869            unsafe {
870                // Copy the object into the buffer.
871                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
872                (buf_ptr as *mut HeadsetGainSetMicrophoneGainRequest)
873                    .write_unaligned((self as *const HeadsetGainSetMicrophoneGainRequest).read());
874                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
875                // done second because the memcpy will write garbage to these bytes.
876            }
877            Ok(())
878        }
879    }
880    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
881        fidl::encoding::Encode<HeadsetGainSetMicrophoneGainRequest, D> for (T0,)
882    {
883        #[inline]
884        unsafe fn encode(
885            self,
886            encoder: &mut fidl::encoding::Encoder<'_, D>,
887            offset: usize,
888            depth: fidl::encoding::Depth,
889        ) -> fidl::Result<()> {
890            encoder.debug_check_bounds::<HeadsetGainSetMicrophoneGainRequest>(offset);
891            // Zero out padding regions. There's no need to apply masks
892            // because the unmasked parts will be overwritten by fields.
893            // Write the fields.
894            self.0.encode(encoder, offset + 0, depth)?;
895            Ok(())
896        }
897    }
898
899    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
900        for HeadsetGainSetMicrophoneGainRequest
901    {
902        #[inline(always)]
903        fn new_empty() -> Self {
904            Self { requested: fidl::new_empty!(u8, D) }
905        }
906
907        #[inline]
908        unsafe fn decode(
909            &mut self,
910            decoder: &mut fidl::encoding::Decoder<'_, D>,
911            offset: usize,
912            _depth: fidl::encoding::Depth,
913        ) -> fidl::Result<()> {
914            decoder.debug_check_bounds::<Self>(offset);
915            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
916            // Verify that padding bytes are zero.
917            // Copy from the buffer into the object.
918            unsafe {
919                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
920            }
921            Ok(())
922        }
923    }
924
925    impl fidl::encoding::ValueTypeMarker for HeadsetGainSetSpeakerGainRequest {
926        type Borrowed<'a> = &'a Self;
927        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
928            value
929        }
930    }
931
932    unsafe impl fidl::encoding::TypeMarker for HeadsetGainSetSpeakerGainRequest {
933        type Owned = Self;
934
935        #[inline(always)]
936        fn inline_align(_context: fidl::encoding::Context) -> usize {
937            1
938        }
939
940        #[inline(always)]
941        fn inline_size(_context: fidl::encoding::Context) -> usize {
942            1
943        }
944        #[inline(always)]
945        fn encode_is_copy() -> bool {
946            true
947        }
948
949        #[inline(always)]
950        fn decode_is_copy() -> bool {
951            true
952        }
953    }
954
955    unsafe impl<D: fidl::encoding::ResourceDialect>
956        fidl::encoding::Encode<HeadsetGainSetSpeakerGainRequest, D>
957        for &HeadsetGainSetSpeakerGainRequest
958    {
959        #[inline]
960        unsafe fn encode(
961            self,
962            encoder: &mut fidl::encoding::Encoder<'_, D>,
963            offset: usize,
964            _depth: fidl::encoding::Depth,
965        ) -> fidl::Result<()> {
966            encoder.debug_check_bounds::<HeadsetGainSetSpeakerGainRequest>(offset);
967            unsafe {
968                // Copy the object into the buffer.
969                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
970                (buf_ptr as *mut HeadsetGainSetSpeakerGainRequest)
971                    .write_unaligned((self as *const HeadsetGainSetSpeakerGainRequest).read());
972                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
973                // done second because the memcpy will write garbage to these bytes.
974            }
975            Ok(())
976        }
977    }
978    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
979        fidl::encoding::Encode<HeadsetGainSetSpeakerGainRequest, D> for (T0,)
980    {
981        #[inline]
982        unsafe fn encode(
983            self,
984            encoder: &mut fidl::encoding::Encoder<'_, D>,
985            offset: usize,
986            depth: fidl::encoding::Depth,
987        ) -> fidl::Result<()> {
988            encoder.debug_check_bounds::<HeadsetGainSetSpeakerGainRequest>(offset);
989            // Zero out padding regions. There's no need to apply masks
990            // because the unmasked parts will be overwritten by fields.
991            // Write the fields.
992            self.0.encode(encoder, offset + 0, depth)?;
993            Ok(())
994        }
995    }
996
997    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
998        for HeadsetGainSetSpeakerGainRequest
999    {
1000        #[inline(always)]
1001        fn new_empty() -> Self {
1002            Self { requested: fidl::new_empty!(u8, D) }
1003        }
1004
1005        #[inline]
1006        unsafe fn decode(
1007            &mut self,
1008            decoder: &mut fidl::encoding::Decoder<'_, D>,
1009            offset: usize,
1010            _depth: fidl::encoding::Depth,
1011        ) -> fidl::Result<()> {
1012            decoder.debug_check_bounds::<Self>(offset);
1013            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1014            // Verify that padding bytes are zero.
1015            // Copy from the buffer into the object.
1016            unsafe {
1017                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1018            }
1019            Ok(())
1020        }
1021    }
1022
1023    impl fidl::encoding::ValueTypeMarker for HeadsetGainWatchMicrophoneGainResponse {
1024        type Borrowed<'a> = &'a Self;
1025        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1026            value
1027        }
1028    }
1029
1030    unsafe impl fidl::encoding::TypeMarker for HeadsetGainWatchMicrophoneGainResponse {
1031        type Owned = Self;
1032
1033        #[inline(always)]
1034        fn inline_align(_context: fidl::encoding::Context) -> usize {
1035            1
1036        }
1037
1038        #[inline(always)]
1039        fn inline_size(_context: fidl::encoding::Context) -> usize {
1040            1
1041        }
1042        #[inline(always)]
1043        fn encode_is_copy() -> bool {
1044            true
1045        }
1046
1047        #[inline(always)]
1048        fn decode_is_copy() -> bool {
1049            true
1050        }
1051    }
1052
1053    unsafe impl<D: fidl::encoding::ResourceDialect>
1054        fidl::encoding::Encode<HeadsetGainWatchMicrophoneGainResponse, D>
1055        for &HeadsetGainWatchMicrophoneGainResponse
1056    {
1057        #[inline]
1058        unsafe fn encode(
1059            self,
1060            encoder: &mut fidl::encoding::Encoder<'_, D>,
1061            offset: usize,
1062            _depth: fidl::encoding::Depth,
1063        ) -> fidl::Result<()> {
1064            encoder.debug_check_bounds::<HeadsetGainWatchMicrophoneGainResponse>(offset);
1065            unsafe {
1066                // Copy the object into the buffer.
1067                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1068                (buf_ptr as *mut HeadsetGainWatchMicrophoneGainResponse).write_unaligned(
1069                    (self as *const HeadsetGainWatchMicrophoneGainResponse).read(),
1070                );
1071                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1072                // done second because the memcpy will write garbage to these bytes.
1073            }
1074            Ok(())
1075        }
1076    }
1077    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1078        fidl::encoding::Encode<HeadsetGainWatchMicrophoneGainResponse, D> for (T0,)
1079    {
1080        #[inline]
1081        unsafe fn encode(
1082            self,
1083            encoder: &mut fidl::encoding::Encoder<'_, D>,
1084            offset: usize,
1085            depth: fidl::encoding::Depth,
1086        ) -> fidl::Result<()> {
1087            encoder.debug_check_bounds::<HeadsetGainWatchMicrophoneGainResponse>(offset);
1088            // Zero out padding regions. There's no need to apply masks
1089            // because the unmasked parts will be overwritten by fields.
1090            // Write the fields.
1091            self.0.encode(encoder, offset + 0, depth)?;
1092            Ok(())
1093        }
1094    }
1095
1096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1097        for HeadsetGainWatchMicrophoneGainResponse
1098    {
1099        #[inline(always)]
1100        fn new_empty() -> Self {
1101            Self { gain: fidl::new_empty!(u8, D) }
1102        }
1103
1104        #[inline]
1105        unsafe fn decode(
1106            &mut self,
1107            decoder: &mut fidl::encoding::Decoder<'_, D>,
1108            offset: usize,
1109            _depth: fidl::encoding::Depth,
1110        ) -> fidl::Result<()> {
1111            decoder.debug_check_bounds::<Self>(offset);
1112            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1113            // Verify that padding bytes are zero.
1114            // Copy from the buffer into the object.
1115            unsafe {
1116                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1117            }
1118            Ok(())
1119        }
1120    }
1121
1122    impl fidl::encoding::ValueTypeMarker for HeadsetGainWatchSpeakerGainResponse {
1123        type Borrowed<'a> = &'a Self;
1124        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1125            value
1126        }
1127    }
1128
1129    unsafe impl fidl::encoding::TypeMarker for HeadsetGainWatchSpeakerGainResponse {
1130        type Owned = Self;
1131
1132        #[inline(always)]
1133        fn inline_align(_context: fidl::encoding::Context) -> usize {
1134            1
1135        }
1136
1137        #[inline(always)]
1138        fn inline_size(_context: fidl::encoding::Context) -> usize {
1139            1
1140        }
1141        #[inline(always)]
1142        fn encode_is_copy() -> bool {
1143            true
1144        }
1145
1146        #[inline(always)]
1147        fn decode_is_copy() -> bool {
1148            true
1149        }
1150    }
1151
1152    unsafe impl<D: fidl::encoding::ResourceDialect>
1153        fidl::encoding::Encode<HeadsetGainWatchSpeakerGainResponse, D>
1154        for &HeadsetGainWatchSpeakerGainResponse
1155    {
1156        #[inline]
1157        unsafe fn encode(
1158            self,
1159            encoder: &mut fidl::encoding::Encoder<'_, D>,
1160            offset: usize,
1161            _depth: fidl::encoding::Depth,
1162        ) -> fidl::Result<()> {
1163            encoder.debug_check_bounds::<HeadsetGainWatchSpeakerGainResponse>(offset);
1164            unsafe {
1165                // Copy the object into the buffer.
1166                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1167                (buf_ptr as *mut HeadsetGainWatchSpeakerGainResponse)
1168                    .write_unaligned((self as *const HeadsetGainWatchSpeakerGainResponse).read());
1169                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1170                // done second because the memcpy will write garbage to these bytes.
1171            }
1172            Ok(())
1173        }
1174    }
1175    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1176        fidl::encoding::Encode<HeadsetGainWatchSpeakerGainResponse, D> for (T0,)
1177    {
1178        #[inline]
1179        unsafe fn encode(
1180            self,
1181            encoder: &mut fidl::encoding::Encoder<'_, D>,
1182            offset: usize,
1183            depth: fidl::encoding::Depth,
1184        ) -> fidl::Result<()> {
1185            encoder.debug_check_bounds::<HeadsetGainWatchSpeakerGainResponse>(offset);
1186            // Zero out padding regions. There's no need to apply masks
1187            // because the unmasked parts will be overwritten by fields.
1188            // Write the fields.
1189            self.0.encode(encoder, offset + 0, depth)?;
1190            Ok(())
1191        }
1192    }
1193
1194    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1195        for HeadsetGainWatchSpeakerGainResponse
1196    {
1197        #[inline(always)]
1198        fn new_empty() -> Self {
1199            Self { gain: fidl::new_empty!(u8, D) }
1200        }
1201
1202        #[inline]
1203        unsafe fn decode(
1204            &mut self,
1205            decoder: &mut fidl::encoding::Decoder<'_, D>,
1206            offset: usize,
1207            _depth: fidl::encoding::Depth,
1208        ) -> fidl::Result<()> {
1209            decoder.debug_check_bounds::<Self>(offset);
1210            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1211            // Verify that padding bytes are zero.
1212            // Copy from the buffer into the object.
1213            unsafe {
1214                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1215            }
1216            Ok(())
1217        }
1218    }
1219
1220    impl fidl::encoding::ValueTypeMarker for PeerHandlerQueryOperatorResponse {
1221        type Borrowed<'a> = &'a Self;
1222        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1223            value
1224        }
1225    }
1226
1227    unsafe impl fidl::encoding::TypeMarker for PeerHandlerQueryOperatorResponse {
1228        type Owned = Self;
1229
1230        #[inline(always)]
1231        fn inline_align(_context: fidl::encoding::Context) -> usize {
1232            8
1233        }
1234
1235        #[inline(always)]
1236        fn inline_size(_context: fidl::encoding::Context) -> usize {
1237            16
1238        }
1239    }
1240
1241    unsafe impl<D: fidl::encoding::ResourceDialect>
1242        fidl::encoding::Encode<PeerHandlerQueryOperatorResponse, D>
1243        for &PeerHandlerQueryOperatorResponse
1244    {
1245        #[inline]
1246        unsafe fn encode(
1247            self,
1248            encoder: &mut fidl::encoding::Encoder<'_, D>,
1249            offset: usize,
1250            _depth: fidl::encoding::Depth,
1251        ) -> fidl::Result<()> {
1252            encoder.debug_check_bounds::<PeerHandlerQueryOperatorResponse>(offset);
1253            // Delegate to tuple encoding.
1254            fidl::encoding::Encode::<PeerHandlerQueryOperatorResponse, D>::encode(
1255                (
1256                    <fidl::encoding::Optional<fidl::encoding::BoundedString<16>> as fidl::encoding::ValueTypeMarker>::borrow(&self.operator),
1257                ),
1258                encoder, offset, _depth
1259            )
1260        }
1261    }
1262    unsafe impl<
1263            D: fidl::encoding::ResourceDialect,
1264            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<16>>, D>,
1265        > fidl::encoding::Encode<PeerHandlerQueryOperatorResponse, D> for (T0,)
1266    {
1267        #[inline]
1268        unsafe fn encode(
1269            self,
1270            encoder: &mut fidl::encoding::Encoder<'_, D>,
1271            offset: usize,
1272            depth: fidl::encoding::Depth,
1273        ) -> fidl::Result<()> {
1274            encoder.debug_check_bounds::<PeerHandlerQueryOperatorResponse>(offset);
1275            // Zero out padding regions. There's no need to apply masks
1276            // because the unmasked parts will be overwritten by fields.
1277            // Write the fields.
1278            self.0.encode(encoder, offset + 0, depth)?;
1279            Ok(())
1280        }
1281    }
1282
1283    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1284        for PeerHandlerQueryOperatorResponse
1285    {
1286        #[inline(always)]
1287        fn new_empty() -> Self {
1288            Self {
1289                operator: fidl::new_empty!(
1290                    fidl::encoding::Optional<fidl::encoding::BoundedString<16>>,
1291                    D
1292                ),
1293            }
1294        }
1295
1296        #[inline]
1297        unsafe fn decode(
1298            &mut self,
1299            decoder: &mut fidl::encoding::Decoder<'_, D>,
1300            offset: usize,
1301            _depth: fidl::encoding::Depth,
1302        ) -> fidl::Result<()> {
1303            decoder.debug_check_bounds::<Self>(offset);
1304            // Verify that padding bytes are zero.
1305            fidl::decode!(
1306                fidl::encoding::Optional<fidl::encoding::BoundedString<16>>,
1307                D,
1308                &mut self.operator,
1309                decoder,
1310                offset + 0,
1311                _depth
1312            )?;
1313            Ok(())
1314        }
1315    }
1316
1317    impl fidl::encoding::ValueTypeMarker for PeerHandlerReportHeadsetBatteryLevelRequest {
1318        type Borrowed<'a> = &'a Self;
1319        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1320            value
1321        }
1322    }
1323
1324    unsafe impl fidl::encoding::TypeMarker for PeerHandlerReportHeadsetBatteryLevelRequest {
1325        type Owned = Self;
1326
1327        #[inline(always)]
1328        fn inline_align(_context: fidl::encoding::Context) -> usize {
1329            1
1330        }
1331
1332        #[inline(always)]
1333        fn inline_size(_context: fidl::encoding::Context) -> usize {
1334            1
1335        }
1336        #[inline(always)]
1337        fn encode_is_copy() -> bool {
1338            true
1339        }
1340
1341        #[inline(always)]
1342        fn decode_is_copy() -> bool {
1343            true
1344        }
1345    }
1346
1347    unsafe impl<D: fidl::encoding::ResourceDialect>
1348        fidl::encoding::Encode<PeerHandlerReportHeadsetBatteryLevelRequest, D>
1349        for &PeerHandlerReportHeadsetBatteryLevelRequest
1350    {
1351        #[inline]
1352        unsafe fn encode(
1353            self,
1354            encoder: &mut fidl::encoding::Encoder<'_, D>,
1355            offset: usize,
1356            _depth: fidl::encoding::Depth,
1357        ) -> fidl::Result<()> {
1358            encoder.debug_check_bounds::<PeerHandlerReportHeadsetBatteryLevelRequest>(offset);
1359            unsafe {
1360                // Copy the object into the buffer.
1361                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1362                (buf_ptr as *mut PeerHandlerReportHeadsetBatteryLevelRequest).write_unaligned(
1363                    (self as *const PeerHandlerReportHeadsetBatteryLevelRequest).read(),
1364                );
1365                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1366                // done second because the memcpy will write garbage to these bytes.
1367            }
1368            Ok(())
1369        }
1370    }
1371    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1372        fidl::encoding::Encode<PeerHandlerReportHeadsetBatteryLevelRequest, D> for (T0,)
1373    {
1374        #[inline]
1375        unsafe fn encode(
1376            self,
1377            encoder: &mut fidl::encoding::Encoder<'_, D>,
1378            offset: usize,
1379            depth: fidl::encoding::Depth,
1380        ) -> fidl::Result<()> {
1381            encoder.debug_check_bounds::<PeerHandlerReportHeadsetBatteryLevelRequest>(offset);
1382            // Zero out padding regions. There's no need to apply masks
1383            // because the unmasked parts will be overwritten by fields.
1384            // Write the fields.
1385            self.0.encode(encoder, offset + 0, depth)?;
1386            Ok(())
1387        }
1388    }
1389
1390    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1391        for PeerHandlerReportHeadsetBatteryLevelRequest
1392    {
1393        #[inline(always)]
1394        fn new_empty() -> Self {
1395            Self { level: fidl::new_empty!(u8, D) }
1396        }
1397
1398        #[inline]
1399        unsafe fn decode(
1400            &mut self,
1401            decoder: &mut fidl::encoding::Decoder<'_, D>,
1402            offset: usize,
1403            _depth: fidl::encoding::Depth,
1404        ) -> fidl::Result<()> {
1405            decoder.debug_check_bounds::<Self>(offset);
1406            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1407            // Verify that padding bytes are zero.
1408            // Copy from the buffer into the object.
1409            unsafe {
1410                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1411            }
1412            Ok(())
1413        }
1414    }
1415
1416    impl fidl::encoding::ValueTypeMarker for PeerHandlerRequestOutgoingCallRequest {
1417        type Borrowed<'a> = &'a Self;
1418        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1419            value
1420        }
1421    }
1422
1423    unsafe impl fidl::encoding::TypeMarker for PeerHandlerRequestOutgoingCallRequest {
1424        type Owned = Self;
1425
1426        #[inline(always)]
1427        fn inline_align(_context: fidl::encoding::Context) -> usize {
1428            8
1429        }
1430
1431        #[inline(always)]
1432        fn inline_size(_context: fidl::encoding::Context) -> usize {
1433            16
1434        }
1435    }
1436
1437    unsafe impl<D: fidl::encoding::ResourceDialect>
1438        fidl::encoding::Encode<PeerHandlerRequestOutgoingCallRequest, D>
1439        for &PeerHandlerRequestOutgoingCallRequest
1440    {
1441        #[inline]
1442        unsafe fn encode(
1443            self,
1444            encoder: &mut fidl::encoding::Encoder<'_, D>,
1445            offset: usize,
1446            _depth: fidl::encoding::Depth,
1447        ) -> fidl::Result<()> {
1448            encoder.debug_check_bounds::<PeerHandlerRequestOutgoingCallRequest>(offset);
1449            // Delegate to tuple encoding.
1450            fidl::encoding::Encode::<PeerHandlerRequestOutgoingCallRequest, D>::encode(
1451                (<CallAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
1452                encoder,
1453                offset,
1454                _depth,
1455            )
1456        }
1457    }
1458    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CallAction, D>>
1459        fidl::encoding::Encode<PeerHandlerRequestOutgoingCallRequest, D> for (T0,)
1460    {
1461        #[inline]
1462        unsafe fn encode(
1463            self,
1464            encoder: &mut fidl::encoding::Encoder<'_, D>,
1465            offset: usize,
1466            depth: fidl::encoding::Depth,
1467        ) -> fidl::Result<()> {
1468            encoder.debug_check_bounds::<PeerHandlerRequestOutgoingCallRequest>(offset);
1469            // Zero out padding regions. There's no need to apply masks
1470            // because the unmasked parts will be overwritten by fields.
1471            // Write the fields.
1472            self.0.encode(encoder, offset + 0, depth)?;
1473            Ok(())
1474        }
1475    }
1476
1477    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1478        for PeerHandlerRequestOutgoingCallRequest
1479    {
1480        #[inline(always)]
1481        fn new_empty() -> Self {
1482            Self { action: fidl::new_empty!(CallAction, D) }
1483        }
1484
1485        #[inline]
1486        unsafe fn decode(
1487            &mut self,
1488            decoder: &mut fidl::encoding::Decoder<'_, D>,
1489            offset: usize,
1490            _depth: fidl::encoding::Depth,
1491        ) -> fidl::Result<()> {
1492            decoder.debug_check_bounds::<Self>(offset);
1493            // Verify that padding bytes are zero.
1494            fidl::decode!(CallAction, D, &mut self.action, decoder, offset + 0, _depth)?;
1495            Ok(())
1496        }
1497    }
1498
1499    impl fidl::encoding::ValueTypeMarker for PeerHandlerSetNrecModeRequest {
1500        type Borrowed<'a> = &'a Self;
1501        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1502            value
1503        }
1504    }
1505
1506    unsafe impl fidl::encoding::TypeMarker for PeerHandlerSetNrecModeRequest {
1507        type Owned = Self;
1508
1509        #[inline(always)]
1510        fn inline_align(_context: fidl::encoding::Context) -> usize {
1511            1
1512        }
1513
1514        #[inline(always)]
1515        fn inline_size(_context: fidl::encoding::Context) -> usize {
1516            1
1517        }
1518    }
1519
1520    unsafe impl<D: fidl::encoding::ResourceDialect>
1521        fidl::encoding::Encode<PeerHandlerSetNrecModeRequest, D>
1522        for &PeerHandlerSetNrecModeRequest
1523    {
1524        #[inline]
1525        unsafe fn encode(
1526            self,
1527            encoder: &mut fidl::encoding::Encoder<'_, D>,
1528            offset: usize,
1529            _depth: fidl::encoding::Depth,
1530        ) -> fidl::Result<()> {
1531            encoder.debug_check_bounds::<PeerHandlerSetNrecModeRequest>(offset);
1532            // Delegate to tuple encoding.
1533            fidl::encoding::Encode::<PeerHandlerSetNrecModeRequest, D>::encode(
1534                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
1535                encoder,
1536                offset,
1537                _depth,
1538            )
1539        }
1540    }
1541    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1542        fidl::encoding::Encode<PeerHandlerSetNrecModeRequest, D> for (T0,)
1543    {
1544        #[inline]
1545        unsafe fn encode(
1546            self,
1547            encoder: &mut fidl::encoding::Encoder<'_, D>,
1548            offset: usize,
1549            depth: fidl::encoding::Depth,
1550        ) -> fidl::Result<()> {
1551            encoder.debug_check_bounds::<PeerHandlerSetNrecModeRequest>(offset);
1552            // Zero out padding regions. There's no need to apply masks
1553            // because the unmasked parts will be overwritten by fields.
1554            // Write the fields.
1555            self.0.encode(encoder, offset + 0, depth)?;
1556            Ok(())
1557        }
1558    }
1559
1560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1561        for PeerHandlerSetNrecModeRequest
1562    {
1563        #[inline(always)]
1564        fn new_empty() -> Self {
1565            Self { enabled: fidl::new_empty!(bool, D) }
1566        }
1567
1568        #[inline]
1569        unsafe fn decode(
1570            &mut self,
1571            decoder: &mut fidl::encoding::Decoder<'_, D>,
1572            offset: usize,
1573            _depth: fidl::encoding::Depth,
1574        ) -> fidl::Result<()> {
1575            decoder.debug_check_bounds::<Self>(offset);
1576            // Verify that padding bytes are zero.
1577            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
1578            Ok(())
1579        }
1580    }
1581
1582    impl fidl::encoding::ValueTypeMarker for PeerHandlerSubscriberNumberInformationResponse {
1583        type Borrowed<'a> = &'a Self;
1584        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1585            value
1586        }
1587    }
1588
1589    unsafe impl fidl::encoding::TypeMarker for PeerHandlerSubscriberNumberInformationResponse {
1590        type Owned = Self;
1591
1592        #[inline(always)]
1593        fn inline_align(_context: fidl::encoding::Context) -> usize {
1594            8
1595        }
1596
1597        #[inline(always)]
1598        fn inline_size(_context: fidl::encoding::Context) -> usize {
1599            16
1600        }
1601    }
1602
1603    unsafe impl<D: fidl::encoding::ResourceDialect>
1604        fidl::encoding::Encode<PeerHandlerSubscriberNumberInformationResponse, D>
1605        for &PeerHandlerSubscriberNumberInformationResponse
1606    {
1607        #[inline]
1608        unsafe fn encode(
1609            self,
1610            encoder: &mut fidl::encoding::Encoder<'_, D>,
1611            offset: usize,
1612            _depth: fidl::encoding::Depth,
1613        ) -> fidl::Result<()> {
1614            encoder.debug_check_bounds::<PeerHandlerSubscriberNumberInformationResponse>(offset);
1615            // Delegate to tuple encoding.
1616            fidl::encoding::Encode::<PeerHandlerSubscriberNumberInformationResponse, D>::encode(
1617                (
1618                    <fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.numbers),
1619                ),
1620                encoder, offset, _depth
1621            )
1622        }
1623    }
1624    unsafe impl<
1625            D: fidl::encoding::ResourceDialect,
1626            T0: fidl::encoding::Encode<
1627                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1628                D,
1629            >,
1630        > fidl::encoding::Encode<PeerHandlerSubscriberNumberInformationResponse, D> for (T0,)
1631    {
1632        #[inline]
1633        unsafe fn encode(
1634            self,
1635            encoder: &mut fidl::encoding::Encoder<'_, D>,
1636            offset: usize,
1637            depth: fidl::encoding::Depth,
1638        ) -> fidl::Result<()> {
1639            encoder.debug_check_bounds::<PeerHandlerSubscriberNumberInformationResponse>(offset);
1640            // Zero out padding regions. There's no need to apply masks
1641            // because the unmasked parts will be overwritten by fields.
1642            // Write the fields.
1643            self.0.encode(encoder, offset + 0, depth)?;
1644            Ok(())
1645        }
1646    }
1647
1648    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1649        for PeerHandlerSubscriberNumberInformationResponse
1650    {
1651        #[inline(always)]
1652        fn new_empty() -> Self {
1653            Self {
1654                numbers: fidl::new_empty!(
1655                    fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1656                    D
1657                ),
1658            }
1659        }
1660
1661        #[inline]
1662        unsafe fn decode(
1663            &mut self,
1664            decoder: &mut fidl::encoding::Decoder<'_, D>,
1665            offset: usize,
1666            _depth: fidl::encoding::Depth,
1667        ) -> fidl::Result<()> {
1668            decoder.debug_check_bounds::<Self>(offset);
1669            // Verify that padding bytes are zero.
1670            fidl::decode!(
1671                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1672                D,
1673                &mut self.numbers,
1674                decoder,
1675                offset + 0,
1676                _depth
1677            )?;
1678            Ok(())
1679        }
1680    }
1681
1682    impl fidl::encoding::ValueTypeMarker for PeerHandlerWatchNetworkInformationResponse {
1683        type Borrowed<'a> = &'a Self;
1684        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1685            value
1686        }
1687    }
1688
1689    unsafe impl fidl::encoding::TypeMarker for PeerHandlerWatchNetworkInformationResponse {
1690        type Owned = Self;
1691
1692        #[inline(always)]
1693        fn inline_align(_context: fidl::encoding::Context) -> usize {
1694            8
1695        }
1696
1697        #[inline(always)]
1698        fn inline_size(_context: fidl::encoding::Context) -> usize {
1699            16
1700        }
1701    }
1702
1703    unsafe impl<D: fidl::encoding::ResourceDialect>
1704        fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, D>
1705        for &PeerHandlerWatchNetworkInformationResponse
1706    {
1707        #[inline]
1708        unsafe fn encode(
1709            self,
1710            encoder: &mut fidl::encoding::Encoder<'_, D>,
1711            offset: usize,
1712            _depth: fidl::encoding::Depth,
1713        ) -> fidl::Result<()> {
1714            encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
1715            // Delegate to tuple encoding.
1716            fidl::encoding::Encode::<PeerHandlerWatchNetworkInformationResponse, D>::encode(
1717                (<NetworkInformation as fidl::encoding::ValueTypeMarker>::borrow(&self.update),),
1718                encoder,
1719                offset,
1720                _depth,
1721            )
1722        }
1723    }
1724    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkInformation, D>>
1725        fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, D> for (T0,)
1726    {
1727        #[inline]
1728        unsafe fn encode(
1729            self,
1730            encoder: &mut fidl::encoding::Encoder<'_, D>,
1731            offset: usize,
1732            depth: fidl::encoding::Depth,
1733        ) -> fidl::Result<()> {
1734            encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
1735            // Zero out padding regions. There's no need to apply masks
1736            // because the unmasked parts will be overwritten by fields.
1737            // Write the fields.
1738            self.0.encode(encoder, offset + 0, depth)?;
1739            Ok(())
1740        }
1741    }
1742
1743    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1744        for PeerHandlerWatchNetworkInformationResponse
1745    {
1746        #[inline(always)]
1747        fn new_empty() -> Self {
1748            Self { update: fidl::new_empty!(NetworkInformation, D) }
1749        }
1750
1751        #[inline]
1752        unsafe fn decode(
1753            &mut self,
1754            decoder: &mut fidl::encoding::Decoder<'_, D>,
1755            offset: usize,
1756            _depth: fidl::encoding::Depth,
1757        ) -> fidl::Result<()> {
1758            decoder.debug_check_bounds::<Self>(offset);
1759            // Verify that padding bytes are zero.
1760            fidl::decode!(NetworkInformation, D, &mut self.update, decoder, offset + 0, _depth)?;
1761            Ok(())
1762        }
1763    }
1764
1765    impl fidl::encoding::ValueTypeMarker for RedialLast {
1766        type Borrowed<'a> = &'a Self;
1767        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1768            value
1769        }
1770    }
1771
1772    unsafe impl fidl::encoding::TypeMarker for RedialLast {
1773        type Owned = Self;
1774
1775        #[inline(always)]
1776        fn inline_align(_context: fidl::encoding::Context) -> usize {
1777            1
1778        }
1779
1780        #[inline(always)]
1781        fn inline_size(_context: fidl::encoding::Context) -> usize {
1782            1
1783        }
1784    }
1785
1786    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RedialLast, D>
1787        for &RedialLast
1788    {
1789        #[inline]
1790        unsafe fn encode(
1791            self,
1792            encoder: &mut fidl::encoding::Encoder<'_, D>,
1793            offset: usize,
1794            _depth: fidl::encoding::Depth,
1795        ) -> fidl::Result<()> {
1796            encoder.debug_check_bounds::<RedialLast>(offset);
1797            encoder.write_num(0u8, offset);
1798            Ok(())
1799        }
1800    }
1801
1802    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RedialLast {
1803        #[inline(always)]
1804        fn new_empty() -> Self {
1805            Self
1806        }
1807
1808        #[inline]
1809        unsafe fn decode(
1810            &mut self,
1811            decoder: &mut fidl::encoding::Decoder<'_, D>,
1812            offset: usize,
1813            _depth: fidl::encoding::Depth,
1814        ) -> fidl::Result<()> {
1815            decoder.debug_check_bounds::<Self>(offset);
1816            match decoder.read_num::<u8>(offset) {
1817                0 => Ok(()),
1818                _ => Err(fidl::Error::Invalid),
1819            }
1820        }
1821    }
1822
1823    impl fidl::encoding::ValueTypeMarker for TransferActive {
1824        type Borrowed<'a> = &'a Self;
1825        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1826            value
1827        }
1828    }
1829
1830    unsafe impl fidl::encoding::TypeMarker for TransferActive {
1831        type Owned = Self;
1832
1833        #[inline(always)]
1834        fn inline_align(_context: fidl::encoding::Context) -> usize {
1835            1
1836        }
1837
1838        #[inline(always)]
1839        fn inline_size(_context: fidl::encoding::Context) -> usize {
1840            1
1841        }
1842    }
1843
1844    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransferActive, D>
1845        for &TransferActive
1846    {
1847        #[inline]
1848        unsafe fn encode(
1849            self,
1850            encoder: &mut fidl::encoding::Encoder<'_, D>,
1851            offset: usize,
1852            _depth: fidl::encoding::Depth,
1853        ) -> fidl::Result<()> {
1854            encoder.debug_check_bounds::<TransferActive>(offset);
1855            encoder.write_num(0u8, offset);
1856            Ok(())
1857        }
1858    }
1859
1860    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransferActive {
1861        #[inline(always)]
1862        fn new_empty() -> Self {
1863            Self
1864        }
1865
1866        #[inline]
1867        unsafe fn decode(
1868            &mut self,
1869            decoder: &mut fidl::encoding::Decoder<'_, D>,
1870            offset: usize,
1871            _depth: fidl::encoding::Depth,
1872        ) -> fidl::Result<()> {
1873            decoder.debug_check_bounds::<Self>(offset);
1874            match decoder.read_num::<u8>(offset) {
1875                0 => Ok(()),
1876                _ => Err(fidl::Error::Invalid),
1877            }
1878        }
1879    }
1880
1881    impl NetworkInformation {
1882        #[inline(always)]
1883        fn max_ordinal_present(&self) -> u64 {
1884            if let Some(_) = self.roaming {
1885                return 3;
1886            }
1887            if let Some(_) = self.signal_strength {
1888                return 2;
1889            }
1890            if let Some(_) = self.service_available {
1891                return 1;
1892            }
1893            0
1894        }
1895    }
1896
1897    impl fidl::encoding::ValueTypeMarker for NetworkInformation {
1898        type Borrowed<'a> = &'a Self;
1899        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1900            value
1901        }
1902    }
1903
1904    unsafe impl fidl::encoding::TypeMarker for NetworkInformation {
1905        type Owned = Self;
1906
1907        #[inline(always)]
1908        fn inline_align(_context: fidl::encoding::Context) -> usize {
1909            8
1910        }
1911
1912        #[inline(always)]
1913        fn inline_size(_context: fidl::encoding::Context) -> usize {
1914            16
1915        }
1916    }
1917
1918    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkInformation, D>
1919        for &NetworkInformation
1920    {
1921        unsafe fn encode(
1922            self,
1923            encoder: &mut fidl::encoding::Encoder<'_, D>,
1924            offset: usize,
1925            mut depth: fidl::encoding::Depth,
1926        ) -> fidl::Result<()> {
1927            encoder.debug_check_bounds::<NetworkInformation>(offset);
1928            // Vector header
1929            let max_ordinal: u64 = self.max_ordinal_present();
1930            encoder.write_num(max_ordinal, offset);
1931            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1932            // Calling encoder.out_of_line_offset(0) is not allowed.
1933            if max_ordinal == 0 {
1934                return Ok(());
1935            }
1936            depth.increment()?;
1937            let envelope_size = 8;
1938            let bytes_len = max_ordinal as usize * envelope_size;
1939            #[allow(unused_variables)]
1940            let offset = encoder.out_of_line_offset(bytes_len);
1941            let mut _prev_end_offset: usize = 0;
1942            if 1 > max_ordinal {
1943                return Ok(());
1944            }
1945
1946            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1947            // are envelope_size bytes.
1948            let cur_offset: usize = (1 - 1) * envelope_size;
1949
1950            // Zero reserved fields.
1951            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1952
1953            // Safety:
1954            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1955            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1956            //   envelope_size bytes, there is always sufficient room.
1957            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1958                self.service_available
1959                    .as_ref()
1960                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1961                encoder,
1962                offset + cur_offset,
1963                depth,
1964            )?;
1965
1966            _prev_end_offset = cur_offset + envelope_size;
1967            if 2 > max_ordinal {
1968                return Ok(());
1969            }
1970
1971            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1972            // are envelope_size bytes.
1973            let cur_offset: usize = (2 - 1) * envelope_size;
1974
1975            // Zero reserved fields.
1976            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1977
1978            // Safety:
1979            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1980            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1981            //   envelope_size bytes, there is always sufficient room.
1982            fidl::encoding::encode_in_envelope_optional::<SignalStrength, D>(
1983                self.signal_strength
1984                    .as_ref()
1985                    .map(<SignalStrength as fidl::encoding::ValueTypeMarker>::borrow),
1986                encoder,
1987                offset + cur_offset,
1988                depth,
1989            )?;
1990
1991            _prev_end_offset = cur_offset + envelope_size;
1992            if 3 > max_ordinal {
1993                return Ok(());
1994            }
1995
1996            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1997            // are envelope_size bytes.
1998            let cur_offset: usize = (3 - 1) * envelope_size;
1999
2000            // Zero reserved fields.
2001            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2002
2003            // Safety:
2004            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2005            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2006            //   envelope_size bytes, there is always sufficient room.
2007            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2008                self.roaming.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2009                encoder,
2010                offset + cur_offset,
2011                depth,
2012            )?;
2013
2014            _prev_end_offset = cur_offset + envelope_size;
2015
2016            Ok(())
2017        }
2018    }
2019
2020    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInformation {
2021        #[inline(always)]
2022        fn new_empty() -> Self {
2023            Self::default()
2024        }
2025
2026        unsafe fn decode(
2027            &mut self,
2028            decoder: &mut fidl::encoding::Decoder<'_, D>,
2029            offset: usize,
2030            mut depth: fidl::encoding::Depth,
2031        ) -> fidl::Result<()> {
2032            decoder.debug_check_bounds::<Self>(offset);
2033            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2034                None => return Err(fidl::Error::NotNullable),
2035                Some(len) => len,
2036            };
2037            // Calling decoder.out_of_line_offset(0) is not allowed.
2038            if len == 0 {
2039                return Ok(());
2040            };
2041            depth.increment()?;
2042            let envelope_size = 8;
2043            let bytes_len = len * envelope_size;
2044            let offset = decoder.out_of_line_offset(bytes_len)?;
2045            // Decode the envelope for each type.
2046            let mut _next_ordinal_to_read = 0;
2047            let mut next_offset = offset;
2048            let end_offset = offset + bytes_len;
2049            _next_ordinal_to_read += 1;
2050            if next_offset >= end_offset {
2051                return Ok(());
2052            }
2053
2054            // Decode unknown envelopes for gaps in ordinals.
2055            while _next_ordinal_to_read < 1 {
2056                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2057                _next_ordinal_to_read += 1;
2058                next_offset += envelope_size;
2059            }
2060
2061            let next_out_of_line = decoder.next_out_of_line();
2062            let handles_before = decoder.remaining_handles();
2063            if let Some((inlined, num_bytes, num_handles)) =
2064                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2065            {
2066                let member_inline_size =
2067                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2068                if inlined != (member_inline_size <= 4) {
2069                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2070                }
2071                let inner_offset;
2072                let mut inner_depth = depth.clone();
2073                if inlined {
2074                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2075                    inner_offset = next_offset;
2076                } else {
2077                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2078                    inner_depth.increment()?;
2079                }
2080                let val_ref =
2081                    self.service_available.get_or_insert_with(|| fidl::new_empty!(bool, D));
2082                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2083                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2084                {
2085                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2086                }
2087                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2088                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2089                }
2090            }
2091
2092            next_offset += envelope_size;
2093            _next_ordinal_to_read += 1;
2094            if next_offset >= end_offset {
2095                return Ok(());
2096            }
2097
2098            // Decode unknown envelopes for gaps in ordinals.
2099            while _next_ordinal_to_read < 2 {
2100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2101                _next_ordinal_to_read += 1;
2102                next_offset += envelope_size;
2103            }
2104
2105            let next_out_of_line = decoder.next_out_of_line();
2106            let handles_before = decoder.remaining_handles();
2107            if let Some((inlined, num_bytes, num_handles)) =
2108                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2109            {
2110                let member_inline_size =
2111                    <SignalStrength as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2112                if inlined != (member_inline_size <= 4) {
2113                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2114                }
2115                let inner_offset;
2116                let mut inner_depth = depth.clone();
2117                if inlined {
2118                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2119                    inner_offset = next_offset;
2120                } else {
2121                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2122                    inner_depth.increment()?;
2123                }
2124                let val_ref =
2125                    self.signal_strength.get_or_insert_with(|| fidl::new_empty!(SignalStrength, D));
2126                fidl::decode!(SignalStrength, D, val_ref, decoder, inner_offset, inner_depth)?;
2127                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2128                {
2129                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2130                }
2131                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2132                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2133                }
2134            }
2135
2136            next_offset += envelope_size;
2137            _next_ordinal_to_read += 1;
2138            if next_offset >= end_offset {
2139                return Ok(());
2140            }
2141
2142            // Decode unknown envelopes for gaps in ordinals.
2143            while _next_ordinal_to_read < 3 {
2144                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2145                _next_ordinal_to_read += 1;
2146                next_offset += envelope_size;
2147            }
2148
2149            let next_out_of_line = decoder.next_out_of_line();
2150            let handles_before = decoder.remaining_handles();
2151            if let Some((inlined, num_bytes, num_handles)) =
2152                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2153            {
2154                let member_inline_size =
2155                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2156                if inlined != (member_inline_size <= 4) {
2157                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2158                }
2159                let inner_offset;
2160                let mut inner_depth = depth.clone();
2161                if inlined {
2162                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2163                    inner_offset = next_offset;
2164                } else {
2165                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2166                    inner_depth.increment()?;
2167                }
2168                let val_ref = self.roaming.get_or_insert_with(|| fidl::new_empty!(bool, D));
2169                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2170                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2171                {
2172                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2173                }
2174                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2175                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2176                }
2177            }
2178
2179            next_offset += envelope_size;
2180
2181            // Decode the remaining unknown envelopes.
2182            while next_offset < end_offset {
2183                _next_ordinal_to_read += 1;
2184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2185                next_offset += envelope_size;
2186            }
2187
2188            Ok(())
2189        }
2190    }
2191
2192    impl fidl::encoding::ValueTypeMarker for CallAction {
2193        type Borrowed<'a> = &'a Self;
2194        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2195            value
2196        }
2197    }
2198
2199    unsafe impl fidl::encoding::TypeMarker for CallAction {
2200        type Owned = Self;
2201
2202        #[inline(always)]
2203        fn inline_align(_context: fidl::encoding::Context) -> usize {
2204            8
2205        }
2206
2207        #[inline(always)]
2208        fn inline_size(_context: fidl::encoding::Context) -> usize {
2209            16
2210        }
2211    }
2212
2213    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CallAction, D>
2214        for &CallAction
2215    {
2216        #[inline]
2217        unsafe fn encode(
2218            self,
2219            encoder: &mut fidl::encoding::Encoder<'_, D>,
2220            offset: usize,
2221            _depth: fidl::encoding::Depth,
2222        ) -> fidl::Result<()> {
2223            encoder.debug_check_bounds::<CallAction>(offset);
2224            encoder.write_num::<u64>(self.ordinal(), offset);
2225            match self {
2226                CallAction::DialFromNumber(ref val) => fidl::encoding::encode_in_envelope::<
2227                    fidl::encoding::BoundedString<256>,
2228                    D,
2229                >(
2230                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2231                        val,
2232                    ),
2233                    encoder,
2234                    offset + 8,
2235                    _depth,
2236                ),
2237                CallAction::DialFromLocation(ref val) => fidl::encoding::encode_in_envelope::<
2238                    fidl::encoding::BoundedString<256>,
2239                    D,
2240                >(
2241                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2242                        val,
2243                    ),
2244                    encoder,
2245                    offset + 8,
2246                    _depth,
2247                ),
2248                CallAction::RedialLast(ref val) => {
2249                    fidl::encoding::encode_in_envelope::<RedialLast, D>(
2250                        <RedialLast as fidl::encoding::ValueTypeMarker>::borrow(val),
2251                        encoder,
2252                        offset + 8,
2253                        _depth,
2254                    )
2255                }
2256                CallAction::TransferActive(ref val) => {
2257                    fidl::encoding::encode_in_envelope::<TransferActive, D>(
2258                        <TransferActive as fidl::encoding::ValueTypeMarker>::borrow(val),
2259                        encoder,
2260                        offset + 8,
2261                        _depth,
2262                    )
2263                }
2264            }
2265        }
2266    }
2267
2268    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallAction {
2269        #[inline(always)]
2270        fn new_empty() -> Self {
2271            Self::DialFromNumber(fidl::new_empty!(fidl::encoding::BoundedString<256>, D))
2272        }
2273
2274        #[inline]
2275        unsafe fn decode(
2276            &mut self,
2277            decoder: &mut fidl::encoding::Decoder<'_, D>,
2278            offset: usize,
2279            mut depth: fidl::encoding::Depth,
2280        ) -> fidl::Result<()> {
2281            decoder.debug_check_bounds::<Self>(offset);
2282            #[allow(unused_variables)]
2283            let next_out_of_line = decoder.next_out_of_line();
2284            let handles_before = decoder.remaining_handles();
2285            let (ordinal, inlined, num_bytes, num_handles) =
2286                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2287
2288            let member_inline_size = match ordinal {
2289                1 => {
2290                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2291                        decoder.context,
2292                    )
2293                }
2294                2 => {
2295                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2296                        decoder.context,
2297                    )
2298                }
2299                3 => <RedialLast as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2300                4 => <TransferActive as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2301                _ => return Err(fidl::Error::UnknownUnionTag),
2302            };
2303
2304            if inlined != (member_inline_size <= 4) {
2305                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2306            }
2307            let _inner_offset;
2308            if inlined {
2309                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2310                _inner_offset = offset + 8;
2311            } else {
2312                depth.increment()?;
2313                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2314            }
2315            match ordinal {
2316                1 => {
2317                    #[allow(irrefutable_let_patterns)]
2318                    if let CallAction::DialFromNumber(_) = self {
2319                        // Do nothing, read the value into the object
2320                    } else {
2321                        // Initialize `self` to the right variant
2322                        *self = CallAction::DialFromNumber(fidl::new_empty!(
2323                            fidl::encoding::BoundedString<256>,
2324                            D
2325                        ));
2326                    }
2327                    #[allow(irrefutable_let_patterns)]
2328                    if let CallAction::DialFromNumber(ref mut val) = self {
2329                        fidl::decode!(
2330                            fidl::encoding::BoundedString<256>,
2331                            D,
2332                            val,
2333                            decoder,
2334                            _inner_offset,
2335                            depth
2336                        )?;
2337                    } else {
2338                        unreachable!()
2339                    }
2340                }
2341                2 => {
2342                    #[allow(irrefutable_let_patterns)]
2343                    if let CallAction::DialFromLocation(_) = self {
2344                        // Do nothing, read the value into the object
2345                    } else {
2346                        // Initialize `self` to the right variant
2347                        *self = CallAction::DialFromLocation(fidl::new_empty!(
2348                            fidl::encoding::BoundedString<256>,
2349                            D
2350                        ));
2351                    }
2352                    #[allow(irrefutable_let_patterns)]
2353                    if let CallAction::DialFromLocation(ref mut val) = self {
2354                        fidl::decode!(
2355                            fidl::encoding::BoundedString<256>,
2356                            D,
2357                            val,
2358                            decoder,
2359                            _inner_offset,
2360                            depth
2361                        )?;
2362                    } else {
2363                        unreachable!()
2364                    }
2365                }
2366                3 => {
2367                    #[allow(irrefutable_let_patterns)]
2368                    if let CallAction::RedialLast(_) = self {
2369                        // Do nothing, read the value into the object
2370                    } else {
2371                        // Initialize `self` to the right variant
2372                        *self = CallAction::RedialLast(fidl::new_empty!(RedialLast, D));
2373                    }
2374                    #[allow(irrefutable_let_patterns)]
2375                    if let CallAction::RedialLast(ref mut val) = self {
2376                        fidl::decode!(RedialLast, D, val, decoder, _inner_offset, depth)?;
2377                    } else {
2378                        unreachable!()
2379                    }
2380                }
2381                4 => {
2382                    #[allow(irrefutable_let_patterns)]
2383                    if let CallAction::TransferActive(_) = self {
2384                        // Do nothing, read the value into the object
2385                    } else {
2386                        // Initialize `self` to the right variant
2387                        *self = CallAction::TransferActive(fidl::new_empty!(TransferActive, D));
2388                    }
2389                    #[allow(irrefutable_let_patterns)]
2390                    if let CallAction::TransferActive(ref mut val) = self {
2391                        fidl::decode!(TransferActive, D, val, decoder, _inner_offset, depth)?;
2392                    } else {
2393                        unreachable!()
2394                    }
2395                }
2396                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2397            }
2398            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2399                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2400            }
2401            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2402                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2403            }
2404            Ok(())
2405        }
2406    }
2407}