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<
1666                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1667                D,
1668            >,
1669        > fidl::encoding::Encode<PeerHandlerSubscriberNumberInformationResponse, D> for (T0,)
1670    {
1671        #[inline]
1672        unsafe fn encode(
1673            self,
1674            encoder: &mut fidl::encoding::Encoder<'_, D>,
1675            offset: usize,
1676            depth: fidl::encoding::Depth,
1677        ) -> fidl::Result<()> {
1678            encoder.debug_check_bounds::<PeerHandlerSubscriberNumberInformationResponse>(offset);
1679            // Zero out padding regions. There's no need to apply masks
1680            // because the unmasked parts will be overwritten by fields.
1681            // Write the fields.
1682            self.0.encode(encoder, offset + 0, depth)?;
1683            Ok(())
1684        }
1685    }
1686
1687    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1688        for PeerHandlerSubscriberNumberInformationResponse
1689    {
1690        #[inline(always)]
1691        fn new_empty() -> Self {
1692            Self {
1693                numbers: fidl::new_empty!(
1694                    fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1695                    D
1696                ),
1697            }
1698        }
1699
1700        #[inline]
1701        unsafe fn decode(
1702            &mut self,
1703            decoder: &mut fidl::encoding::Decoder<'_, D>,
1704            offset: usize,
1705            _depth: fidl::encoding::Depth,
1706        ) -> fidl::Result<()> {
1707            decoder.debug_check_bounds::<Self>(offset);
1708            // Verify that padding bytes are zero.
1709            fidl::decode!(
1710                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 128>,
1711                D,
1712                &mut self.numbers,
1713                decoder,
1714                offset + 0,
1715                _depth
1716            )?;
1717            Ok(())
1718        }
1719    }
1720
1721    impl fidl::encoding::ValueTypeMarker for PeerHandlerWatchNetworkInformationResponse {
1722        type Borrowed<'a> = &'a Self;
1723        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1724            value
1725        }
1726    }
1727
1728    unsafe impl fidl::encoding::TypeMarker for PeerHandlerWatchNetworkInformationResponse {
1729        type Owned = Self;
1730
1731        #[inline(always)]
1732        fn inline_align(_context: fidl::encoding::Context) -> usize {
1733            8
1734        }
1735
1736        #[inline(always)]
1737        fn inline_size(_context: fidl::encoding::Context) -> usize {
1738            16
1739        }
1740    }
1741
1742    unsafe impl<D: fidl::encoding::ResourceDialect>
1743        fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, D>
1744        for &PeerHandlerWatchNetworkInformationResponse
1745    {
1746        #[inline]
1747        unsafe fn encode(
1748            self,
1749            encoder: &mut fidl::encoding::Encoder<'_, D>,
1750            offset: usize,
1751            _depth: fidl::encoding::Depth,
1752        ) -> fidl::Result<()> {
1753            encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
1754            // Delegate to tuple encoding.
1755            fidl::encoding::Encode::<PeerHandlerWatchNetworkInformationResponse, D>::encode(
1756                (<NetworkInformation as fidl::encoding::ValueTypeMarker>::borrow(&self.update),),
1757                encoder,
1758                offset,
1759                _depth,
1760            )
1761        }
1762    }
1763    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetworkInformation, D>>
1764        fidl::encoding::Encode<PeerHandlerWatchNetworkInformationResponse, D> for (T0,)
1765    {
1766        #[inline]
1767        unsafe fn encode(
1768            self,
1769            encoder: &mut fidl::encoding::Encoder<'_, D>,
1770            offset: usize,
1771            depth: fidl::encoding::Depth,
1772        ) -> fidl::Result<()> {
1773            encoder.debug_check_bounds::<PeerHandlerWatchNetworkInformationResponse>(offset);
1774            // Zero out padding regions. There's no need to apply masks
1775            // because the unmasked parts will be overwritten by fields.
1776            // Write the fields.
1777            self.0.encode(encoder, offset + 0, depth)?;
1778            Ok(())
1779        }
1780    }
1781
1782    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1783        for PeerHandlerWatchNetworkInformationResponse
1784    {
1785        #[inline(always)]
1786        fn new_empty() -> Self {
1787            Self { update: fidl::new_empty!(NetworkInformation, D) }
1788        }
1789
1790        #[inline]
1791        unsafe fn decode(
1792            &mut self,
1793            decoder: &mut fidl::encoding::Decoder<'_, D>,
1794            offset: usize,
1795            _depth: fidl::encoding::Depth,
1796        ) -> fidl::Result<()> {
1797            decoder.debug_check_bounds::<Self>(offset);
1798            // Verify that padding bytes are zero.
1799            fidl::decode!(NetworkInformation, D, &mut self.update, decoder, offset + 0, _depth)?;
1800            Ok(())
1801        }
1802    }
1803
1804    impl fidl::encoding::ValueTypeMarker for RedialLast {
1805        type Borrowed<'a> = &'a Self;
1806        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1807            value
1808        }
1809    }
1810
1811    unsafe impl fidl::encoding::TypeMarker for RedialLast {
1812        type Owned = Self;
1813
1814        #[inline(always)]
1815        fn inline_align(_context: fidl::encoding::Context) -> usize {
1816            1
1817        }
1818
1819        #[inline(always)]
1820        fn inline_size(_context: fidl::encoding::Context) -> usize {
1821            1
1822        }
1823    }
1824
1825    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RedialLast, D>
1826        for &RedialLast
1827    {
1828        #[inline]
1829        unsafe fn encode(
1830            self,
1831            encoder: &mut fidl::encoding::Encoder<'_, D>,
1832            offset: usize,
1833            _depth: fidl::encoding::Depth,
1834        ) -> fidl::Result<()> {
1835            encoder.debug_check_bounds::<RedialLast>(offset);
1836            encoder.write_num(0u8, offset);
1837            Ok(())
1838        }
1839    }
1840
1841    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RedialLast {
1842        #[inline(always)]
1843        fn new_empty() -> Self {
1844            Self
1845        }
1846
1847        #[inline]
1848        unsafe fn decode(
1849            &mut self,
1850            decoder: &mut fidl::encoding::Decoder<'_, D>,
1851            offset: usize,
1852            _depth: fidl::encoding::Depth,
1853        ) -> fidl::Result<()> {
1854            decoder.debug_check_bounds::<Self>(offset);
1855            match decoder.read_num::<u8>(offset) {
1856                0 => Ok(()),
1857                _ => Err(fidl::Error::Invalid),
1858            }
1859        }
1860    }
1861
1862    impl fidl::encoding::ValueTypeMarker for TransferActive {
1863        type Borrowed<'a> = &'a Self;
1864        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1865            value
1866        }
1867    }
1868
1869    unsafe impl fidl::encoding::TypeMarker for TransferActive {
1870        type Owned = Self;
1871
1872        #[inline(always)]
1873        fn inline_align(_context: fidl::encoding::Context) -> usize {
1874            1
1875        }
1876
1877        #[inline(always)]
1878        fn inline_size(_context: fidl::encoding::Context) -> usize {
1879            1
1880        }
1881    }
1882
1883    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransferActive, D>
1884        for &TransferActive
1885    {
1886        #[inline]
1887        unsafe fn encode(
1888            self,
1889            encoder: &mut fidl::encoding::Encoder<'_, D>,
1890            offset: usize,
1891            _depth: fidl::encoding::Depth,
1892        ) -> fidl::Result<()> {
1893            encoder.debug_check_bounds::<TransferActive>(offset);
1894            encoder.write_num(0u8, offset);
1895            Ok(())
1896        }
1897    }
1898
1899    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransferActive {
1900        #[inline(always)]
1901        fn new_empty() -> Self {
1902            Self
1903        }
1904
1905        #[inline]
1906        unsafe fn decode(
1907            &mut self,
1908            decoder: &mut fidl::encoding::Decoder<'_, D>,
1909            offset: usize,
1910            _depth: fidl::encoding::Depth,
1911        ) -> fidl::Result<()> {
1912            decoder.debug_check_bounds::<Self>(offset);
1913            match decoder.read_num::<u8>(offset) {
1914                0 => Ok(()),
1915                _ => Err(fidl::Error::Invalid),
1916            }
1917        }
1918    }
1919
1920    impl NetworkInformation {
1921        #[inline(always)]
1922        fn max_ordinal_present(&self) -> u64 {
1923            if let Some(_) = self.roaming {
1924                return 3;
1925            }
1926            if let Some(_) = self.signal_strength {
1927                return 2;
1928            }
1929            if let Some(_) = self.service_available {
1930                return 1;
1931            }
1932            0
1933        }
1934    }
1935
1936    impl fidl::encoding::ValueTypeMarker for NetworkInformation {
1937        type Borrowed<'a> = &'a Self;
1938        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1939            value
1940        }
1941    }
1942
1943    unsafe impl fidl::encoding::TypeMarker for NetworkInformation {
1944        type Owned = Self;
1945
1946        #[inline(always)]
1947        fn inline_align(_context: fidl::encoding::Context) -> usize {
1948            8
1949        }
1950
1951        #[inline(always)]
1952        fn inline_size(_context: fidl::encoding::Context) -> usize {
1953            16
1954        }
1955    }
1956
1957    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkInformation, D>
1958        for &NetworkInformation
1959    {
1960        unsafe fn encode(
1961            self,
1962            encoder: &mut fidl::encoding::Encoder<'_, D>,
1963            offset: usize,
1964            mut depth: fidl::encoding::Depth,
1965        ) -> fidl::Result<()> {
1966            encoder.debug_check_bounds::<NetworkInformation>(offset);
1967            // Vector header
1968            let max_ordinal: u64 = self.max_ordinal_present();
1969            encoder.write_num(max_ordinal, offset);
1970            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1971            // Calling encoder.out_of_line_offset(0) is not allowed.
1972            if max_ordinal == 0 {
1973                return Ok(());
1974            }
1975            depth.increment()?;
1976            let envelope_size = 8;
1977            let bytes_len = max_ordinal as usize * envelope_size;
1978            #[allow(unused_variables)]
1979            let offset = encoder.out_of_line_offset(bytes_len);
1980            let mut _prev_end_offset: usize = 0;
1981            if 1 > max_ordinal {
1982                return Ok(());
1983            }
1984
1985            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1986            // are envelope_size bytes.
1987            let cur_offset: usize = (1 - 1) * envelope_size;
1988
1989            // Zero reserved fields.
1990            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1991
1992            // Safety:
1993            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1994            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1995            //   envelope_size bytes, there is always sufficient room.
1996            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1997                self.service_available
1998                    .as_ref()
1999                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2000                encoder,
2001                offset + cur_offset,
2002                depth,
2003            )?;
2004
2005            _prev_end_offset = cur_offset + envelope_size;
2006            if 2 > max_ordinal {
2007                return Ok(());
2008            }
2009
2010            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2011            // are envelope_size bytes.
2012            let cur_offset: usize = (2 - 1) * envelope_size;
2013
2014            // Zero reserved fields.
2015            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2016
2017            // Safety:
2018            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2019            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2020            //   envelope_size bytes, there is always sufficient room.
2021            fidl::encoding::encode_in_envelope_optional::<SignalStrength, D>(
2022                self.signal_strength
2023                    .as_ref()
2024                    .map(<SignalStrength as fidl::encoding::ValueTypeMarker>::borrow),
2025                encoder,
2026                offset + cur_offset,
2027                depth,
2028            )?;
2029
2030            _prev_end_offset = cur_offset + envelope_size;
2031            if 3 > max_ordinal {
2032                return Ok(());
2033            }
2034
2035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2036            // are envelope_size bytes.
2037            let cur_offset: usize = (3 - 1) * envelope_size;
2038
2039            // Zero reserved fields.
2040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2041
2042            // Safety:
2043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2045            //   envelope_size bytes, there is always sufficient room.
2046            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2047                self.roaming.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2048                encoder,
2049                offset + cur_offset,
2050                depth,
2051            )?;
2052
2053            _prev_end_offset = cur_offset + envelope_size;
2054
2055            Ok(())
2056        }
2057    }
2058
2059    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInformation {
2060        #[inline(always)]
2061        fn new_empty() -> Self {
2062            Self::default()
2063        }
2064
2065        unsafe fn decode(
2066            &mut self,
2067            decoder: &mut fidl::encoding::Decoder<'_, D>,
2068            offset: usize,
2069            mut depth: fidl::encoding::Depth,
2070        ) -> fidl::Result<()> {
2071            decoder.debug_check_bounds::<Self>(offset);
2072            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2073                None => return Err(fidl::Error::NotNullable),
2074                Some(len) => len,
2075            };
2076            // Calling decoder.out_of_line_offset(0) is not allowed.
2077            if len == 0 {
2078                return Ok(());
2079            };
2080            depth.increment()?;
2081            let envelope_size = 8;
2082            let bytes_len = len * envelope_size;
2083            let offset = decoder.out_of_line_offset(bytes_len)?;
2084            // Decode the envelope for each type.
2085            let mut _next_ordinal_to_read = 0;
2086            let mut next_offset = offset;
2087            let end_offset = offset + bytes_len;
2088            _next_ordinal_to_read += 1;
2089            if next_offset >= end_offset {
2090                return Ok(());
2091            }
2092
2093            // Decode unknown envelopes for gaps in ordinals.
2094            while _next_ordinal_to_read < 1 {
2095                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2096                _next_ordinal_to_read += 1;
2097                next_offset += envelope_size;
2098            }
2099
2100            let next_out_of_line = decoder.next_out_of_line();
2101            let handles_before = decoder.remaining_handles();
2102            if let Some((inlined, num_bytes, num_handles)) =
2103                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2104            {
2105                let member_inline_size =
2106                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2107                if inlined != (member_inline_size <= 4) {
2108                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2109                }
2110                let inner_offset;
2111                let mut inner_depth = depth.clone();
2112                if inlined {
2113                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2114                    inner_offset = next_offset;
2115                } else {
2116                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2117                    inner_depth.increment()?;
2118                }
2119                let val_ref =
2120                    self.service_available.get_or_insert_with(|| fidl::new_empty!(bool, D));
2121                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2122                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2123                {
2124                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2125                }
2126                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2127                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2128                }
2129            }
2130
2131            next_offset += envelope_size;
2132            _next_ordinal_to_read += 1;
2133            if next_offset >= end_offset {
2134                return Ok(());
2135            }
2136
2137            // Decode unknown envelopes for gaps in ordinals.
2138            while _next_ordinal_to_read < 2 {
2139                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2140                _next_ordinal_to_read += 1;
2141                next_offset += envelope_size;
2142            }
2143
2144            let next_out_of_line = decoder.next_out_of_line();
2145            let handles_before = decoder.remaining_handles();
2146            if let Some((inlined, num_bytes, num_handles)) =
2147                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2148            {
2149                let member_inline_size =
2150                    <SignalStrength as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2151                if inlined != (member_inline_size <= 4) {
2152                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2153                }
2154                let inner_offset;
2155                let mut inner_depth = depth.clone();
2156                if inlined {
2157                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2158                    inner_offset = next_offset;
2159                } else {
2160                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2161                    inner_depth.increment()?;
2162                }
2163                let val_ref =
2164                    self.signal_strength.get_or_insert_with(|| fidl::new_empty!(SignalStrength, D));
2165                fidl::decode!(SignalStrength, D, val_ref, decoder, inner_offset, inner_depth)?;
2166                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2167                {
2168                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2169                }
2170                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2171                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2172                }
2173            }
2174
2175            next_offset += envelope_size;
2176            _next_ordinal_to_read += 1;
2177            if next_offset >= end_offset {
2178                return Ok(());
2179            }
2180
2181            // Decode unknown envelopes for gaps in ordinals.
2182            while _next_ordinal_to_read < 3 {
2183                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2184                _next_ordinal_to_read += 1;
2185                next_offset += envelope_size;
2186            }
2187
2188            let next_out_of_line = decoder.next_out_of_line();
2189            let handles_before = decoder.remaining_handles();
2190            if let Some((inlined, num_bytes, num_handles)) =
2191                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2192            {
2193                let member_inline_size =
2194                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2195                if inlined != (member_inline_size <= 4) {
2196                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2197                }
2198                let inner_offset;
2199                let mut inner_depth = depth.clone();
2200                if inlined {
2201                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2202                    inner_offset = next_offset;
2203                } else {
2204                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2205                    inner_depth.increment()?;
2206                }
2207                let val_ref = self.roaming.get_or_insert_with(|| fidl::new_empty!(bool, D));
2208                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2209                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2210                {
2211                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2212                }
2213                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2214                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2215                }
2216            }
2217
2218            next_offset += envelope_size;
2219
2220            // Decode the remaining unknown envelopes.
2221            while next_offset < end_offset {
2222                _next_ordinal_to_read += 1;
2223                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2224                next_offset += envelope_size;
2225            }
2226
2227            Ok(())
2228        }
2229    }
2230
2231    impl fidl::encoding::ValueTypeMarker for CallAction {
2232        type Borrowed<'a> = &'a Self;
2233        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2234            value
2235        }
2236    }
2237
2238    unsafe impl fidl::encoding::TypeMarker for CallAction {
2239        type Owned = Self;
2240
2241        #[inline(always)]
2242        fn inline_align(_context: fidl::encoding::Context) -> usize {
2243            8
2244        }
2245
2246        #[inline(always)]
2247        fn inline_size(_context: fidl::encoding::Context) -> usize {
2248            16
2249        }
2250    }
2251
2252    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CallAction, D>
2253        for &CallAction
2254    {
2255        #[inline]
2256        unsafe fn encode(
2257            self,
2258            encoder: &mut fidl::encoding::Encoder<'_, D>,
2259            offset: usize,
2260            _depth: fidl::encoding::Depth,
2261        ) -> fidl::Result<()> {
2262            encoder.debug_check_bounds::<CallAction>(offset);
2263            encoder.write_num::<u64>(self.ordinal(), offset);
2264            match self {
2265                CallAction::DialFromNumber(ref val) => fidl::encoding::encode_in_envelope::<
2266                    fidl::encoding::BoundedString<256>,
2267                    D,
2268                >(
2269                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2270                        val,
2271                    ),
2272                    encoder,
2273                    offset + 8,
2274                    _depth,
2275                ),
2276                CallAction::DialFromLocation(ref val) => fidl::encoding::encode_in_envelope::<
2277                    fidl::encoding::BoundedString<256>,
2278                    D,
2279                >(
2280                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
2281                        val,
2282                    ),
2283                    encoder,
2284                    offset + 8,
2285                    _depth,
2286                ),
2287                CallAction::RedialLast(ref val) => {
2288                    fidl::encoding::encode_in_envelope::<RedialLast, D>(
2289                        <RedialLast as fidl::encoding::ValueTypeMarker>::borrow(val),
2290                        encoder,
2291                        offset + 8,
2292                        _depth,
2293                    )
2294                }
2295                CallAction::TransferActive(ref val) => {
2296                    fidl::encoding::encode_in_envelope::<TransferActive, D>(
2297                        <TransferActive as fidl::encoding::ValueTypeMarker>::borrow(val),
2298                        encoder,
2299                        offset + 8,
2300                        _depth,
2301                    )
2302                }
2303            }
2304        }
2305    }
2306
2307    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CallAction {
2308        #[inline(always)]
2309        fn new_empty() -> Self {
2310            Self::DialFromNumber(fidl::new_empty!(fidl::encoding::BoundedString<256>, D))
2311        }
2312
2313        #[inline]
2314        unsafe fn decode(
2315            &mut self,
2316            decoder: &mut fidl::encoding::Decoder<'_, D>,
2317            offset: usize,
2318            mut depth: fidl::encoding::Depth,
2319        ) -> fidl::Result<()> {
2320            decoder.debug_check_bounds::<Self>(offset);
2321            #[allow(unused_variables)]
2322            let next_out_of_line = decoder.next_out_of_line();
2323            let handles_before = decoder.remaining_handles();
2324            let (ordinal, inlined, num_bytes, num_handles) =
2325                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2326
2327            let member_inline_size = match ordinal {
2328                1 => {
2329                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2330                        decoder.context,
2331                    )
2332                }
2333                2 => {
2334                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
2335                        decoder.context,
2336                    )
2337                }
2338                3 => <RedialLast as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2339                4 => <TransferActive as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2340                _ => return Err(fidl::Error::UnknownUnionTag),
2341            };
2342
2343            if inlined != (member_inline_size <= 4) {
2344                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2345            }
2346            let _inner_offset;
2347            if inlined {
2348                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2349                _inner_offset = offset + 8;
2350            } else {
2351                depth.increment()?;
2352                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2353            }
2354            match ordinal {
2355                1 => {
2356                    #[allow(irrefutable_let_patterns)]
2357                    if let CallAction::DialFromNumber(_) = self {
2358                        // Do nothing, read the value into the object
2359                    } else {
2360                        // Initialize `self` to the right variant
2361                        *self = CallAction::DialFromNumber(fidl::new_empty!(
2362                            fidl::encoding::BoundedString<256>,
2363                            D
2364                        ));
2365                    }
2366                    #[allow(irrefutable_let_patterns)]
2367                    if let CallAction::DialFromNumber(ref mut val) = self {
2368                        fidl::decode!(
2369                            fidl::encoding::BoundedString<256>,
2370                            D,
2371                            val,
2372                            decoder,
2373                            _inner_offset,
2374                            depth
2375                        )?;
2376                    } else {
2377                        unreachable!()
2378                    }
2379                }
2380                2 => {
2381                    #[allow(irrefutable_let_patterns)]
2382                    if let CallAction::DialFromLocation(_) = self {
2383                        // Do nothing, read the value into the object
2384                    } else {
2385                        // Initialize `self` to the right variant
2386                        *self = CallAction::DialFromLocation(fidl::new_empty!(
2387                            fidl::encoding::BoundedString<256>,
2388                            D
2389                        ));
2390                    }
2391                    #[allow(irrefutable_let_patterns)]
2392                    if let CallAction::DialFromLocation(ref mut val) = self {
2393                        fidl::decode!(
2394                            fidl::encoding::BoundedString<256>,
2395                            D,
2396                            val,
2397                            decoder,
2398                            _inner_offset,
2399                            depth
2400                        )?;
2401                    } else {
2402                        unreachable!()
2403                    }
2404                }
2405                3 => {
2406                    #[allow(irrefutable_let_patterns)]
2407                    if let CallAction::RedialLast(_) = self {
2408                        // Do nothing, read the value into the object
2409                    } else {
2410                        // Initialize `self` to the right variant
2411                        *self = CallAction::RedialLast(fidl::new_empty!(RedialLast, D));
2412                    }
2413                    #[allow(irrefutable_let_patterns)]
2414                    if let CallAction::RedialLast(ref mut val) = self {
2415                        fidl::decode!(RedialLast, D, val, decoder, _inner_offset, depth)?;
2416                    } else {
2417                        unreachable!()
2418                    }
2419                }
2420                4 => {
2421                    #[allow(irrefutable_let_patterns)]
2422                    if let CallAction::TransferActive(_) = self {
2423                        // Do nothing, read the value into the object
2424                    } else {
2425                        // Initialize `self` to the right variant
2426                        *self = CallAction::TransferActive(fidl::new_empty!(TransferActive, D));
2427                    }
2428                    #[allow(irrefutable_let_patterns)]
2429                    if let CallAction::TransferActive(ref mut val) = self {
2430                        fidl::decode!(TransferActive, D, val, decoder, _inner_offset, depth)?;
2431                    } else {
2432                        unreachable!()
2433                    }
2434                }
2435                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2436            }
2437            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2438                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2439            }
2440            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2441                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2442            }
2443            Ok(())
2444        }
2445    }
2446}