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 held.  Another call may be active or not.
62    OngoingHeld,
63    /// A call is active.
64    OngoingActive,
65    /// The call has been terminated.
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
396pub mod call_ordinals {
397    pub const WATCH_STATE: u64 = 0x5262bcc909bdaeb5;
398    pub const REQUEST_HOLD: u64 = 0x35ade403017d20eb;
399    pub const REQUEST_ACTIVE: u64 = 0x248518f967f1fe6e;
400    pub const REQUEST_TERMINATE: u64 = 0x4940915197ee4916;
401    pub const REQUEST_TRANSFER_AUDIO: u64 = 0xb0ca6649f2e104c;
402    pub const SEND_DTMF_CODE: u64 = 0x50768933ca33fcd6;
403}
404
405pub mod call_manager_ordinals {
406    pub const PEER_CONNECTED: u64 = 0x1431cc24b2980086;
407}
408
409pub mod hands_free_ordinals {
410    pub const WATCH_PEER_CONNECTED: u64 = 0x1cc503325a8bbc3f;
411}
412
413pub mod headset_gain_ordinals {
414    pub const SET_SPEAKER_GAIN: u64 = 0x3462191b2a6ae5ce;
415    pub const WATCH_SPEAKER_GAIN: u64 = 0x2007abdf2695c747;
416    pub const SET_MICROPHONE_GAIN: u64 = 0x7ddbb4e63caeef8e;
417    pub const WATCH_MICROPHONE_GAIN: u64 = 0x1d171fb432fa55ad;
418}
419
420pub mod hfp_ordinals {
421    pub const REGISTER: u64 = 0x1b2ea4f6069181ad;
422}
423
424pub mod peer_handler_ordinals {
425    pub const WATCH_NETWORK_INFORMATION: u64 = 0x1c9eba597076b7cb;
426    pub const WATCH_NEXT_CALL: u64 = 0x5e3b7b4e7c3d359;
427    pub const REQUEST_OUTGOING_CALL: u64 = 0x1a2637c743c89ad;
428    pub const QUERY_OPERATOR: u64 = 0x1217eaf5db4c3300;
429    pub const SUBSCRIBER_NUMBER_INFORMATION: u64 = 0x15f5235855b02a3a;
430    pub const SET_NREC_MODE: u64 = 0x2f8890d0f866672f;
431    pub const REPORT_HEADSET_BATTERY_LEVEL: u64 = 0x4e3e8be4680d85b;
432    pub const GAIN_CONTROL: u64 = 0x6e043b6d2e0fb917;
433}
434
435mod internal {
436    use super::*;
437    unsafe impl fidl::encoding::TypeMarker for CallDirection {
438        type Owned = Self;
439
440        #[inline(always)]
441        fn inline_align(_context: fidl::encoding::Context) -> usize {
442            std::mem::align_of::<u32>()
443        }
444
445        #[inline(always)]
446        fn inline_size(_context: fidl::encoding::Context) -> usize {
447            std::mem::size_of::<u32>()
448        }
449
450        #[inline(always)]
451        fn encode_is_copy() -> bool {
452            true
453        }
454
455        #[inline(always)]
456        fn decode_is_copy() -> bool {
457            false
458        }
459    }
460
461    impl fidl::encoding::ValueTypeMarker for CallDirection {
462        type Borrowed<'a> = Self;
463        #[inline(always)]
464        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
465            *value
466        }
467    }
468
469    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CallDirection {
470        #[inline]
471        unsafe fn encode(
472            self,
473            encoder: &mut fidl::encoding::Encoder<'_, D>,
474            offset: usize,
475            _depth: fidl::encoding::Depth,
476        ) -> fidl::Result<()> {
477            encoder.debug_check_bounds::<Self>(offset);
478            encoder.write_num(self.into_primitive(), offset);
479            Ok(())
480        }
481    }
482
483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallDirection {
484        #[inline(always)]
485        fn new_empty() -> Self {
486            Self::MobileOriginated
487        }
488
489        #[inline]
490        unsafe fn decode(
491            &mut self,
492            decoder: &mut fidl::encoding::Decoder<'_, D>,
493            offset: usize,
494            _depth: fidl::encoding::Depth,
495        ) -> fidl::Result<()> {
496            decoder.debug_check_bounds::<Self>(offset);
497            let prim = decoder.read_num::<u32>(offset);
498
499            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
500            Ok(())
501        }
502    }
503    unsafe impl fidl::encoding::TypeMarker for CallState {
504        type Owned = Self;
505
506        #[inline(always)]
507        fn inline_align(_context: fidl::encoding::Context) -> usize {
508            std::mem::align_of::<u32>()
509        }
510
511        #[inline(always)]
512        fn inline_size(_context: fidl::encoding::Context) -> usize {
513            std::mem::size_of::<u32>()
514        }
515
516        #[inline(always)]
517        fn encode_is_copy() -> bool {
518            false
519        }
520
521        #[inline(always)]
522        fn decode_is_copy() -> bool {
523            false
524        }
525    }
526
527    impl fidl::encoding::ValueTypeMarker for CallState {
528        type Borrowed<'a> = Self;
529        #[inline(always)]
530        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
531            *value
532        }
533    }
534
535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CallState {
536        #[inline]
537        unsafe fn encode(
538            self,
539            encoder: &mut fidl::encoding::Encoder<'_, D>,
540            offset: usize,
541            _depth: fidl::encoding::Depth,
542        ) -> fidl::Result<()> {
543            encoder.debug_check_bounds::<Self>(offset);
544            encoder.write_num(self.into_primitive(), offset);
545            Ok(())
546        }
547    }
548
549    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallState {
550        #[inline(always)]
551        fn new_empty() -> Self {
552            Self::unknown()
553        }
554
555        #[inline]
556        unsafe fn decode(
557            &mut self,
558            decoder: &mut fidl::encoding::Decoder<'_, D>,
559            offset: usize,
560            _depth: fidl::encoding::Depth,
561        ) -> fidl::Result<()> {
562            decoder.debug_check_bounds::<Self>(offset);
563            let prim = decoder.read_num::<u32>(offset);
564
565            *self = Self::from_primitive_allow_unknown(prim);
566            Ok(())
567        }
568    }
569    unsafe impl fidl::encoding::TypeMarker for DtmfCode {
570        type Owned = Self;
571
572        #[inline(always)]
573        fn inline_align(_context: fidl::encoding::Context) -> usize {
574            std::mem::align_of::<u8>()
575        }
576
577        #[inline(always)]
578        fn inline_size(_context: fidl::encoding::Context) -> usize {
579            std::mem::size_of::<u8>()
580        }
581
582        #[inline(always)]
583        fn encode_is_copy() -> bool {
584            true
585        }
586
587        #[inline(always)]
588        fn decode_is_copy() -> bool {
589            false
590        }
591    }
592
593    impl fidl::encoding::ValueTypeMarker for DtmfCode {
594        type Borrowed<'a> = Self;
595        #[inline(always)]
596        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
597            *value
598        }
599    }
600
601    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DtmfCode {
602        #[inline]
603        unsafe fn encode(
604            self,
605            encoder: &mut fidl::encoding::Encoder<'_, D>,
606            offset: usize,
607            _depth: fidl::encoding::Depth,
608        ) -> fidl::Result<()> {
609            encoder.debug_check_bounds::<Self>(offset);
610            encoder.write_num(self.into_primitive(), offset);
611            Ok(())
612        }
613    }
614
615    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DtmfCode {
616        #[inline(always)]
617        fn new_empty() -> Self {
618            Self::NumberSign
619        }
620
621        #[inline]
622        unsafe fn decode(
623            &mut self,
624            decoder: &mut fidl::encoding::Decoder<'_, D>,
625            offset: usize,
626            _depth: fidl::encoding::Depth,
627        ) -> fidl::Result<()> {
628            decoder.debug_check_bounds::<Self>(offset);
629            let prim = decoder.read_num::<u8>(offset);
630
631            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
632            Ok(())
633        }
634    }
635    unsafe impl fidl::encoding::TypeMarker for SignalStrength {
636        type Owned = Self;
637
638        #[inline(always)]
639        fn inline_align(_context: fidl::encoding::Context) -> usize {
640            std::mem::align_of::<i8>()
641        }
642
643        #[inline(always)]
644        fn inline_size(_context: fidl::encoding::Context) -> usize {
645            std::mem::size_of::<i8>()
646        }
647
648        #[inline(always)]
649        fn encode_is_copy() -> bool {
650            true
651        }
652
653        #[inline(always)]
654        fn decode_is_copy() -> bool {
655            false
656        }
657    }
658
659    impl fidl::encoding::ValueTypeMarker for SignalStrength {
660        type Borrowed<'a> = Self;
661        #[inline(always)]
662        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
663            *value
664        }
665    }
666
667    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SignalStrength {
668        #[inline]
669        unsafe fn encode(
670            self,
671            encoder: &mut fidl::encoding::Encoder<'_, D>,
672            offset: usize,
673            _depth: fidl::encoding::Depth,
674        ) -> fidl::Result<()> {
675            encoder.debug_check_bounds::<Self>(offset);
676            encoder.write_num(self.into_primitive(), offset);
677            Ok(())
678        }
679    }
680
681    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignalStrength {
682        #[inline(always)]
683        fn new_empty() -> Self {
684            Self::None
685        }
686
687        #[inline]
688        unsafe fn decode(
689            &mut self,
690            decoder: &mut fidl::encoding::Decoder<'_, D>,
691            offset: usize,
692            _depth: fidl::encoding::Depth,
693        ) -> fidl::Result<()> {
694            decoder.debug_check_bounds::<Self>(offset);
695            let prim = decoder.read_num::<i8>(offset);
696
697            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
698            Ok(())
699        }
700    }
701
702    impl fidl::encoding::ValueTypeMarker for CallSendDtmfCodeRequest {
703        type Borrowed<'a> = &'a Self;
704        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
705            value
706        }
707    }
708
709    unsafe impl fidl::encoding::TypeMarker for CallSendDtmfCodeRequest {
710        type Owned = Self;
711
712        #[inline(always)]
713        fn inline_align(_context: fidl::encoding::Context) -> usize {
714            1
715        }
716
717        #[inline(always)]
718        fn inline_size(_context: fidl::encoding::Context) -> usize {
719            1
720        }
721    }
722
723    unsafe impl<D: fidl::encoding::ResourceDialect>
724        fidl::encoding::Encode<CallSendDtmfCodeRequest, D> for &CallSendDtmfCodeRequest
725    {
726        #[inline]
727        unsafe fn encode(
728            self,
729            encoder: &mut fidl::encoding::Encoder<'_, D>,
730            offset: usize,
731            _depth: fidl::encoding::Depth,
732        ) -> fidl::Result<()> {
733            encoder.debug_check_bounds::<CallSendDtmfCodeRequest>(offset);
734            // Delegate to tuple encoding.
735            fidl::encoding::Encode::<CallSendDtmfCodeRequest, D>::encode(
736                (<DtmfCode as fidl::encoding::ValueTypeMarker>::borrow(&self.code),),
737                encoder,
738                offset,
739                _depth,
740            )
741        }
742    }
743    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DtmfCode, D>>
744        fidl::encoding::Encode<CallSendDtmfCodeRequest, D> for (T0,)
745    {
746        #[inline]
747        unsafe fn encode(
748            self,
749            encoder: &mut fidl::encoding::Encoder<'_, D>,
750            offset: usize,
751            depth: fidl::encoding::Depth,
752        ) -> fidl::Result<()> {
753            encoder.debug_check_bounds::<CallSendDtmfCodeRequest>(offset);
754            // Zero out padding regions. There's no need to apply masks
755            // because the unmasked parts will be overwritten by fields.
756            // Write the fields.
757            self.0.encode(encoder, offset + 0, depth)?;
758            Ok(())
759        }
760    }
761
762    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
763        for CallSendDtmfCodeRequest
764    {
765        #[inline(always)]
766        fn new_empty() -> Self {
767            Self { code: fidl::new_empty!(DtmfCode, D) }
768        }
769
770        #[inline]
771        unsafe fn decode(
772            &mut self,
773            decoder: &mut fidl::encoding::Decoder<'_, D>,
774            offset: usize,
775            _depth: fidl::encoding::Depth,
776        ) -> fidl::Result<()> {
777            decoder.debug_check_bounds::<Self>(offset);
778            // Verify that padding bytes are zero.
779            fidl::decode!(DtmfCode, D, &mut self.code, decoder, offset + 0, _depth)?;
780            Ok(())
781        }
782    }
783
784    impl fidl::encoding::ValueTypeMarker for CallWatchStateResponse {
785        type Borrowed<'a> = &'a Self;
786        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
787            value
788        }
789    }
790
791    unsafe impl fidl::encoding::TypeMarker for CallWatchStateResponse {
792        type Owned = Self;
793
794        #[inline(always)]
795        fn inline_align(_context: fidl::encoding::Context) -> usize {
796            4
797        }
798
799        #[inline(always)]
800        fn inline_size(_context: fidl::encoding::Context) -> usize {
801            4
802        }
803    }
804
805    unsafe impl<D: fidl::encoding::ResourceDialect>
806        fidl::encoding::Encode<CallWatchStateResponse, D> for &CallWatchStateResponse
807    {
808        #[inline]
809        unsafe fn encode(
810            self,
811            encoder: &mut fidl::encoding::Encoder<'_, D>,
812            offset: usize,
813            _depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            encoder.debug_check_bounds::<CallWatchStateResponse>(offset);
816            // Delegate to tuple encoding.
817            fidl::encoding::Encode::<CallWatchStateResponse, D>::encode(
818                (<CallState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
819                encoder,
820                offset,
821                _depth,
822            )
823        }
824    }
825    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CallState, D>>
826        fidl::encoding::Encode<CallWatchStateResponse, D> for (T0,)
827    {
828        #[inline]
829        unsafe fn encode(
830            self,
831            encoder: &mut fidl::encoding::Encoder<'_, D>,
832            offset: usize,
833            depth: fidl::encoding::Depth,
834        ) -> fidl::Result<()> {
835            encoder.debug_check_bounds::<CallWatchStateResponse>(offset);
836            // Zero out padding regions. There's no need to apply masks
837            // because the unmasked parts will be overwritten by fields.
838            // Write the fields.
839            self.0.encode(encoder, offset + 0, depth)?;
840            Ok(())
841        }
842    }
843
844    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
845        for CallWatchStateResponse
846    {
847        #[inline(always)]
848        fn new_empty() -> Self {
849            Self { state: fidl::new_empty!(CallState, D) }
850        }
851
852        #[inline]
853        unsafe fn decode(
854            &mut self,
855            decoder: &mut fidl::encoding::Decoder<'_, D>,
856            offset: usize,
857            _depth: fidl::encoding::Depth,
858        ) -> fidl::Result<()> {
859            decoder.debug_check_bounds::<Self>(offset);
860            // Verify that padding bytes are zero.
861            fidl::decode!(CallState, D, &mut self.state, decoder, offset + 0, _depth)?;
862            Ok(())
863        }
864    }
865
866    impl fidl::encoding::ValueTypeMarker for HeadsetGainSetMicrophoneGainRequest {
867        type Borrowed<'a> = &'a Self;
868        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
869            value
870        }
871    }
872
873    unsafe impl fidl::encoding::TypeMarker for HeadsetGainSetMicrophoneGainRequest {
874        type Owned = Self;
875
876        #[inline(always)]
877        fn inline_align(_context: fidl::encoding::Context) -> usize {
878            1
879        }
880
881        #[inline(always)]
882        fn inline_size(_context: fidl::encoding::Context) -> usize {
883            1
884        }
885        #[inline(always)]
886        fn encode_is_copy() -> bool {
887            true
888        }
889
890        #[inline(always)]
891        fn decode_is_copy() -> bool {
892            true
893        }
894    }
895
896    unsafe impl<D: fidl::encoding::ResourceDialect>
897        fidl::encoding::Encode<HeadsetGainSetMicrophoneGainRequest, D>
898        for &HeadsetGainSetMicrophoneGainRequest
899    {
900        #[inline]
901        unsafe fn encode(
902            self,
903            encoder: &mut fidl::encoding::Encoder<'_, D>,
904            offset: usize,
905            _depth: fidl::encoding::Depth,
906        ) -> fidl::Result<()> {
907            encoder.debug_check_bounds::<HeadsetGainSetMicrophoneGainRequest>(offset);
908            unsafe {
909                // Copy the object into the buffer.
910                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
911                (buf_ptr as *mut HeadsetGainSetMicrophoneGainRequest)
912                    .write_unaligned((self as *const HeadsetGainSetMicrophoneGainRequest).read());
913                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
914                // done second because the memcpy will write garbage to these bytes.
915            }
916            Ok(())
917        }
918    }
919    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
920        fidl::encoding::Encode<HeadsetGainSetMicrophoneGainRequest, D> for (T0,)
921    {
922        #[inline]
923        unsafe fn encode(
924            self,
925            encoder: &mut fidl::encoding::Encoder<'_, D>,
926            offset: usize,
927            depth: fidl::encoding::Depth,
928        ) -> fidl::Result<()> {
929            encoder.debug_check_bounds::<HeadsetGainSetMicrophoneGainRequest>(offset);
930            // Zero out padding regions. There's no need to apply masks
931            // because the unmasked parts will be overwritten by fields.
932            // Write the fields.
933            self.0.encode(encoder, offset + 0, depth)?;
934            Ok(())
935        }
936    }
937
938    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
939        for HeadsetGainSetMicrophoneGainRequest
940    {
941        #[inline(always)]
942        fn new_empty() -> Self {
943            Self { requested: fidl::new_empty!(u8, D) }
944        }
945
946        #[inline]
947        unsafe fn decode(
948            &mut self,
949            decoder: &mut fidl::encoding::Decoder<'_, D>,
950            offset: usize,
951            _depth: fidl::encoding::Depth,
952        ) -> fidl::Result<()> {
953            decoder.debug_check_bounds::<Self>(offset);
954            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
955            // Verify that padding bytes are zero.
956            // Copy from the buffer into the object.
957            unsafe {
958                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
959            }
960            Ok(())
961        }
962    }
963
964    impl fidl::encoding::ValueTypeMarker for HeadsetGainSetSpeakerGainRequest {
965        type Borrowed<'a> = &'a Self;
966        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
967            value
968        }
969    }
970
971    unsafe impl fidl::encoding::TypeMarker for HeadsetGainSetSpeakerGainRequest {
972        type Owned = Self;
973
974        #[inline(always)]
975        fn inline_align(_context: fidl::encoding::Context) -> usize {
976            1
977        }
978
979        #[inline(always)]
980        fn inline_size(_context: fidl::encoding::Context) -> usize {
981            1
982        }
983        #[inline(always)]
984        fn encode_is_copy() -> bool {
985            true
986        }
987
988        #[inline(always)]
989        fn decode_is_copy() -> bool {
990            true
991        }
992    }
993
994    unsafe impl<D: fidl::encoding::ResourceDialect>
995        fidl::encoding::Encode<HeadsetGainSetSpeakerGainRequest, D>
996        for &HeadsetGainSetSpeakerGainRequest
997    {
998        #[inline]
999        unsafe fn encode(
1000            self,
1001            encoder: &mut fidl::encoding::Encoder<'_, D>,
1002            offset: usize,
1003            _depth: fidl::encoding::Depth,
1004        ) -> fidl::Result<()> {
1005            encoder.debug_check_bounds::<HeadsetGainSetSpeakerGainRequest>(offset);
1006            unsafe {
1007                // Copy the object into the buffer.
1008                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1009                (buf_ptr as *mut HeadsetGainSetSpeakerGainRequest)
1010                    .write_unaligned((self as *const HeadsetGainSetSpeakerGainRequest).read());
1011                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1012                // done second because the memcpy will write garbage to these bytes.
1013            }
1014            Ok(())
1015        }
1016    }
1017    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1018        fidl::encoding::Encode<HeadsetGainSetSpeakerGainRequest, D> for (T0,)
1019    {
1020        #[inline]
1021        unsafe fn encode(
1022            self,
1023            encoder: &mut fidl::encoding::Encoder<'_, D>,
1024            offset: usize,
1025            depth: fidl::encoding::Depth,
1026        ) -> fidl::Result<()> {
1027            encoder.debug_check_bounds::<HeadsetGainSetSpeakerGainRequest>(offset);
1028            // Zero out padding regions. There's no need to apply masks
1029            // because the unmasked parts will be overwritten by fields.
1030            // Write the fields.
1031            self.0.encode(encoder, offset + 0, depth)?;
1032            Ok(())
1033        }
1034    }
1035
1036    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1037        for HeadsetGainSetSpeakerGainRequest
1038    {
1039        #[inline(always)]
1040        fn new_empty() -> Self {
1041            Self { requested: fidl::new_empty!(u8, D) }
1042        }
1043
1044        #[inline]
1045        unsafe fn decode(
1046            &mut self,
1047            decoder: &mut fidl::encoding::Decoder<'_, D>,
1048            offset: usize,
1049            _depth: fidl::encoding::Depth,
1050        ) -> fidl::Result<()> {
1051            decoder.debug_check_bounds::<Self>(offset);
1052            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1053            // Verify that padding bytes are zero.
1054            // Copy from the buffer into the object.
1055            unsafe {
1056                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1057            }
1058            Ok(())
1059        }
1060    }
1061
1062    impl fidl::encoding::ValueTypeMarker for HeadsetGainWatchMicrophoneGainResponse {
1063        type Borrowed<'a> = &'a Self;
1064        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1065            value
1066        }
1067    }
1068
1069    unsafe impl fidl::encoding::TypeMarker for HeadsetGainWatchMicrophoneGainResponse {
1070        type Owned = Self;
1071
1072        #[inline(always)]
1073        fn inline_align(_context: fidl::encoding::Context) -> usize {
1074            1
1075        }
1076
1077        #[inline(always)]
1078        fn inline_size(_context: fidl::encoding::Context) -> usize {
1079            1
1080        }
1081        #[inline(always)]
1082        fn encode_is_copy() -> bool {
1083            true
1084        }
1085
1086        #[inline(always)]
1087        fn decode_is_copy() -> bool {
1088            true
1089        }
1090    }
1091
1092    unsafe impl<D: fidl::encoding::ResourceDialect>
1093        fidl::encoding::Encode<HeadsetGainWatchMicrophoneGainResponse, D>
1094        for &HeadsetGainWatchMicrophoneGainResponse
1095    {
1096        #[inline]
1097        unsafe fn encode(
1098            self,
1099            encoder: &mut fidl::encoding::Encoder<'_, D>,
1100            offset: usize,
1101            _depth: fidl::encoding::Depth,
1102        ) -> fidl::Result<()> {
1103            encoder.debug_check_bounds::<HeadsetGainWatchMicrophoneGainResponse>(offset);
1104            unsafe {
1105                // Copy the object into the buffer.
1106                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1107                (buf_ptr as *mut HeadsetGainWatchMicrophoneGainResponse).write_unaligned(
1108                    (self as *const HeadsetGainWatchMicrophoneGainResponse).read(),
1109                );
1110                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1111                // done second because the memcpy will write garbage to these bytes.
1112            }
1113            Ok(())
1114        }
1115    }
1116    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1117        fidl::encoding::Encode<HeadsetGainWatchMicrophoneGainResponse, D> for (T0,)
1118    {
1119        #[inline]
1120        unsafe fn encode(
1121            self,
1122            encoder: &mut fidl::encoding::Encoder<'_, D>,
1123            offset: usize,
1124            depth: fidl::encoding::Depth,
1125        ) -> fidl::Result<()> {
1126            encoder.debug_check_bounds::<HeadsetGainWatchMicrophoneGainResponse>(offset);
1127            // Zero out padding regions. There's no need to apply masks
1128            // because the unmasked parts will be overwritten by fields.
1129            // Write the fields.
1130            self.0.encode(encoder, offset + 0, depth)?;
1131            Ok(())
1132        }
1133    }
1134
1135    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1136        for HeadsetGainWatchMicrophoneGainResponse
1137    {
1138        #[inline(always)]
1139        fn new_empty() -> Self {
1140            Self { gain: fidl::new_empty!(u8, D) }
1141        }
1142
1143        #[inline]
1144        unsafe fn decode(
1145            &mut self,
1146            decoder: &mut fidl::encoding::Decoder<'_, D>,
1147            offset: usize,
1148            _depth: fidl::encoding::Depth,
1149        ) -> fidl::Result<()> {
1150            decoder.debug_check_bounds::<Self>(offset);
1151            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1152            // Verify that padding bytes are zero.
1153            // Copy from the buffer into the object.
1154            unsafe {
1155                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1156            }
1157            Ok(())
1158        }
1159    }
1160
1161    impl fidl::encoding::ValueTypeMarker for HeadsetGainWatchSpeakerGainResponse {
1162        type Borrowed<'a> = &'a Self;
1163        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1164            value
1165        }
1166    }
1167
1168    unsafe impl fidl::encoding::TypeMarker for HeadsetGainWatchSpeakerGainResponse {
1169        type Owned = Self;
1170
1171        #[inline(always)]
1172        fn inline_align(_context: fidl::encoding::Context) -> usize {
1173            1
1174        }
1175
1176        #[inline(always)]
1177        fn inline_size(_context: fidl::encoding::Context) -> usize {
1178            1
1179        }
1180        #[inline(always)]
1181        fn encode_is_copy() -> bool {
1182            true
1183        }
1184
1185        #[inline(always)]
1186        fn decode_is_copy() -> bool {
1187            true
1188        }
1189    }
1190
1191    unsafe impl<D: fidl::encoding::ResourceDialect>
1192        fidl::encoding::Encode<HeadsetGainWatchSpeakerGainResponse, D>
1193        for &HeadsetGainWatchSpeakerGainResponse
1194    {
1195        #[inline]
1196        unsafe fn encode(
1197            self,
1198            encoder: &mut fidl::encoding::Encoder<'_, D>,
1199            offset: usize,
1200            _depth: fidl::encoding::Depth,
1201        ) -> fidl::Result<()> {
1202            encoder.debug_check_bounds::<HeadsetGainWatchSpeakerGainResponse>(offset);
1203            unsafe {
1204                // Copy the object into the buffer.
1205                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1206                (buf_ptr as *mut HeadsetGainWatchSpeakerGainResponse)
1207                    .write_unaligned((self as *const HeadsetGainWatchSpeakerGainResponse).read());
1208                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1209                // done second because the memcpy will write garbage to these bytes.
1210            }
1211            Ok(())
1212        }
1213    }
1214    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1215        fidl::encoding::Encode<HeadsetGainWatchSpeakerGainResponse, D> for (T0,)
1216    {
1217        #[inline]
1218        unsafe fn encode(
1219            self,
1220            encoder: &mut fidl::encoding::Encoder<'_, D>,
1221            offset: usize,
1222            depth: fidl::encoding::Depth,
1223        ) -> fidl::Result<()> {
1224            encoder.debug_check_bounds::<HeadsetGainWatchSpeakerGainResponse>(offset);
1225            // Zero out padding regions. There's no need to apply masks
1226            // because the unmasked parts will be overwritten by fields.
1227            // Write the fields.
1228            self.0.encode(encoder, offset + 0, depth)?;
1229            Ok(())
1230        }
1231    }
1232
1233    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1234        for HeadsetGainWatchSpeakerGainResponse
1235    {
1236        #[inline(always)]
1237        fn new_empty() -> Self {
1238            Self { gain: fidl::new_empty!(u8, D) }
1239        }
1240
1241        #[inline]
1242        unsafe fn decode(
1243            &mut self,
1244            decoder: &mut fidl::encoding::Decoder<'_, D>,
1245            offset: usize,
1246            _depth: fidl::encoding::Depth,
1247        ) -> fidl::Result<()> {
1248            decoder.debug_check_bounds::<Self>(offset);
1249            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1250            // Verify that padding bytes are zero.
1251            // Copy from the buffer into the object.
1252            unsafe {
1253                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1254            }
1255            Ok(())
1256        }
1257    }
1258
1259    impl fidl::encoding::ValueTypeMarker for PeerHandlerQueryOperatorResponse {
1260        type Borrowed<'a> = &'a Self;
1261        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1262            value
1263        }
1264    }
1265
1266    unsafe impl fidl::encoding::TypeMarker for PeerHandlerQueryOperatorResponse {
1267        type Owned = Self;
1268
1269        #[inline(always)]
1270        fn inline_align(_context: fidl::encoding::Context) -> usize {
1271            8
1272        }
1273
1274        #[inline(always)]
1275        fn inline_size(_context: fidl::encoding::Context) -> usize {
1276            16
1277        }
1278    }
1279
1280    unsafe impl<D: fidl::encoding::ResourceDialect>
1281        fidl::encoding::Encode<PeerHandlerQueryOperatorResponse, D>
1282        for &PeerHandlerQueryOperatorResponse
1283    {
1284        #[inline]
1285        unsafe fn encode(
1286            self,
1287            encoder: &mut fidl::encoding::Encoder<'_, D>,
1288            offset: usize,
1289            _depth: fidl::encoding::Depth,
1290        ) -> fidl::Result<()> {
1291            encoder.debug_check_bounds::<PeerHandlerQueryOperatorResponse>(offset);
1292            // Delegate to tuple encoding.
1293            fidl::encoding::Encode::<PeerHandlerQueryOperatorResponse, D>::encode(
1294                (
1295                    <fidl::encoding::Optional<fidl::encoding::BoundedString<16>> as fidl::encoding::ValueTypeMarker>::borrow(&self.operator),
1296                ),
1297                encoder, offset, _depth
1298            )
1299        }
1300    }
1301    unsafe impl<
1302        D: fidl::encoding::ResourceDialect,
1303        T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<16>>, D>,
1304    > fidl::encoding::Encode<PeerHandlerQueryOperatorResponse, D> for (T0,)
1305    {
1306        #[inline]
1307        unsafe fn encode(
1308            self,
1309            encoder: &mut fidl::encoding::Encoder<'_, D>,
1310            offset: usize,
1311            depth: fidl::encoding::Depth,
1312        ) -> fidl::Result<()> {
1313            encoder.debug_check_bounds::<PeerHandlerQueryOperatorResponse>(offset);
1314            // Zero out padding regions. There's no need to apply masks
1315            // because the unmasked parts will be overwritten by fields.
1316            // Write the fields.
1317            self.0.encode(encoder, offset + 0, depth)?;
1318            Ok(())
1319        }
1320    }
1321
1322    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1323        for PeerHandlerQueryOperatorResponse
1324    {
1325        #[inline(always)]
1326        fn new_empty() -> Self {
1327            Self {
1328                operator: fidl::new_empty!(
1329                    fidl::encoding::Optional<fidl::encoding::BoundedString<16>>,
1330                    D
1331                ),
1332            }
1333        }
1334
1335        #[inline]
1336        unsafe fn decode(
1337            &mut self,
1338            decoder: &mut fidl::encoding::Decoder<'_, D>,
1339            offset: usize,
1340            _depth: fidl::encoding::Depth,
1341        ) -> fidl::Result<()> {
1342            decoder.debug_check_bounds::<Self>(offset);
1343            // Verify that padding bytes are zero.
1344            fidl::decode!(
1345                fidl::encoding::Optional<fidl::encoding::BoundedString<16>>,
1346                D,
1347                &mut self.operator,
1348                decoder,
1349                offset + 0,
1350                _depth
1351            )?;
1352            Ok(())
1353        }
1354    }
1355
1356    impl fidl::encoding::ValueTypeMarker for PeerHandlerReportHeadsetBatteryLevelRequest {
1357        type Borrowed<'a> = &'a Self;
1358        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1359            value
1360        }
1361    }
1362
1363    unsafe impl fidl::encoding::TypeMarker for PeerHandlerReportHeadsetBatteryLevelRequest {
1364        type Owned = Self;
1365
1366        #[inline(always)]
1367        fn inline_align(_context: fidl::encoding::Context) -> usize {
1368            1
1369        }
1370
1371        #[inline(always)]
1372        fn inline_size(_context: fidl::encoding::Context) -> usize {
1373            1
1374        }
1375        #[inline(always)]
1376        fn encode_is_copy() -> bool {
1377            true
1378        }
1379
1380        #[inline(always)]
1381        fn decode_is_copy() -> bool {
1382            true
1383        }
1384    }
1385
1386    unsafe impl<D: fidl::encoding::ResourceDialect>
1387        fidl::encoding::Encode<PeerHandlerReportHeadsetBatteryLevelRequest, D>
1388        for &PeerHandlerReportHeadsetBatteryLevelRequest
1389    {
1390        #[inline]
1391        unsafe fn encode(
1392            self,
1393            encoder: &mut fidl::encoding::Encoder<'_, D>,
1394            offset: usize,
1395            _depth: fidl::encoding::Depth,
1396        ) -> fidl::Result<()> {
1397            encoder.debug_check_bounds::<PeerHandlerReportHeadsetBatteryLevelRequest>(offset);
1398            unsafe {
1399                // Copy the object into the buffer.
1400                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1401                (buf_ptr as *mut PeerHandlerReportHeadsetBatteryLevelRequest).write_unaligned(
1402                    (self as *const PeerHandlerReportHeadsetBatteryLevelRequest).read(),
1403                );
1404                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1405                // done second because the memcpy will write garbage to these bytes.
1406            }
1407            Ok(())
1408        }
1409    }
1410    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1411        fidl::encoding::Encode<PeerHandlerReportHeadsetBatteryLevelRequest, D> for (T0,)
1412    {
1413        #[inline]
1414        unsafe fn encode(
1415            self,
1416            encoder: &mut fidl::encoding::Encoder<'_, D>,
1417            offset: usize,
1418            depth: fidl::encoding::Depth,
1419        ) -> fidl::Result<()> {
1420            encoder.debug_check_bounds::<PeerHandlerReportHeadsetBatteryLevelRequest>(offset);
1421            // Zero out padding regions. There's no need to apply masks
1422            // because the unmasked parts will be overwritten by fields.
1423            // Write the fields.
1424            self.0.encode(encoder, offset + 0, depth)?;
1425            Ok(())
1426        }
1427    }
1428
1429    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1430        for PeerHandlerReportHeadsetBatteryLevelRequest
1431    {
1432        #[inline(always)]
1433        fn new_empty() -> Self {
1434            Self { level: fidl::new_empty!(u8, D) }
1435        }
1436
1437        #[inline]
1438        unsafe fn decode(
1439            &mut self,
1440            decoder: &mut fidl::encoding::Decoder<'_, D>,
1441            offset: usize,
1442            _depth: fidl::encoding::Depth,
1443        ) -> fidl::Result<()> {
1444            decoder.debug_check_bounds::<Self>(offset);
1445            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1446            // Verify that padding bytes are zero.
1447            // Copy from the buffer into the object.
1448            unsafe {
1449                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1450            }
1451            Ok(())
1452        }
1453    }
1454
1455    impl fidl::encoding::ValueTypeMarker for PeerHandlerRequestOutgoingCallRequest {
1456        type Borrowed<'a> = &'a Self;
1457        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1458            value
1459        }
1460    }
1461
1462    unsafe impl fidl::encoding::TypeMarker for PeerHandlerRequestOutgoingCallRequest {
1463        type Owned = Self;
1464
1465        #[inline(always)]
1466        fn inline_align(_context: fidl::encoding::Context) -> usize {
1467            8
1468        }
1469
1470        #[inline(always)]
1471        fn inline_size(_context: fidl::encoding::Context) -> usize {
1472            16
1473        }
1474    }
1475
1476    unsafe impl<D: fidl::encoding::ResourceDialect>
1477        fidl::encoding::Encode<PeerHandlerRequestOutgoingCallRequest, D>
1478        for &PeerHandlerRequestOutgoingCallRequest
1479    {
1480        #[inline]
1481        unsafe fn encode(
1482            self,
1483            encoder: &mut fidl::encoding::Encoder<'_, D>,
1484            offset: usize,
1485            _depth: fidl::encoding::Depth,
1486        ) -> fidl::Result<()> {
1487            encoder.debug_check_bounds::<PeerHandlerRequestOutgoingCallRequest>(offset);
1488            // Delegate to tuple encoding.
1489            fidl::encoding::Encode::<PeerHandlerRequestOutgoingCallRequest, D>::encode(
1490                (<CallAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
1491                encoder,
1492                offset,
1493                _depth,
1494            )
1495        }
1496    }
1497    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CallAction, D>>
1498        fidl::encoding::Encode<PeerHandlerRequestOutgoingCallRequest, D> for (T0,)
1499    {
1500        #[inline]
1501        unsafe fn encode(
1502            self,
1503            encoder: &mut fidl::encoding::Encoder<'_, D>,
1504            offset: usize,
1505            depth: fidl::encoding::Depth,
1506        ) -> fidl::Result<()> {
1507            encoder.debug_check_bounds::<PeerHandlerRequestOutgoingCallRequest>(offset);
1508            // Zero out padding regions. There's no need to apply masks
1509            // because the unmasked parts will be overwritten by fields.
1510            // Write the fields.
1511            self.0.encode(encoder, offset + 0, depth)?;
1512            Ok(())
1513        }
1514    }
1515
1516    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1517        for PeerHandlerRequestOutgoingCallRequest
1518    {
1519        #[inline(always)]
1520        fn new_empty() -> Self {
1521            Self { action: fidl::new_empty!(CallAction, D) }
1522        }
1523
1524        #[inline]
1525        unsafe fn decode(
1526            &mut self,
1527            decoder: &mut fidl::encoding::Decoder<'_, D>,
1528            offset: usize,
1529            _depth: fidl::encoding::Depth,
1530        ) -> fidl::Result<()> {
1531            decoder.debug_check_bounds::<Self>(offset);
1532            // Verify that padding bytes are zero.
1533            fidl::decode!(CallAction, D, &mut self.action, decoder, offset + 0, _depth)?;
1534            Ok(())
1535        }
1536    }
1537
1538    impl fidl::encoding::ValueTypeMarker for PeerHandlerSetNrecModeRequest {
1539        type Borrowed<'a> = &'a Self;
1540        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1541            value
1542        }
1543    }
1544
1545    unsafe impl fidl::encoding::TypeMarker for PeerHandlerSetNrecModeRequest {
1546        type Owned = Self;
1547
1548        #[inline(always)]
1549        fn inline_align(_context: fidl::encoding::Context) -> usize {
1550            1
1551        }
1552
1553        #[inline(always)]
1554        fn inline_size(_context: fidl::encoding::Context) -> usize {
1555            1
1556        }
1557    }
1558
1559    unsafe impl<D: fidl::encoding::ResourceDialect>
1560        fidl::encoding::Encode<PeerHandlerSetNrecModeRequest, D>
1561        for &PeerHandlerSetNrecModeRequest
1562    {
1563        #[inline]
1564        unsafe fn encode(
1565            self,
1566            encoder: &mut fidl::encoding::Encoder<'_, D>,
1567            offset: usize,
1568            _depth: fidl::encoding::Depth,
1569        ) -> fidl::Result<()> {
1570            encoder.debug_check_bounds::<PeerHandlerSetNrecModeRequest>(offset);
1571            // Delegate to tuple encoding.
1572            fidl::encoding::Encode::<PeerHandlerSetNrecModeRequest, D>::encode(
1573                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
1574                encoder,
1575                offset,
1576                _depth,
1577            )
1578        }
1579    }
1580    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1581        fidl::encoding::Encode<PeerHandlerSetNrecModeRequest, D> for (T0,)
1582    {
1583        #[inline]
1584        unsafe fn encode(
1585            self,
1586            encoder: &mut fidl::encoding::Encoder<'_, D>,
1587            offset: usize,
1588            depth: fidl::encoding::Depth,
1589        ) -> fidl::Result<()> {
1590            encoder.debug_check_bounds::<PeerHandlerSetNrecModeRequest>(offset);
1591            // Zero out padding regions. There's no need to apply masks
1592            // because the unmasked parts will be overwritten by fields.
1593            // Write the fields.
1594            self.0.encode(encoder, offset + 0, depth)?;
1595            Ok(())
1596        }
1597    }
1598
1599    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1600        for PeerHandlerSetNrecModeRequest
1601    {
1602        #[inline(always)]
1603        fn new_empty() -> Self {
1604            Self { enabled: fidl::new_empty!(bool, D) }
1605        }
1606
1607        #[inline]
1608        unsafe fn decode(
1609            &mut self,
1610            decoder: &mut fidl::encoding::Decoder<'_, D>,
1611            offset: usize,
1612            _depth: fidl::encoding::Depth,
1613        ) -> fidl::Result<()> {
1614            decoder.debug_check_bounds::<Self>(offset);
1615            // Verify that padding bytes are zero.
1616            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
1617            Ok(())
1618        }
1619    }
1620
1621    impl fidl::encoding::ValueTypeMarker for PeerHandlerSubscriberNumberInformationResponse {
1622        type Borrowed<'a> = &'a Self;
1623        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1624            value
1625        }
1626    }
1627
1628    unsafe impl fidl::encoding::TypeMarker for PeerHandlerSubscriberNumberInformationResponse {
1629        type Owned = Self;
1630
1631        #[inline(always)]
1632        fn inline_align(_context: fidl::encoding::Context) -> usize {
1633            8
1634        }
1635
1636        #[inline(always)]
1637        fn inline_size(_context: fidl::encoding::Context) -> usize {
1638            16
1639        }
1640    }
1641
1642    unsafe impl<D: fidl::encoding::ResourceDialect>
1643        fidl::encoding::Encode<PeerHandlerSubscriberNumberInformationResponse, D>
1644        for &PeerHandlerSubscriberNumberInformationResponse
1645    {
1646        #[inline]
1647        unsafe fn encode(
1648            self,
1649            encoder: &mut fidl::encoding::Encoder<'_, D>,
1650            offset: usize,
1651            _depth: fidl::encoding::Depth,
1652        ) -> fidl::Result<()> {
1653            encoder.debug_check_bounds::<PeerHandlerSubscriberNumberInformationResponse>(offset);
1654            // Delegate to tuple encoding.
1655            fidl::encoding::Encode::<PeerHandlerSubscriberNumberInformationResponse, D>::encode(
1656                (
1657                    <fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.numbers),
1658                ),
1659                encoder, offset, _depth
1660            )
1661        }
1662    }
1663    unsafe impl<
1664        D: fidl::encoding::ResourceDialect,
1665        T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>, D>,
1666    > fidl::encoding::Encode<PeerHandlerSubscriberNumberInformationResponse, D> for (T0,)
1667    {
1668        #[inline]
1669        unsafe fn encode(
1670            self,
1671            encoder: &mut fidl::encoding::Encoder<'_, D>,
1672            offset: usize,
1673            depth: fidl::encoding::Depth,
1674        ) -> fidl::Result<()> {
1675            encoder.debug_check_bounds::<PeerHandlerSubscriberNumberInformationResponse>(offset);
1676            // Zero out padding regions. There's no need to apply masks
1677            // because the unmasked parts will be overwritten by fields.
1678            // Write the fields.
1679            self.0.encode(encoder, offset + 0, depth)?;
1680            Ok(())
1681        }
1682    }
1683
1684    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1685        for PeerHandlerSubscriberNumberInformationResponse
1686    {
1687        #[inline(always)]
1688        fn new_empty() -> Self {
1689            Self {
1690                numbers: fidl::new_empty!(
1691                    fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1692                    D
1693                ),
1694            }
1695        }
1696
1697        #[inline]
1698        unsafe fn decode(
1699            &mut self,
1700            decoder: &mut fidl::encoding::Decoder<'_, D>,
1701            offset: usize,
1702            _depth: fidl::encoding::Depth,
1703        ) -> fidl::Result<()> {
1704            decoder.debug_check_bounds::<Self>(offset);
1705            // Verify that padding bytes are zero.
1706            fidl::decode!(
1707                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1708                D,
1709                &mut self.numbers,
1710                decoder,
1711                offset + 0,
1712                _depth
1713            )?;
1714            Ok(())
1715        }
1716    }
1717
1718    impl fidl::encoding::ValueTypeMarker for PeerHandlerWatchNetworkInformationResponse {
1719        type Borrowed<'a> = &'a Self;
1720        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1721            value
1722        }
1723    }
1724
1725    unsafe impl fidl::encoding::TypeMarker for PeerHandlerWatchNetworkInformationResponse {
1726        type Owned = Self;
1727
1728        #[inline(always)]
1729        fn inline_align(_context: fidl::encoding::Context) -> usize {
1730            8
1731        }
1732
1733        #[inline(always)]
1734        fn inline_size(_context: fidl::encoding::Context) -> usize {
1735            16
1736        }
1737    }
1738
1739    unsafe impl<D: fidl::encoding::ResourceDialect>
1740        fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, D>
1741        for &PeerHandlerWatchNetworkInformationResponse
1742    {
1743        #[inline]
1744        unsafe fn encode(
1745            self,
1746            encoder: &mut fidl::encoding::Encoder<'_, D>,
1747            offset: usize,
1748            _depth: fidl::encoding::Depth,
1749        ) -> fidl::Result<()> {
1750            encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
1751            // Delegate to tuple encoding.
1752            fidl::encoding::Encode::<PeerHandlerWatchNetworkInformationResponse, D>::encode(
1753                (<NetworkInformation as fidl::encoding::ValueTypeMarker>::borrow(&self.update),),
1754                encoder,
1755                offset,
1756                _depth,
1757            )
1758        }
1759    }
1760    unsafe impl<
1761        D: fidl::encoding::ResourceDialect,
1762        T0: fidl::encoding::Encode<NetworkInformation, D>,
1763    > fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, D> for (T0,)
1764    {
1765        #[inline]
1766        unsafe fn encode(
1767            self,
1768            encoder: &mut fidl::encoding::Encoder<'_, D>,
1769            offset: usize,
1770            depth: fidl::encoding::Depth,
1771        ) -> fidl::Result<()> {
1772            encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
1773            // Zero out padding regions. There's no need to apply masks
1774            // because the unmasked parts will be overwritten by fields.
1775            // Write the fields.
1776            self.0.encode(encoder, offset + 0, depth)?;
1777            Ok(())
1778        }
1779    }
1780
1781    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1782        for PeerHandlerWatchNetworkInformationResponse
1783    {
1784        #[inline(always)]
1785        fn new_empty() -> Self {
1786            Self { update: fidl::new_empty!(NetworkInformation, D) }
1787        }
1788
1789        #[inline]
1790        unsafe fn decode(
1791            &mut self,
1792            decoder: &mut fidl::encoding::Decoder<'_, D>,
1793            offset: usize,
1794            _depth: fidl::encoding::Depth,
1795        ) -> fidl::Result<()> {
1796            decoder.debug_check_bounds::<Self>(offset);
1797            // Verify that padding bytes are zero.
1798            fidl::decode!(NetworkInformation, D, &mut self.update, decoder, offset + 0, _depth)?;
1799            Ok(())
1800        }
1801    }
1802
1803    impl fidl::encoding::ValueTypeMarker for RedialLast {
1804        type Borrowed<'a> = &'a Self;
1805        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1806            value
1807        }
1808    }
1809
1810    unsafe impl fidl::encoding::TypeMarker for RedialLast {
1811        type Owned = Self;
1812
1813        #[inline(always)]
1814        fn inline_align(_context: fidl::encoding::Context) -> usize {
1815            1
1816        }
1817
1818        #[inline(always)]
1819        fn inline_size(_context: fidl::encoding::Context) -> usize {
1820            1
1821        }
1822    }
1823
1824    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RedialLast, D>
1825        for &RedialLast
1826    {
1827        #[inline]
1828        unsafe fn encode(
1829            self,
1830            encoder: &mut fidl::encoding::Encoder<'_, D>,
1831            offset: usize,
1832            _depth: fidl::encoding::Depth,
1833        ) -> fidl::Result<()> {
1834            encoder.debug_check_bounds::<RedialLast>(offset);
1835            encoder.write_num(0u8, offset);
1836            Ok(())
1837        }
1838    }
1839
1840    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RedialLast {
1841        #[inline(always)]
1842        fn new_empty() -> Self {
1843            Self
1844        }
1845
1846        #[inline]
1847        unsafe fn decode(
1848            &mut self,
1849            decoder: &mut fidl::encoding::Decoder<'_, D>,
1850            offset: usize,
1851            _depth: fidl::encoding::Depth,
1852        ) -> fidl::Result<()> {
1853            decoder.debug_check_bounds::<Self>(offset);
1854            match decoder.read_num::<u8>(offset) {
1855                0 => Ok(()),
1856                _ => Err(fidl::Error::Invalid),
1857            }
1858        }
1859    }
1860
1861    impl fidl::encoding::ValueTypeMarker for TransferActive {
1862        type Borrowed<'a> = &'a Self;
1863        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1864            value
1865        }
1866    }
1867
1868    unsafe impl fidl::encoding::TypeMarker for TransferActive {
1869        type Owned = Self;
1870
1871        #[inline(always)]
1872        fn inline_align(_context: fidl::encoding::Context) -> usize {
1873            1
1874        }
1875
1876        #[inline(always)]
1877        fn inline_size(_context: fidl::encoding::Context) -> usize {
1878            1
1879        }
1880    }
1881
1882    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransferActive, D>
1883        for &TransferActive
1884    {
1885        #[inline]
1886        unsafe fn encode(
1887            self,
1888            encoder: &mut fidl::encoding::Encoder<'_, D>,
1889            offset: usize,
1890            _depth: fidl::encoding::Depth,
1891        ) -> fidl::Result<()> {
1892            encoder.debug_check_bounds::<TransferActive>(offset);
1893            encoder.write_num(0u8, offset);
1894            Ok(())
1895        }
1896    }
1897
1898    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransferActive {
1899        #[inline(always)]
1900        fn new_empty() -> Self {
1901            Self
1902        }
1903
1904        #[inline]
1905        unsafe fn decode(
1906            &mut self,
1907            decoder: &mut fidl::encoding::Decoder<'_, D>,
1908            offset: usize,
1909            _depth: fidl::encoding::Depth,
1910        ) -> fidl::Result<()> {
1911            decoder.debug_check_bounds::<Self>(offset);
1912            match decoder.read_num::<u8>(offset) {
1913                0 => Ok(()),
1914                _ => Err(fidl::Error::Invalid),
1915            }
1916        }
1917    }
1918
1919    impl NetworkInformation {
1920        #[inline(always)]
1921        fn max_ordinal_present(&self) -> u64 {
1922            if let Some(_) = self.roaming {
1923                return 3;
1924            }
1925            if let Some(_) = self.signal_strength {
1926                return 2;
1927            }
1928            if let Some(_) = self.service_available {
1929                return 1;
1930            }
1931            0
1932        }
1933    }
1934
1935    impl fidl::encoding::ValueTypeMarker for NetworkInformation {
1936        type Borrowed<'a> = &'a Self;
1937        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1938            value
1939        }
1940    }
1941
1942    unsafe impl fidl::encoding::TypeMarker for NetworkInformation {
1943        type Owned = Self;
1944
1945        #[inline(always)]
1946        fn inline_align(_context: fidl::encoding::Context) -> usize {
1947            8
1948        }
1949
1950        #[inline(always)]
1951        fn inline_size(_context: fidl::encoding::Context) -> usize {
1952            16
1953        }
1954    }
1955
1956    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkInformation, D>
1957        for &NetworkInformation
1958    {
1959        unsafe fn encode(
1960            self,
1961            encoder: &mut fidl::encoding::Encoder<'_, D>,
1962            offset: usize,
1963            mut depth: fidl::encoding::Depth,
1964        ) -> fidl::Result<()> {
1965            encoder.debug_check_bounds::<NetworkInformation>(offset);
1966            // Vector header
1967            let max_ordinal: u64 = self.max_ordinal_present();
1968            encoder.write_num(max_ordinal, offset);
1969            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1970            // Calling encoder.out_of_line_offset(0) is not allowed.
1971            if max_ordinal == 0 {
1972                return Ok(());
1973            }
1974            depth.increment()?;
1975            let envelope_size = 8;
1976            let bytes_len = max_ordinal as usize * envelope_size;
1977            #[allow(unused_variables)]
1978            let offset = encoder.out_of_line_offset(bytes_len);
1979            let mut _prev_end_offset: usize = 0;
1980            if 1 > max_ordinal {
1981                return Ok(());
1982            }
1983
1984            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1985            // are envelope_size bytes.
1986            let cur_offset: usize = (1 - 1) * envelope_size;
1987
1988            // Zero reserved fields.
1989            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1990
1991            // Safety:
1992            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1993            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1994            //   envelope_size bytes, there is always sufficient room.
1995            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1996                self.service_available
1997                    .as_ref()
1998                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1999                encoder,
2000                offset + cur_offset,
2001                depth,
2002            )?;
2003
2004            _prev_end_offset = cur_offset + envelope_size;
2005            if 2 > max_ordinal {
2006                return Ok(());
2007            }
2008
2009            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2010            // are envelope_size bytes.
2011            let cur_offset: usize = (2 - 1) * envelope_size;
2012
2013            // Zero reserved fields.
2014            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2015
2016            // Safety:
2017            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2018            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2019            //   envelope_size bytes, there is always sufficient room.
2020            fidl::encoding::encode_in_envelope_optional::<SignalStrength, D>(
2021                self.signal_strength
2022                    .as_ref()
2023                    .map(<SignalStrength as fidl::encoding::ValueTypeMarker>::borrow),
2024                encoder,
2025                offset + cur_offset,
2026                depth,
2027            )?;
2028
2029            _prev_end_offset = cur_offset + envelope_size;
2030            if 3 > max_ordinal {
2031                return Ok(());
2032            }
2033
2034            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2035            // are envelope_size bytes.
2036            let cur_offset: usize = (3 - 1) * envelope_size;
2037
2038            // Zero reserved fields.
2039            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2040
2041            // Safety:
2042            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2043            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2044            //   envelope_size bytes, there is always sufficient room.
2045            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2046                self.roaming.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2047                encoder,
2048                offset + cur_offset,
2049                depth,
2050            )?;
2051
2052            _prev_end_offset = cur_offset + envelope_size;
2053
2054            Ok(())
2055        }
2056    }
2057
2058    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInformation {
2059        #[inline(always)]
2060        fn new_empty() -> Self {
2061            Self::default()
2062        }
2063
2064        unsafe fn decode(
2065            &mut self,
2066            decoder: &mut fidl::encoding::Decoder<'_, D>,
2067            offset: usize,
2068            mut depth: fidl::encoding::Depth,
2069        ) -> fidl::Result<()> {
2070            decoder.debug_check_bounds::<Self>(offset);
2071            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2072                None => return Err(fidl::Error::NotNullable),
2073                Some(len) => len,
2074            };
2075            // Calling decoder.out_of_line_offset(0) is not allowed.
2076            if len == 0 {
2077                return Ok(());
2078            };
2079            depth.increment()?;
2080            let envelope_size = 8;
2081            let bytes_len = len * envelope_size;
2082            let offset = decoder.out_of_line_offset(bytes_len)?;
2083            // Decode the envelope for each type.
2084            let mut _next_ordinal_to_read = 0;
2085            let mut next_offset = offset;
2086            let end_offset = offset + bytes_len;
2087            _next_ordinal_to_read += 1;
2088            if next_offset >= end_offset {
2089                return Ok(());
2090            }
2091
2092            // Decode unknown envelopes for gaps in ordinals.
2093            while _next_ordinal_to_read < 1 {
2094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2095                _next_ordinal_to_read += 1;
2096                next_offset += envelope_size;
2097            }
2098
2099            let next_out_of_line = decoder.next_out_of_line();
2100            let handles_before = decoder.remaining_handles();
2101            if let Some((inlined, num_bytes, num_handles)) =
2102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2103            {
2104                let member_inline_size =
2105                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2106                if inlined != (member_inline_size <= 4) {
2107                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2108                }
2109                let inner_offset;
2110                let mut inner_depth = depth.clone();
2111                if inlined {
2112                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2113                    inner_offset = next_offset;
2114                } else {
2115                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2116                    inner_depth.increment()?;
2117                }
2118                let val_ref =
2119                    self.service_available.get_or_insert_with(|| fidl::new_empty!(bool, D));
2120                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2121                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2122                {
2123                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2124                }
2125                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2126                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2127                }
2128            }
2129
2130            next_offset += envelope_size;
2131            _next_ordinal_to_read += 1;
2132            if next_offset >= end_offset {
2133                return Ok(());
2134            }
2135
2136            // Decode unknown envelopes for gaps in ordinals.
2137            while _next_ordinal_to_read < 2 {
2138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2139                _next_ordinal_to_read += 1;
2140                next_offset += envelope_size;
2141            }
2142
2143            let next_out_of_line = decoder.next_out_of_line();
2144            let handles_before = decoder.remaining_handles();
2145            if let Some((inlined, num_bytes, num_handles)) =
2146                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2147            {
2148                let member_inline_size =
2149                    <SignalStrength as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2150                if inlined != (member_inline_size <= 4) {
2151                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2152                }
2153                let inner_offset;
2154                let mut inner_depth = depth.clone();
2155                if inlined {
2156                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2157                    inner_offset = next_offset;
2158                } else {
2159                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2160                    inner_depth.increment()?;
2161                }
2162                let val_ref =
2163                    self.signal_strength.get_or_insert_with(|| fidl::new_empty!(SignalStrength, D));
2164                fidl::decode!(SignalStrength, D, val_ref, decoder, inner_offset, inner_depth)?;
2165                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2166                {
2167                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2168                }
2169                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2170                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2171                }
2172            }
2173
2174            next_offset += envelope_size;
2175            _next_ordinal_to_read += 1;
2176            if next_offset >= end_offset {
2177                return Ok(());
2178            }
2179
2180            // Decode unknown envelopes for gaps in ordinals.
2181            while _next_ordinal_to_read < 3 {
2182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2183                _next_ordinal_to_read += 1;
2184                next_offset += envelope_size;
2185            }
2186
2187            let next_out_of_line = decoder.next_out_of_line();
2188            let handles_before = decoder.remaining_handles();
2189            if let Some((inlined, num_bytes, num_handles)) =
2190                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2191            {
2192                let member_inline_size =
2193                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2194                if inlined != (member_inline_size <= 4) {
2195                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2196                }
2197                let inner_offset;
2198                let mut inner_depth = depth.clone();
2199                if inlined {
2200                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2201                    inner_offset = next_offset;
2202                } else {
2203                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2204                    inner_depth.increment()?;
2205                }
2206                let val_ref = self.roaming.get_or_insert_with(|| fidl::new_empty!(bool, D));
2207                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2208                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2209                {
2210                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2211                }
2212                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2213                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2214                }
2215            }
2216
2217            next_offset += envelope_size;
2218
2219            // Decode the remaining unknown envelopes.
2220            while next_offset < end_offset {
2221                _next_ordinal_to_read += 1;
2222                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2223                next_offset += envelope_size;
2224            }
2225
2226            Ok(())
2227        }
2228    }
2229
2230    impl fidl::encoding::ValueTypeMarker for CallAction {
2231        type Borrowed<'a> = &'a Self;
2232        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2233            value
2234        }
2235    }
2236
2237    unsafe impl fidl::encoding::TypeMarker for CallAction {
2238        type Owned = Self;
2239
2240        #[inline(always)]
2241        fn inline_align(_context: fidl::encoding::Context) -> usize {
2242            8
2243        }
2244
2245        #[inline(always)]
2246        fn inline_size(_context: fidl::encoding::Context) -> usize {
2247            16
2248        }
2249    }
2250
2251    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CallAction, D>
2252        for &CallAction
2253    {
2254        #[inline]
2255        unsafe fn encode(
2256            self,
2257            encoder: &mut fidl::encoding::Encoder<'_, D>,
2258            offset: usize,
2259            _depth: fidl::encoding::Depth,
2260        ) -> fidl::Result<()> {
2261            encoder.debug_check_bounds::<CallAction>(offset);
2262            encoder.write_num::<u64>(self.ordinal(), offset);
2263            match self {
2264                CallAction::DialFromNumber(ref val) => fidl::encoding::encode_in_envelope::<
2265                    fidl::encoding::BoundedString<256>,
2266                    D,
2267                >(
2268                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2269                        val,
2270                    ),
2271                    encoder,
2272                    offset + 8,
2273                    _depth,
2274                ),
2275                CallAction::DialFromLocation(ref val) => fidl::encoding::encode_in_envelope::<
2276                    fidl::encoding::BoundedString<256>,
2277                    D,
2278                >(
2279                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2280                        val,
2281                    ),
2282                    encoder,
2283                    offset + 8,
2284                    _depth,
2285                ),
2286                CallAction::RedialLast(ref val) => {
2287                    fidl::encoding::encode_in_envelope::<RedialLast, D>(
2288                        <RedialLast as fidl::encoding::ValueTypeMarker>::borrow(val),
2289                        encoder,
2290                        offset + 8,
2291                        _depth,
2292                    )
2293                }
2294                CallAction::TransferActive(ref val) => {
2295                    fidl::encoding::encode_in_envelope::<TransferActive, D>(
2296                        <TransferActive as fidl::encoding::ValueTypeMarker>::borrow(val),
2297                        encoder,
2298                        offset + 8,
2299                        _depth,
2300                    )
2301                }
2302            }
2303        }
2304    }
2305
2306    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallAction {
2307        #[inline(always)]
2308        fn new_empty() -> Self {
2309            Self::DialFromNumber(fidl::new_empty!(fidl::encoding::BoundedString<256>, D))
2310        }
2311
2312        #[inline]
2313        unsafe fn decode(
2314            &mut self,
2315            decoder: &mut fidl::encoding::Decoder<'_, D>,
2316            offset: usize,
2317            mut depth: fidl::encoding::Depth,
2318        ) -> fidl::Result<()> {
2319            decoder.debug_check_bounds::<Self>(offset);
2320            #[allow(unused_variables)]
2321            let next_out_of_line = decoder.next_out_of_line();
2322            let handles_before = decoder.remaining_handles();
2323            let (ordinal, inlined, num_bytes, num_handles) =
2324                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2325
2326            let member_inline_size = match ordinal {
2327                1 => {
2328                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2329                        decoder.context,
2330                    )
2331                }
2332                2 => {
2333                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2334                        decoder.context,
2335                    )
2336                }
2337                3 => <RedialLast as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2338                4 => <TransferActive as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2339                _ => return Err(fidl::Error::UnknownUnionTag),
2340            };
2341
2342            if inlined != (member_inline_size <= 4) {
2343                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2344            }
2345            let _inner_offset;
2346            if inlined {
2347                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2348                _inner_offset = offset + 8;
2349            } else {
2350                depth.increment()?;
2351                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2352            }
2353            match ordinal {
2354                1 => {
2355                    #[allow(irrefutable_let_patterns)]
2356                    if let CallAction::DialFromNumber(_) = self {
2357                        // Do nothing, read the value into the object
2358                    } else {
2359                        // Initialize `self` to the right variant
2360                        *self = CallAction::DialFromNumber(fidl::new_empty!(
2361                            fidl::encoding::BoundedString<256>,
2362                            D
2363                        ));
2364                    }
2365                    #[allow(irrefutable_let_patterns)]
2366                    if let CallAction::DialFromNumber(ref mut val) = self {
2367                        fidl::decode!(
2368                            fidl::encoding::BoundedString<256>,
2369                            D,
2370                            val,
2371                            decoder,
2372                            _inner_offset,
2373                            depth
2374                        )?;
2375                    } else {
2376                        unreachable!()
2377                    }
2378                }
2379                2 => {
2380                    #[allow(irrefutable_let_patterns)]
2381                    if let CallAction::DialFromLocation(_) = self {
2382                        // Do nothing, read the value into the object
2383                    } else {
2384                        // Initialize `self` to the right variant
2385                        *self = CallAction::DialFromLocation(fidl::new_empty!(
2386                            fidl::encoding::BoundedString<256>,
2387                            D
2388                        ));
2389                    }
2390                    #[allow(irrefutable_let_patterns)]
2391                    if let CallAction::DialFromLocation(ref mut val) = self {
2392                        fidl::decode!(
2393                            fidl::encoding::BoundedString<256>,
2394                            D,
2395                            val,
2396                            decoder,
2397                            _inner_offset,
2398                            depth
2399                        )?;
2400                    } else {
2401                        unreachable!()
2402                    }
2403                }
2404                3 => {
2405                    #[allow(irrefutable_let_patterns)]
2406                    if let CallAction::RedialLast(_) = self {
2407                        // Do nothing, read the value into the object
2408                    } else {
2409                        // Initialize `self` to the right variant
2410                        *self = CallAction::RedialLast(fidl::new_empty!(RedialLast, D));
2411                    }
2412                    #[allow(irrefutable_let_patterns)]
2413                    if let CallAction::RedialLast(ref mut val) = self {
2414                        fidl::decode!(RedialLast, D, val, decoder, _inner_offset, depth)?;
2415                    } else {
2416                        unreachable!()
2417                    }
2418                }
2419                4 => {
2420                    #[allow(irrefutable_let_patterns)]
2421                    if let CallAction::TransferActive(_) = self {
2422                        // Do nothing, read the value into the object
2423                    } else {
2424                        // Initialize `self` to the right variant
2425                        *self = CallAction::TransferActive(fidl::new_empty!(TransferActive, D));
2426                    }
2427                    #[allow(irrefutable_let_patterns)]
2428                    if let CallAction::TransferActive(ref mut val) = self {
2429                        fidl::decode!(TransferActive, D, val, decoder, _inner_offset, depth)?;
2430                    } else {
2431                        unreachable!()
2432                    }
2433                }
2434                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2435            }
2436            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2437                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2438            }
2439            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2440                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2441            }
2442            Ok(())
2443        }
2444    }
2445}